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

2 lines
5.9 KiB
JavaScript
Raw Normal View History

2023-04-16 22:33:44 +08:00
define(["./when-b60132fc","./Cartesian2-47311507","./arrayFill-4513d7ad","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./Check-7b2a090c","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PolygonPipeline-660e1625","./PrimitiveType-a54dc62f","./RectangleGeometryLibrary-9785d88b","./Event-16a2dfbf","./RuntimeError-4a5c8994","./WebGLConstants-4ae0db90","./FeatureDetection-c3b71206","./Cartesian4-3ca25aab","./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){"use strict";var A=new a.BoundingSphere,G=new a.BoundingSphere,R=new r.Cartesian3,P=new t.Rectangle;function C(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=R;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),P=0,C=0;C<m.length/3-1;C++)G[P++]=C,G[P++]=C+1;G[P++]=m.length/3-1,G[P++]=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 w(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"}w.packedLength=t.Rectangle.packedLength+t.Ellipsoid.packedLength+5,w.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 L=new t.Rectangle,D=t.Ellipsoid.clone(t.Ellipsoid.UNIT_SPHERE),x={rectangle:L,ellipsoid:D,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};w.unpack=function(i,a,r){a=e.defaultValue(a,0);var n=t.Rectangle.unpack(i,a,L);a+=t.Rectangle.packedLength;var o=t.Ellipsoid.unpack(i,a,D);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 w(x))};var H=new r.Cartographic;return w.createGeometry=function(t){var r,o,u=t._rectangle,h=t._ellipsoid,y=g.RectangleGeometryLibrary.computeOptions(u,t._granularity,t._rotation,0,P,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=C(e,t),u=t.height,s=t.width,c=p.PolygonPipeli