qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/EllipsoidGeometry-204918b6.js

2 lines
7.0 KiB
JavaScript

define(["exports","./GeometryOffsetAttribute-ed56ff58","./BoundingSphere-9a3b5656","./Cartesian2-bd414876","./Cartesian3-e0307675","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./IndexDatatype-3f3c99e8","./Math-e73894ab","./VertexFormat-d50a69ba"],(function(t,e,a,n,i,r,o,s,m,u,c,l,f){"use strict";const d=new i.Cartesian3,C=new i.Cartesian3,p=new i.Cartesian3,y=new i.Cartesian3,_=new i.Cartesian3,h=new i.Cartesian3(1,1,1),A=Math.cos,x=Math.sin;function b(t){t=o.defaultValue(t,o.defaultValue.EMPTY_OBJECT);const e=o.defaultValue(t.radii,h),a=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),m=o.defaultValue(t.maximumCone,l.CesiumMath.PI),u=Math.round(o.defaultValue(t.stackPartitions,64)),c=Math.round(o.defaultValue(t.slicePartitions,64)),d=o.defaultValue(t.vertexFormat,f.VertexFormat.DEFAULT);this._radii=i.Cartesian3.clone(e),this._innerRadii=i.Cartesian3.clone(a),this._minimumClock=n,this._maximumClock=r,this._minimumCone=s,this._maximumCone=m,this._stackPartitions=u,this._slicePartitions=c,this._vertexFormat=f.VertexFormat.clone(d),this._offsetAttribute=t.offsetAttribute,this._workerName="createEllipsoidGeometry"}b.packedLength=2*i.Cartesian3.packedLength+f.VertexFormat.packedLength+7,b.pack=function(t,e,a){return a=o.defaultValue(a,0),i.Cartesian3.pack(t._radii,e,a),a+=i.Cartesian3.packedLength,i.Cartesian3.pack(t._innerRadii,e,a),a+=i.Cartesian3.packedLength,f.VertexFormat.pack(t._vertexFormat,e,a),a+=f.VertexFormat.packedLength,e[a++]=t._minimumClock,e[a++]=t._maximumClock,e[a++]=t._minimumCone,e[a++]=t._maximumCone,e[a++]=t._stackPartitions,e[a++]=t._slicePartitions,e[a]=o.defaultValue(t._offsetAttribute,-1),e};const k=new i.Cartesian3,w=new i.Cartesian3,F=new f.VertexFormat,g={radii:k,innerRadii:w,vertexFormat:F,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};let P;b.unpack=function(t,e,a){e=o.defaultValue(e,0);const n=i.Cartesian3.unpack(t,e,k);e+=i.Cartesian3.packedLength;const r=i.Cartesian3.unpack(t,e,w);e+=i.Cartesian3.packedLength;const s=f.VertexFormat.unpack(t,e,F);e+=f.VertexFormat.packedLength;const m=t[e++],u=t[e++],c=t[e++],l=t[e++],d=t[e++],C=t[e++],p=t[e];return o.defined(a)?(a._radii=i.Cartesian3.clone(n,a._radii),a._innerRadii=i.Cartesian3.clone(r,a._innerRadii),a._vertexFormat=f.VertexFormat.clone(s,a._vertexFormat),a._minimumClock=m,a._maximumClock=u,a._minimumCone=c,a._maximumCone=l,a._stackPartitions=d,a._slicePartitions=C,a._offsetAttribute=-1===p?void 0:p,a):(g.minimumClock=m,g.maximumClock=u,g.minimumCone=c,g.maximumCone=l,g.stackPartitions=d,g.slicePartitions=C,g.offsetAttribute=-1===p?void 0:p,new b(g))},b.createGeometry=function(t){const s=t._radii;if(s.x<=0||s.y<=0||s.z<=0)return;const f=t._innerRadii;if(f.x<=0||f.y<=0||f.z<=0)return;const h=t._minimumClock,b=t._maximumClock,k=t._minimumCone,w=t._maximumCone,F=t._vertexFormat;let g,P,v=t._slicePartitions+1,V=t._stackPartitions+1;v=Math.round(v*Math.abs(b-h)/l.CesiumMath.TWO_PI),V=Math.round(V*Math.abs(w-k)/l.CesiumMath.PI),v<2&&(v=2),V<2&&(V=2);let M=0;const T=[k],D=[h];for(g=0;g<V;g++)T.push(k+g*(w-k)/(V-1));for(T.push(w),P=0;P<v;P++)D.push(h+P*(b-h)/(v-1));D.push(b);const G=T.length,L=D.length;let O=0,I=1;const E=f.x!==s.x||f.y!==s.y||f.z!==s.z;let z=!1,N=!1,R=!1;E&&(I=2,k>0&&(z=!0,O+=v-1),w<Math.PI&&(N=!0,O+=v-1),(b-h)%l.CesiumMath.TWO_PI?(R=!0,O+=2*(V-1)+1):O+=1);const S=L*G*I,U=new Float64Array(3*S),B=e.arrayFill(new Array(S),!1),W=e.arrayFill(new Array(S),!1),Y=v*V*I,J=6*(Y+O+1-(v+V)*I),X=c.IndexDatatype.createTypedArray(Y,J),Z=F.normal?new Float32Array(3*S):void 0,j=F.tangent?new Float32Array(3*S):void 0,q=F.bitangent?new Float32Array(3*S):void 0,H=F.st?new Float32Array(2*S):void 0,K=new Array(G),Q=new Array(G);for(g=0;g<G;g++)K[g]=x(T[g]),Q[g]=A(T[g]);const $=new Array(L),tt=new Array(L);for(P=0;P<L;P++)tt[P]=A(D[P]),$[P]=x(D[P]);for(g=0;g<G;g++)for(P=0;P<L;P++)U[M++]=s.x*K[g]*tt[P],U[M++]=s.y*K[g]*$[P],U[M++]=s.z*Q[g];let et,at,nt,it,rt=S/2;if(E)for(g=0;g<G;g++)for(P=0;P<L;P++)U[M++]=f.x*K[g]*tt[P],U[M++]=f.y*K[g]*$[P],U[M++]=f.z*Q[g],B[rt]=!0,g>0&&g!==G-1&&0!==P&&P!==L-1&&(W[rt]=!0),rt++;for(M=0,g=1;g<G-2;g++)for(et=g*L,at=(g+1)*L,P=1;P<L-2;P++)X[M++]=at+P,X[M++]=at+P+1,X[M++]=et+P+1,X[M++]=at+P,X[M++]=et+P+1,X[M++]=et+P;if(E){const t=G*L;for(g=1;g<G-2;g++)for(et=t+g*L,at=t+(g+1)*L,P=1;P<L-2;P++)X[M++]=at+P,X[M++]=et+P,X[M++]=et+P+1,X[M++]=at+P,X[M++]=et+P+1,X[M++]=at+P+1}if(E){if(z)for(it=G*L,g=1;g<L-2;g++)X[M++]=g,X[M++]=g+1,X[M++]=it+g+1,X[M++]=g,X[M++]=it+g+1,X[M++]=it+g;if(N)for(nt=G*L-L,it=G*L*I-L,g=1;g<L-2;g++)X[M++]=nt+g+1,X[M++]=nt+g,X[M++]=it+g,X[M++]=nt+g+1,X[M++]=it+g,X[M++]=it+g+1}if(R){for(g=1;g<G-2;g++)it=L*G+L*g,nt=L*g,X[M++]=it,X[M++]=nt+L,X[M++]=nt,X[M++]=it,X[M++]=it+L,X[M++]=nt+L;for(g=1;g<G-2;g++)it=L*G+L*(g+1)-1,nt=L*(g+1)-1,X[M++]=nt+L,X[M++]=it,X[M++]=nt,X[M++]=nt+L,X[M++]=it+L,X[M++]=it}const ot=new u.GeometryAttributes;F.position&&(ot.position=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:U}));let st=0,mt=0,ut=0,ct=0;const lt=S/2;let ft;const dt=n.Ellipsoid.fromCartesian3(s),Ct=n.Ellipsoid.fromCartesian3(f);if(F.st||F.normal||F.tangent||F.bitangent){for(g=0;g<S;g++){ft=B[g]?Ct:dt;const t=i.Cartesian3.fromArray(U,3*g,d),e=ft.geodeticSurfaceNormal(t,C);if(W[g]&&i.Cartesian3.negate(e,e),F.st){const t=n.Cartesian2.negate(e,_);H[st++]=Math.atan2(t.y,t.x)/l.CesiumMath.TWO_PI+.5,H[st++]=Math.asin(e.z)/Math.PI+.5}if(F.normal&&(Z[mt++]=e.x,Z[mt++]=e.y,Z[mt++]=e.z),F.tangent||F.bitangent){const t=p;let a,n=0;if(B[g]&&(n=lt),a=!z&&g>=n&&g<n+2*L?i.Cartesian3.UNIT_X:i.Cartesian3.UNIT_Z,i.Cartesian3.cross(a,e,t),i.Cartesian3.normalize(t,t),F.tangent&&(j[ut++]=t.x,j[ut++]=t.y,j[ut++]=t.z),F.bitangent){const a=i.Cartesian3.cross(e,t,y);i.Cartesian3.normalize(a,a),q[ct++]=a.x,q[ct++]=a.y,q[ct++]=a.z}}}F.st&&(ot.st=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:H})),F.normal&&(ot.normal=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:Z})),F.tangent&&(ot.tangent=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:j})),F.bitangent&&(ot.bitangent=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:q}))}if(o.defined(t._offsetAttribute)){const a=U.length,n=new Uint8Array(a/3),i=t._offsetAttribute===e.GeometryOffsetAttribute.NONE?0:1;e.arrayFill(n,i),ot.applyOffset=new m.GeometryAttribute({componentDatatype:r.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:n})}return new m.Geometry({attributes:ot,indices:X,primitiveType:m.PrimitiveType.TRIANGLES,boundingSphere:a.BoundingSphere.fromEllipsoid(dt),offsetAttribute:t._offsetAttribute})},b.getUnitEllipsoid=function(){return o.defined(P)||(P=b.createGeometry(new b({radii:new i.Cartesian3(1,1,1),vertexFormat:f.VertexFormat.POSITION_ONLY}))),P},t.EllipsoidGeometry=b}));