Agriculture-front-end/public/Cesium/Workers/EllipseOutlineGeometry-66d9a9ca.js
2023-04-16 22:33:44 +08:00

2 lines
5.5 KiB
JavaScript

define(["exports","./arrayFill-4513d7ad","./BoundingSphere-561b54d0","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./when-b60132fc","./Check-7b2a090c","./EllipseGeometryLibrary-134c564a","./Cartesian2-47311507","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-39acab88"],(function(e,t,i,r,a,n,o,s,l,u,d,p,c,f,m){"use strict";var h=new r.Cartesian3,y=new r.Cartesian3;var b=new i.BoundingSphere,A=new i.BoundingSphere;function _(e){var t=(e=n.defaultValue(e,n.defaultValue.EMPTY_OBJECT)).center,i=n.defaultValue(e.ellipsoid,l.Ellipsoid.WGS84),a=e.semiMajorAxis,o=e.semiMinorAxis,s=n.defaultValue(e.granularity,f.CesiumMath.RADIANS_PER_DEGREE),u=n.defaultValue(e.height,0),d=n.defaultValue(e.extrudedHeight,u);this._center=r.Cartesian3.clone(t),this._semiMajorAxis=a,this._semiMinorAxis=o,this._ellipsoid=l.Ellipsoid.clone(i),this._rotation=n.defaultValue(e.rotation,0),this._height=Math.max(d,u),this._granularity=s,this._extrudedHeight=Math.min(d,u),this._numberOfVerticalLines=Math.max(n.defaultValue(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}_.packedLength=r.Cartesian3.packedLength+l.Ellipsoid.packedLength+8,_.pack=function(e,t,i){return i=n.defaultValue(i,0),r.Cartesian3.pack(e._center,t,i),i+=r.Cartesian3.packedLength,l.Ellipsoid.pack(e._ellipsoid,t,i),i+=l.Ellipsoid.packedLength,t[i++]=e._semiMajorAxis,t[i++]=e._semiMinorAxis,t[i++]=e._rotation,t[i++]=e._height,t[i++]=e._granularity,t[i++]=e._extrudedHeight,t[i++]=e._numberOfVerticalLines,t[i]=n.defaultValue(e._offsetAttribute,-1),t};var g=new r.Cartesian3,v=new l.Ellipsoid,x={center:g,ellipsoid:v,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};_.unpack=function(e,t,i){t=n.defaultValue(t,0);var a=r.Cartesian3.unpack(e,t,g);t+=r.Cartesian3.packedLength;var o=l.Ellipsoid.unpack(e,t,v);t+=l.Ellipsoid.packedLength;var s=e[t++],u=e[t++],d=e[t++],p=e[t++],c=e[t++],f=e[t++],m=e[t++],h=e[t];return n.defined(i)?(i._center=r.Cartesian3.clone(a,i._center),i._ellipsoid=l.Ellipsoid.clone(o,i._ellipsoid),i._semiMajorAxis=s,i._semiMinorAxis=u,i._rotation=d,i._height=p,i._granularity=c,i._extrudedHeight=f,i._numberOfVerticalLines=m,i._offsetAttribute=-1===h?void 0:h,i):(x.height=p,x.extrudedHeight=f,x.granularity=c,x.rotation=d,x.semiMajorAxis=s,x.semiMinorAxis=u,x.numberOfVerticalLines=m,x.offsetAttribute=-1===h?void 0:h,new _(x))},_.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var o=e._height,l=e._extrudedHeight,_=!f.CesiumMath.equalsEpsilon(o,l,0,f.CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var g,v={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:o,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};if(_)v.extrudedHeight=l,v.offsetAttribute=e._offsetAttribute,g=function(e){var o=e.center,l=e.ellipsoid,m=e.semiMajorAxis,y=r.Cartesian3.multiplyByScalar(l.geodeticSurfaceNormal(o,h),e.height,h);b.center=r.Cartesian3.add(o,y,b.center),b.radius=m,y=r.Cartesian3.multiplyByScalar(l.geodeticSurfaceNormal(o,y),e.extrudedHeight,y),A.center=r.Cartesian3.add(o,y,A.center),A.radius=m;var _=s.EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions,g=new d.GeometryAttributes({position:new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:s.EllipseGeometryLibrary.raisePositionsToHeight(_,e,!0)})});_=g.position.values;var v=i.BoundingSphere.union(b,A),x=_.length/3;if(n.defined(e.offsetAttribute)){var E=new Uint8Array(x);if(e.offsetAttribute===p.GeometryOffsetAttribute.TOP)E=t.arrayFill(E,1,0,x/2);else{var M=e.offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;E=t.arrayFill(E,M)}g.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:E})}var C=n.defaultValue(e.numberOfVerticalLines,16);C=f.CesiumMath.clamp(C,0,x/2);var G=c.IndexDatatype.createTypedArray(x,2*x+2*C);x/=2;var L,O,S=0;for(L=0;L<x;++L)G[S++]=L,G[S++]=(L+1)%x,G[S++]=L+x,G[S++]=(L+1)%x+x;if(C>0){var V=Math.min(C,x);O=Math.round(x/V);var w=Math.min(O*C,x);for(L=0;L<w;L+=O)G[S++]=L,G[S++]=L+x}return{boundingSphere:v,attributes:g,indices:G}}(v);else if(g=function(e){var t=e.center;y=r.Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,y),e.height,y),y=r.Cartesian3.add(t,y,y);for(var n=new i.BoundingSphere(y,e.semiMajorAxis),o=s.EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions,l=new d.GeometryAttributes({position:new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:s.EllipseGeometryLibrary.raisePositionsToHeight(o,e,!1)})}),p=o.length/3,f=c.IndexDatatype.createTypedArray(p,2*p),m=0,h=0;h<p;++h)f[m++]=h,f[m++]=(h+1)%p;return{boundingSphere:n,attributes:l,indices:f}}(v),n.defined(e._offsetAttribute)){var x=g.attributes.position.values.length,E=new Uint8Array(x/3),M=e._offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;t.arrayFill(E,M),g.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:a.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:E})}return new u.Geometry({attributes:g.attributes,indices:g.indices,primitiveType:m.PrimitiveType.LINES,boundingSphere:g.boundingSphere,offsetAttribute:e._offsetAttribute})}},e.EllipseOutlineGeometry=_}));