1 |
- define(["exports","./GeometryOffsetAttribute-1772960d","./Transforms-d5c6ad6e","./Matrix2-ccd5b911","./ComponentDatatype-93750d1a","./when-4bbc8319","./RuntimeError-346a3079","./GeometryAttribute-c30799b8","./GeometryAttributes-7827a6c2","./IndexDatatype-b7d979a6"],function(i,D,I,T,z,L,t,R,N,B){"use strict";var f=new T.Cartesian3(1,1,1),S=Math.cos,U=Math.sin;function l(i){i=L.defaultValue(i,L.defaultValue.EMPTY_OBJECT);var t=L.defaultValue(i.radii,f),e=L.defaultValue(i.innerRadii,t),a=L.defaultValue(i.minimumClock,0),n=L.defaultValue(i.maximumClock,z.CesiumMath.TWO_PI),r=L.defaultValue(i.minimumCone,0),o=L.defaultValue(i.maximumCone,z.CesiumMath.PI),s=Math.round(L.defaultValue(i.stackPartitions,10)),m=Math.round(L.defaultValue(i.slicePartitions,8)),u=Math.round(L.defaultValue(i.subdivisions,128));this._radii=T.Cartesian3.clone(t),this._innerRadii=T.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"}l.packedLength=2*T.Cartesian3.packedLength+8,l.pack=function(i,t,e){return e=L.defaultValue(e,0),T.Cartesian3.pack(i._radii,t,e),e+=T.Cartesian3.packedLength,T.Cartesian3.pack(i._innerRadii,t,e),e+=T.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]=L.defaultValue(i._offsetAttribute,-1),t};var c=new T.Cartesian3,C=new T.Cartesian3,_={radii:c,innerRadii:C,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};l.unpack=function(i,t,e){t=L.defaultValue(t,0);var a=T.Cartesian3.unpack(i,t,c);t+=T.Cartesian3.packedLength;var n=T.Cartesian3.unpack(i,t,C);t+=T.Cartesian3.packedLength;var r=i[t++],o=i[t++],s=i[t++],m=i[t++],u=i[t++],f=i[t++],d=i[t++],t=i[t];return L.defined(e)?(e._radii=T.Cartesian3.clone(a,e._radii),e._innerRadii=T.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===t?void 0:t,e):(_.minimumClock=r,_.maximumClock=o,_.minimumCone=s,_.maximumCone=m,_.stackPartitions=u,_.slicePartitions=f,_.subdivisions=d,_.offsetAttribute=-1===t?void 0:t,new l(_))},l.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=T.Ellipsoid.fromCartesian3(t),u=i._slicePartitions+1,f=i._stackPartitions+1;(u=Math.round(u*Math.abs(n-a)/z.CesiumMath.TWO_PI))<2&&(u=2),(f=Math.round(f*Math.abs(o-r)/z.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 p,h,y=s*l*(f+u),v=new Float64Array(3*y),b=B.IndexDatatype.createTypedArray(y,2*(y+d-(u+f)*l)),k=0,x=new Array(f),A=new Array(f),P=0;P<f;P++)x[P]=U(h=r+P*(o-r)/(f-1)),A[P]=S(h);var w=new Array(s),M=new Array(s);for(P=0;P<s;P++)w[P]=U(p=a+P*(n-a)/(s-1)),M[P]=S(p);for(P=0;P<f;P++)for(g=0;g<s;g++)v[k++]=t.x*x[P]*M[g],v[k++]=t.y*x[P]*w[g],v[k++]=t.z*A[P];if(c)for(P=0;P<f;P++)for(g=0;g<s;g++)v[k++]=e.x*x[P]*M[g],v[k++]=e.y*x[P]*w[g],v[k++]=e.z*A[P];for(x.length=s,A.length=s,P=0;P<s;P++)x[P]=U(h=r+P*(o-r)/(s-1)),A[P]=S(h);for(w.length=u,M.length=u,P=0;P<u;P++)w[P]=U(p=a+P*(n-a)/(u-1)),M[P]=S(p);for(P=0;P<s;P++)for(g=0;g<u;g++)v[k++]=t.x*x[P]*M[g],v[k++]=t.y*x[P]*w[g],v[k++]=t.z*A[P];if(c)for(P=0;P<s;P++)for(g=0;g<u;g++)v[k++]=e.x*x[P]*M[g],v[k++]=e.y*x[P]*w[g],v[k++]=e.z*A[P];for(P=k=0;P<f*l;P++)for(var V=P*s,g=0;g<s-1;g++)b[k++]=V+g,b[k++]=V+g+1;var E=f*s*l;for(P=0;P<u;P++)for(g=0;g<s-1;g++)b[k++]=E+P+g*u,b[k++]=E+P+(g+1)*u;if(c)for(E=f*s*l+u*s,P=0;P<u;P++)for(g=0;g<s-1;g++)b[k++]=E+P+g*u,b[k++]=E+P+(g+1)*u;if(c){var G=f*s*l,O=G+s*u;if(C)for(P=0;P<u;P++)b[k++]=G+P,b[k++]=O+P;if(_)for(G+=s*u-u,O+=s*u-u,P=0;P<u;P++)b[k++]=G+P,b[k++]=O+P}c=new N.GeometryAttributes({position:new R.GeometryAttribute({componentDatatype:z.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:v})});return L.defined(i._offsetAttribute)&&(C=v.length,_=new Uint8Array(C/3),C=i._offsetAttribute===D.GeometryOffsetAttribute.NONE?0:1,D.arrayFill(_,C),c.applyOffset=new R.GeometryAttribute({componentDatatype:z.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:_})),new R.Geometry({attributes:c,indices:b,primitiveType:R.PrimitiveType.LINES,boundingSphere:I.BoundingSphere.fromEllipsoid(m),offsetAttribute:i._offsetAttribute})}}},i.EllipsoidOutlineGeometry=l});
|