Agriculture-front-end/public/Cesium/Workers/EllipsoidOutlineGeometry-7e6fabdb.js
2023-04-16 22:33:44 +08:00

2 lines
4.8 KiB
JavaScript

define(["exports","./arrayFill-4513d7ad","./buildModuleUrl-4e1b81e7","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./when-b60132fc","./Check-7b2a090c","./Cartesian2-47311507","./GeometryAttribute-3a88ba31","./GeometryAttributes-252e9929","./GeometryOffsetAttribute-fbeb6f1a","./IndexDatatype-8a5eead4","./Math-119be1a3","./PrimitiveType-a54dc62f"],(function(i,t,e,a,r,n,o,s,m,u,f,d,l,c){"use strict";var C=new a.Cartesian3(1,1,1),_=Math.cos,h=Math.sin;function p(i){i=n.defaultValue(i,n.defaultValue.EMPTY_OBJECT);var t=n.defaultValue(i.radii,C),e=n.defaultValue(i.innerRadii,t),r=n.defaultValue(i.minimumClock,0),o=n.defaultValue(i.maximumClock,l.CesiumMath.TWO_PI),s=n.defaultValue(i.minimumCone,0),m=n.defaultValue(i.maximumCone,l.CesiumMath.PI),u=Math.round(n.defaultValue(i.stackPartitions,10)),f=Math.round(n.defaultValue(i.slicePartitions,8)),d=Math.round(n.defaultValue(i.subdivisions,128));this._radii=a.Cartesian3.clone(t),this._innerRadii=a.Cartesian3.clone(e),this._minimumClock=r,this._maximumClock=o,this._minimumCone=s,this._maximumCone=m,this._stackPartitions=u,this._slicePartitions=f,this._subdivisions=d,this._offsetAttribute=i.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}p.packedLength=2*a.Cartesian3.packedLength+8,p.pack=function(i,t,e){return e=n.defaultValue(e,0),a.Cartesian3.pack(i._radii,t,e),e+=a.Cartesian3.packedLength,a.Cartesian3.pack(i._innerRadii,t,e),e+=a.Cartesian3.packedLength,t[e++]=i._minimumClock,t[e++]=i._maximumClock,t[e++]=i._minimumCone,t[e++]=i._maximumCone,t[e++]=i._stackPartitions,t[e++]=i._slicePartitions,t[e++]=i._subdivisions,t[e]=n.defaultValue(i._offsetAttribute,-1),t};var y=new a.Cartesian3,v=new a.Cartesian3,b={radii:y,innerRadii:v,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};p.unpack=function(i,t,e){t=n.defaultValue(t,0);var r=a.Cartesian3.unpack(i,t,y);t+=a.Cartesian3.packedLength;var o=a.Cartesian3.unpack(i,t,v);t+=a.Cartesian3.packedLength;var s=i[t++],m=i[t++],u=i[t++],f=i[t++],d=i[t++],l=i[t++],c=i[t++],C=i[t];return n.defined(e)?(e._radii=a.Cartesian3.clone(r,e._radii),e._innerRadii=a.Cartesian3.clone(o,e._innerRadii),e._minimumClock=s,e._maximumClock=m,e._minimumCone=u,e._maximumCone=f,e._stackPartitions=d,e._slicePartitions=l,e._subdivisions=c,e._offsetAttribute=-1===C?void 0:C,e):(b.minimumClock=s,b.maximumClock=m,b.minimumCone=u,b.maximumCone=f,b.stackPartitions=d,b.slicePartitions=l,b.subdivisions=c,b.offsetAttribute=-1===C?void 0:C,new p(b))},p.createGeometry=function(i){var a=i._radii;if(!(a.x<=0||a.y<=0||a.z<=0)){var o=i._innerRadii;if(!(o.x<=0||o.y<=0||o.z<=0)){var C=i._minimumClock,p=i._maximumClock,y=i._minimumCone,v=i._maximumCone,b=i._subdivisions,k=s.Ellipsoid.fromCartesian3(a),A=i._slicePartitions+1,x=i._stackPartitions+1;(A=Math.round(A*Math.abs(p-C)/l.CesiumMath.TWO_PI))<2&&(A=2),(x=Math.round(x*Math.abs(v-y)/l.CesiumMath.PI))<2&&(x=2);var P=0,M=1,w=o.x!==a.x||o.y!==a.y||o.z!==a.z,g=!1,V=!1;w&&(M=2,y>0&&(g=!0,P+=A),v<Math.PI&&(V=!0,P+=A));var G,E,O,D,I=b*M*(x+A),T=new Float64Array(3*I),z=2*(I+P-(A+x)*M),L=d.IndexDatatype.createTypedArray(I,z),R=0,N=new Array(x),B=new Array(x);for(G=0;G<x;G++)D=y+G*(v-y)/(x-1),N[G]=h(D),B[G]=_(D);var S=new Array(b),U=new Array(b);for(G=0;G<b;G++)O=C+G*(p-C)/(b-1),S[G]=h(O),U[G]=_(O);for(G=0;G<x;G++)for(E=0;E<b;E++)T[R++]=a.x*N[G]*U[E],T[R++]=a.y*N[G]*S[E],T[R++]=a.z*B[G];if(w)for(G=0;G<x;G++)for(E=0;E<b;E++)T[R++]=o.x*N[G]*U[E],T[R++]=o.y*N[G]*S[E],T[R++]=o.z*B[G];for(N.length=b,B.length=b,G=0;G<b;G++)D=y+G*(v-y)/(b-1),N[G]=h(D),B[G]=_(D);for(S.length=A,U.length=A,G=0;G<A;G++)O=C+G*(p-C)/(A-1),S[G]=h(O),U[G]=_(O);for(G=0;G<b;G++)for(E=0;E<A;E++)T[R++]=a.x*N[G]*U[E],T[R++]=a.y*N[G]*S[E],T[R++]=a.z*B[G];if(w)for(G=0;G<b;G++)for(E=0;E<A;E++)T[R++]=o.x*N[G]*U[E],T[R++]=o.y*N[G]*S[E],T[R++]=o.z*B[G];for(R=0,G=0;G<x*M;G++){var F=G*b;for(E=0;E<b-1;E++)L[R++]=F+E,L[R++]=F+E+1}var W=x*b*M;for(G=0;G<A;G++)for(E=0;E<b-1;E++)L[R++]=W+G+E*A,L[R++]=W+G+(E+1)*A;if(w)for(W=x*b*M+A*b,G=0;G<A;G++)for(E=0;E<b-1;E++)L[R++]=W+G+E*A,L[R++]=W+G+(E+1)*A;if(w){var Y=x*b*M,J=Y+b*A;if(g)for(G=0;G<A;G++)L[R++]=Y+G,L[R++]=J+G;if(V)for(Y+=b*A-A,J+=b*A-A,G=0;G<A;G++)L[R++]=Y+G,L[R++]=J+G}var j=new u.GeometryAttributes({position:new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:T})});if(n.defined(i._offsetAttribute)){var q=T.length,H=new Uint8Array(q/3),K=i._offsetAttribute===f.GeometryOffsetAttribute.NONE?0:1;t.arrayFill(H,K),j.applyOffset=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:H})}return new m.Geometry({attributes:j,indices:L,primitiveType:c.PrimitiveType.LINES,boundingSphere:e.BoundingSphere.fromEllipsoid(k),offsetAttribute:i._offsetAttribute})}}},i.EllipsoidOutlineGeometry=p}));