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