1 |
- define(["exports","./GeometryOffsetAttribute-ed56ff58","./Transforms-98ffa11d","./Cartesian3-7e9cc2ff","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./Matrix2-e3fb4559","./GeometryAttribute-b025f9a8","./GeometryAttributes-32b29525","./IndexDatatype-f1e3f799","./Math-5f585871"],(function(t,i,e,a,n,o,r,s,u,m,f,c){"use strict";const l=new a.Cartesian3(1,1,1),d=Math.cos,C=Math.sin;function _(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT);const i=o.defaultValue(t.radii,l),e=o.defaultValue(t.innerRadii,i),n=o.defaultValue(t.minimumClock,0),r=o.defaultValue(t.maximumClock,c.CesiumMath.TWO_PI),s=o.defaultValue(t.minimumCone,0),u=o.defaultValue(t.maximumCone,c.CesiumMath.PI),m=Math.round(o.defaultValue(t.stackPartitions,10)),f=Math.round(o.defaultValue(t.slicePartitions,8)),d=Math.round(o.defaultValue(t.subdivisions,128));this._radii=a.Cartesian3.clone(i),this._innerRadii=a.Cartesian3.clone(e),this._minimumClock=n,this._maximumClock=r,this._minimumCone=s,this._maximumCone=u,this._stackPartitions=m,this._slicePartitions=f,this._subdivisions=d,this._offsetAttribute=t.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}_.packedLength=2*a.Cartesian3.packedLength+8,_.pack=function(t,i,e){return e=o.defaultValue(e,0),a.Cartesian3.pack(t._radii,i,e),e+=a.Cartesian3.packedLength,a.Cartesian3.pack(t._innerRadii,i,e),e+=a.Cartesian3.packedLength,i[e++]=t._minimumClock,i[e++]=t._maximumClock,i[e++]=t._minimumCone,i[e++]=t._maximumCone,i[e++]=t._stackPartitions,i[e++]=t._slicePartitions,i[e++]=t._subdivisions,i[e]=o.defaultValue(t._offsetAttribute,-1),i};const h=new a.Cartesian3,p=new a.Cartesian3,y={radii:h,innerRadii:p,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};_.unpack=function(t,i,e){i=o.defaultValue(i,0);const n=a.Cartesian3.unpack(t,i,h);i+=a.Cartesian3.packedLength;const r=a.Cartesian3.unpack(t,i,p);i+=a.Cartesian3.packedLength;const s=t[i++],u=t[i++],m=t[i++],f=t[i++],c=t[i++],l=t[i++],d=t[i++],C=t[i];return o.defined(e)?(e._radii=a.Cartesian3.clone(n,e._radii),e._innerRadii=a.Cartesian3.clone(r,e._innerRadii),e._minimumClock=s,e._maximumClock=u,e._minimumCone=m,e._maximumCone=f,e._stackPartitions=c,e._slicePartitions=l,e._subdivisions=d,e._offsetAttribute=-1===C?void 0:C,e):(y.minimumClock=s,y.maximumClock=u,y.minimumCone=m,y.maximumCone=f,y.stackPartitions=c,y.slicePartitions=l,y.subdivisions=d,y.offsetAttribute=-1===C?void 0:C,new _(y))},_.createGeometry=function(t){const a=t._radii;if(a.x<=0||a.y<=0||a.z<=0)return;const r=t._innerRadii;if(r.x<=0||r.y<=0||r.z<=0)return;const l=t._minimumClock,_=t._maximumClock,h=t._minimumCone,p=t._maximumCone,y=t._subdivisions,k=s.Ellipsoid.fromCartesian3(a);let b=t._slicePartitions+1,x=t._stackPartitions+1;b=Math.round(b*Math.abs(_-l)/c.CesiumMath.TWO_PI),x=Math.round(x*Math.abs(p-h)/c.CesiumMath.PI),b<2&&(b=2),x<2&&(x=2);let A=0,P=1;const v=r.x!==a.x||r.y!==a.y||r.z!==a.z;let M=!1,w=!1;v&&(P=2,h>0&&(M=!0,A+=b),p<Math.PI&&(w=!0,A+=b));const V=y*P*(x+b),g=new Float64Array(3*V),G=2*(V+A-(b+x)*P),E=f.IndexDatatype.createTypedArray(V,G);let O,D,I,T,z=0;const L=new Array(x),R=new Array(x);for(O=0;O<x;O++)T=h+O*(p-h)/(x-1),L[O]=C(T),R[O]=d(T);const N=new Array(y),B=new Array(y);for(O=0;O<y;O++)I=l+O*(_-l)/(y-1),N[O]=C(I),B[O]=d(I);for(O=0;O<x;O++)for(D=0;D<y;D++)g[z++]=a.x*L[O]*B[D],g[z++]=a.y*L[O]*N[D],g[z++]=a.z*R[O];if(v)for(O=0;O<x;O++)for(D=0;D<y;D++)g[z++]=r.x*L[O]*B[D],g[z++]=r.y*L[O]*N[D],g[z++]=r.z*R[O];for(L.length=y,R.length=y,O=0;O<y;O++)T=h+O*(p-h)/(y-1),L[O]=C(T),R[O]=d(T);for(N.length=b,B.length=b,O=0;O<b;O++)I=l+O*(_-l)/(b-1),N[O]=C(I),B[O]=d(I);for(O=0;O<y;O++)for(D=0;D<b;D++)g[z++]=a.x*L[O]*B[D],g[z++]=a.y*L[O]*N[D],g[z++]=a.z*R[O];if(v)for(O=0;O<y;O++)for(D=0;D<b;D++)g[z++]=r.x*L[O]*B[D],g[z++]=r.y*L[O]*N[D],g[z++]=r.z*R[O];for(z=0,O=0;O<x*P;O++){const t=O*y;for(D=0;D<y-1;D++)E[z++]=t+D,E[z++]=t+D+1}let S=x*y*P;for(O=0;O<b;O++)for(D=0;D<y-1;D++)E[z++]=S+O+D*b,E[z++]=S+O+(D+1)*b;if(v)for(S=x*y*P+b*y,O=0;O<b;O++)for(D=0;D<y-1;D++)E[z++]=S+O+D*b,E[z++]=S+O+(D+1)*b;if(v){let t=x*y*P,i=t+y*b;if(M)for(O=0;O<b;O++)E[z++]=t+O,E[z++]=i+O;if(w)for(t+=y*b-b,i+=y*b-b,O=0;O<b;O++)E[z++]=t+O,E[z++]=i+O}const U=new m.GeometryAttributes({position:new u.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:g})});if(o.defined(t._offsetAttribute)){const e=g.length,a=new Uint8Array(e/3),o=t._offsetAttribute===i.GeometryOffsetAttribute.NONE?0:1;i.arrayFill(a,o),U.applyOffset=new u.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:a})}return new u.Geometry({attributes:U,indices:E,primitiveType:u.PrimitiveType.LINES,boundingSphere:e.BoundingSphere.fromEllipsoid(k),offsetAttribute:t._offsetAttribute})},t.EllipsoidOutlineGeometry=_}));
|