qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/EllipsoidOutlineGeometry-b6...

2 lines
4.8 KiB
JavaScript
Raw Permalink Normal View History

2023-11-07 10:04:37 +08:00
define(["exports","./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./Cartesian2-bd414876","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab"],(function(t,e,i,a,n,o,r,s,u,m,f,l){"use strict";const c=new a.Cartesian3(1,1,1),d=Math.cos,C=Math.sin;function _(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT);const e=o.defaultValue(t.radii,c),i=o.defaultValue(t.innerRadii,e),n=o.defaultValue(t.minimumClock,0),r=o.defaultValue(t.maximumClock,l.CesiumMath.TWO_PI),s=o.defaultValue(t.minimumCone,0),u=o.defaultValue(t.maximumCone,l.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(e),this._innerRadii=a.Cartesian3.clone(i),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,e,i){return i=o.defaultValue(i,0),a.Cartesian3.pack(t._radii,e,i),i+=a.Cartesian3.packedLength,a.Cartesian3.pack(t._innerRadii,e,i),i+=a.Cartesian3.packedLength,e[i++]=t._minimumClock,e[i++]=t._maximumClock,e[i++]=t._minimumCone,e[i++]=t._maximumCone,e[i++]=t._stackPartitions,e[i++]=t._slicePartitions,e[i++]=t._subdivisions,e[i]=o.defaultValue(t._offsetAttribute,-1),e};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,e,i){e=o.defaultValue(e,0);const n=a.Cartesian3.unpack(t,e,h);e+=a.Cartesian3.packedLength;const r=a.Cartesian3.unpack(t,e,p);e+=a.Cartesian3.packedLength;const s=t[e++],u=t[e++],m=t[e++],f=t[e++],l=t[e++],c=t[e++],d=t[e++],C=t[e];return o.defined(i)?(i._radii=a.Cartesian3.clone(n,i._radii),i._innerRadii=a.Cartesian3.clone(r,i._innerRadii),i._minimumClock=s,i._maximumClock=u,i._minimumCone=m,i._maximumCone=f,i._stackPartitions=l,i._slicePartitions=c,i._subdivisions=d,i._offsetAttribute=-1===C?void 0:C,i):(y.minimumClock=s,y.maximumClock=u,y.minimumCone=m,y.maximumCone=f,y.stackPartitions=l,y.slicePartitions=c,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 c=t._minimumClock,_=t._maximumClock,h=t._minimumCone,p=t._maximumCone,y=t._subdivisions,b=s.Ellipsoid.fromCartesian3(a);let k=t._slicePartitions+1,A=t._stackPartitions+1;k=Math.round(k*Math.abs(_-c)/l.CesiumMath.TWO_PI),A=Math.round(A*Math.abs(p-h)/l.CesiumMath.PI),k<2&&(k=2),A<2&&(A=2);let x=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,x+=k),p<Math.PI&&(w=!0,x+=k));const V=y*P*(A+k),g=new Float64Array(3*V),G=2*(V+x-(k+A)*P),E=f.IndexDatatype.createTypedArray(V,G);let O,D,I,z,L=0;const T=new Array(A),R=new Array(A);for(O=0;O<A;O++)z=h+O*(p-h)/(A-1),T[O]=C(z),R[O]=d(z);const N=new Array(y),B=new Array(y);for(O=0;O<y;O++)I=c+O*(_-c)/(y-1),N[O]=C(I),B[O]=d(I);for(O=0;O<A;O++)for(D=0;D<y;D++)g[L++]=a.x*T[O]*B[D],g[L++]=a.y*T[O]*N[D],g[L++]=a.z*R[O];if(v)for(O=0;O<A;O++)for(D=0;D<y;D++)g[L++]=r.x*T[O]*B[D],g[L++]=r.y*T[O]*N[D],g[L++]=r.z*R[O];for(T.length=y,R.length=y,O=0;O<y;O++)z=h+O*(p-h)/(y-1),T[O]=C(z),R[O]=d(z);for(N.length=k,B.length=k,O=0;O<k;O++)I=c+O*(_-c)/(k-1),N[O]=C(I),B[O]=d(I);for(O=0;O<y;O++)for(D=0;D<k;D++)g[L++]=a.x*T[O]*B[D],g[L++]=a.y*T[O]*N[D],g[L++]=a.z*R[O];if(v)for(O=0;O<y;O++)for(D=0;D<k;D++)g[L++]=r.x*T[O]*B[D],g[L++]=r.y*T[O]*N[D],g[L++]=r.z*R[O];for(L=0,O=0;O<A*P;O++){const t=O*y;for(D=0;D<y-1;D++)E[L++]=t+D,E[L++]=t+D+1}let S=A*y*P;for(O=0;O<k;O++)for(D=0;D<y-1;D++)E[L++]=S+O+D*k,E[L++]=S+O+(D+1)*k;if(v)for(S=A*y*P+k*y,O=0;O