Agriculture-front-end/public/Cesium/Workers/createRectangleOutlineGeometry.js

2 lines
5.9 KiB
JavaScript
Raw Normal View History

2023-09-11 21:56:39 +08:00
define(["./when-b60132fc","./Cartesian2-47311507","./arrayFill-4513d7ad","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./Check-7b2a090c","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolygonPipeline-f49953b9","./PrimitiveType-39acab88","./RectangleGeometryLibrary-8761458c","./Cartesian4-3ca25aab","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./Transforms-cb0006b0","./buildModuleUrl-3addfe33","./FeatureDetection-c3b71206","./earcut-2.2.1-20c8012f","./EllipsoidRhumbLine-ed1a6bf4"],(function(e,t,i,a,r,n,o,l,u,s,d,c,p,f,g,h,y,b,m,_,v,E,A){"use strict";var G=new a.BoundingSphere,R=new a.BoundingSphere,P=new r.Cartesian3,C=new t.Rectangle;function w(e,t){var i=e._ellipsoid,a=t.height,r=t.width,o=t.northCap,s=t.southCap,c=a,p=2,h=0,y=4;o&&(p-=1,c-=1,h+=1,y-=2),s&&(p-=1,c-=1,h+=1,y-=2),h+=p*r+2*c-y;var b,m=new Float64Array(3*h),_=0,v=0,E=P;if(o)g.RectangleGeometryLibrary.computePosition(t,i,!1,v,0,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;else for(b=0;b<r;b++)g.RectangleGeometryLibrary.computePosition(t,i,!1,v,b,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;for(b=r-1,v=1;v<a;v++)g.RectangleGeometryLibrary.computePosition(t,i,!1,v,b,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;if(v=a-1,!s)for(b=r-2;b>=0;b--)g.RectangleGeometryLibrary.computePosition(t,i,!1,v,b,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;for(b=0,v=a-2;v>0;v--)g.RectangleGeometryLibrary.computePosition(t,i,!1,v,b,E),m[_++]=E.x,m[_++]=E.y,m[_++]=E.z;for(var A=m.length/3*2,G=d.IndexDatatype.createTypedArray(m.length/3,A),R=0,C=0;C<m.length/3-1;C++)G[R++]=C,G[R++]=C+1;G[R++]=m.length/3-1,G[R++]=0;var w=new l.Geometry({attributes:new u.GeometryAttributes,primitiveType:f.PrimitiveType.LINES});return w.attributes.position=new l.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:m}),w.indices=G,w}function L(i){var a=(i=e.defaultValue(i,e.defaultValue.EMPTY_OBJECT)).rectangle,r=e.defaultValue(i.granularity,c.CesiumMath.RADIANS_PER_DEGREE),n=e.defaultValue(i.ellipsoid,t.Ellipsoid.WGS84),o=e.defaultValue(i.rotation,0),l=e.defaultValue(i.height,0),u=e.defaultValue(i.extrudedHeight,l);this._rectangle=t.Rectangle.clone(a),this._granularity=r,this._ellipsoid=n,this._surfaceHeight=Math.max(l,u),this._rotation=o,this._extrudedHeight=Math.min(l,u),this._offsetAttribute=i.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}L.packedLength=t.Rectangle.packedLength+t.Ellipsoid.packedLength+5,L.pack=function(i,a,r){return r=e.defaultValue(r,0),t.Rectangle.pack(i._rectangle,a,r),r+=t.Rectangle.packedLength,t.Ellipsoid.pack(i._ellipsoid,a,r),r+=t.Ellipsoid.packedLength,a[r++]=i._granularity,a[r++]=i._surfaceHeight,a[r++]=i._rotation,a[r++]=i._extrudedHeight,a[r]=e.defaultValue(i._offsetAttribute,-1),a};var D=new t.Rectangle,S=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),x={rectangle:D,ellipsoid:S,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};L.unpack=function(i,a,r){a=e.defaultValue(a,0);var n=t.Rectangle.unpack(i,a,D);a+=t.Rectangle.packedLength;var o=t.Ellipsoid.unpack(i,a,S);a+=t.Ellipsoid.packedLength;var l=i[a++],u=i[a++],s=i[a++],d=i[a++],c=i[a];return e.defined(r)?(r._rectangle=t.Rectangle.clone(n,r._rectangle),r._ellipsoid=t.Ellipsoid.clone(o,r._ellipsoid),r._surfaceHeight=u,r._rotation=s,r._extrudedHeight=d,r._offsetAttribute=-1===c?void 0:c,r):(x.granularity=l,x.height=u,x.rotation=s,x.extrudedHeight=d,x.offsetAttribute=-1===c?void 0:c,new L(x))};var H=new r.Cartographic;return L.createGeometry=function(t){var r,o,u=t._rectangle,h=t._ellipsoid,y=g.RectangleGeometryLibrary.computeOptions(u,t._granularity,t._rotation,0,C,H);if(!c.CesiumMath.equalsEpsilon(u.north,u.south,c.CesiumMath.EPSILON10)&&!c.CesiumMath.equalsEpsilon(u.east,u.west,c.CesiumMath.EPSILON10)){var b,m=t._surfaceHeight,_=t._extrudedHeight;if(!c.CesiumMath.equalsEpsilon(m,_,0,c.CesiumMath.EPSILON2)){if(r=function(e,t){var i=e._surfaceHeight,a=e._extrudedHeight,r=e._ellipsoid,n=a,o=i,l=w(e,t),u=t