| 1 |
- define(["exports","./arrayFill-4513d7ad","./buildModuleUrl-57a32107","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./when-b60132fc","./EllipseGeometryLibrary-cf69fd46","./GeometryAttribute-c42d25b7","./GeometryAttributes-252e9929","./GeometryInstance-dbc9f4c4","./GeometryOffsetAttribute-fbeb6f1a","./GeometryPipeline-6d9322f0","./IndexDatatype-8a5eead4","./Math-119be1a3","./Matrix4-cde86d0e","./VertexFormat-6446fca0"],(function(e,t,r,a,i,n,o,s,l,u,m,c,p,y,d,f,A,h){"use strict";var x=new i.Cartesian3,g=new i.Cartesian3,_=new i.Cartesian3,b=new i.Cartesian3,v=new a.Cartesian2,C=new A.Matrix3,w=new A.Matrix3,M=new u.Quaternion,E=new i.Cartesian3,I=new i.Cartesian3,T=new i.Cartesian3,G=new i.Cartographic,N=new i.Cartesian3,F=new a.Cartesian2,P=new a.Cartesian2;function V(e,n,c){var y=n.vertexFormat,d=n.center,f=n.semiMajorAxis,h=n.semiMinorAxis,b=n.ellipsoid,V=n.stRotation,D=c?e.length/3*2:e.length/3,O=n.shadowVolume,S=y.st?new Float32Array(2*D):void 0,L=y.normal?new Float32Array(3*D):void 0,R=y.tangent?new Float32Array(3*D):void 0,j=y.bitangent?new Float32Array(3*D):void 0,k=O?new Float32Array(3*D):void 0,z=0,B=E,Y=I,H=T,U=new r.GeographicProjection(b),Q=U.project(b.cartesianToCartographic(d,G),N),W=b.scaleToGeodeticSurface(d,x);b.geodeticSurfaceNormal(W,W);var J=C,q=w;if(0!==V){var Z=u.Quaternion.fromAxisAngle(W,V,M);J=A.Matrix3.fromQuaternion(Z,J),Z=u.Quaternion.fromAxisAngle(W,-V,M),q=A.Matrix3.fromQuaternion(Z,q)}else J=A.Matrix3.clone(A.Matrix3.IDENTITY,J),q=A.Matrix3.clone(A.Matrix3.IDENTITY,q);for(var K=a.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,F),X=a.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,P),$=e.length,ee=c?$:0,te=ee/3*2,re=0;re<$;re+=3){var ae=re+1,ie=re+2,ne=i.Cartesian3.fromArray(e,re,x);if(y.st){var oe=A.Matrix3.multiplyByVector(J,ne,g),se=U.project(b.cartesianToCartographic(oe,G),_);i.Cartesian3.subtract(se,Q,se),v.x=(se.x+f)/(2*f),v.y=(se.y+h)/(2*h),K.x=Math.min(v.x,K.x),K.y=Math.min(v.y,K.y),X.x=Math.max(v.x,X.x),X.y=Math.max(v.y,X.y),c&&(S[z+te]=v.x,S[z+1+te]=v.y),S[z++]=v.x,S[z++]=v.y}(y.normal||y.tangent||y.bitangent||O)&&(B=b.geodeticSurfaceNormal(ne,B),O&&(k[re+ee]=-B.x,k[ae+ee]=-B.y,k[ie+ee]=-B.z),(y.normal||y.tangent||y.bitangent)&&((y.tangent||y.bitangent)&&(Y=i.Cartesian3.normalize(i.Cartesian3.cross(i.Cartesian3.UNIT_Z,B,Y),Y),A.Matrix3.multiplyByVector(q,Y,Y)),y.normal&&(L[re]=B.x,L[ae]=B.y,L[ie]=B.z,c&&(L[re+ee]=-B.x,L[ae+ee]=-B.y,L[ie+ee]=-B.z)),y.tangent&&(R[re]=Y.x,R[ae]=Y.y,R[ie]=Y.z,c&&(R[re+ee]=-Y.x,R[ae+ee]=-Y.y,R[ie+ee]=-Y.z)),y.bitangent&&(H=i.Cartesian3.normalize(i.Cartesian3.cross(B,Y,H),H),j[re]=H.x,j[ae]=H.y,j[ie]=H.z,c&&(j[re+ee]=H.x,j[ae+ee]=H.y,j[ie+ee]=H.z))))}if(y.st){$=S.length;for(var le=0;le<$;le+=2)S[le]=(S[le]-K.x)/(X.x-K.x),S[le+1]=(S[le+1]-K.y)/(X.y-K.y)}var ue=new m.GeometryAttributes;if(y.position){var me=l.EllipseGeometryLibrary.raisePositionsToHeight(e,n,c);ue.position=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:me})}if(y.st&&(ue.st=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:S})),y.normal&&(ue.normal=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),y.tangent&&(ue.tangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:R})),y.bitangent&&(ue.bitangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:j})),O&&(ue.extrudeDirection=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:k})),c&&s.defined(n.offsetAttribute)){var ce=new Uint8Array(D);if(n.offsetAttribute===p.GeometryOffsetAttribute.TOP)ce=t.arrayFill(ce,1,0,D/2);else{var pe=n.offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;ce=t.arrayFill(ce,pe)}ue.applyOffset=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:ce})}return ue}function D(e){var t,r,a,i,n,o=new Array(e*(e+1)*12-6),s=0;for(t=0,a=1,i=0;i<3;i++)o[s++]=a++,o[s++]=t,o[s++]=a;for(i=2;i<e+1;++i){for(a=i*(i+1)-1,t=(i-1)*i-1,o[s++]=a++,o[s++]=t,o[s++]=a,r=2*i,n=0;n<r-1;++n)o[s++]=a,o[s++]=t++,o[s++]=t,o[s++]=a++,o[s++]=t,o[s++]=a;o[s++]=a++,o[s++]=t,o[s++]=a}for(r=2*e,++a,++t,i=0;i<r-1;++i)o[s++]=a,o[s++]=t++,o[s++]=t,o[s++]=a++,o[s++]=t,o[s++]=a;for(o[s++]=a,o[s++]=t++,o[s++]=t,o[s++]=a++,o[s++]=t++,o[s++]=t,++t,i=e-1;i>1;--i){for(o[s++]=t++,o[s++]=t,o[s++]=a,r=2*i,n=0;n<r-1;++n)o[s++]=a,o[s++]=t++,o[s++]=t,o[s++]=a++,o[s++]=t,o[s++]=a;o[s++]=t++,o[s++]=t++,o[s++]=a++}for(i=0;i<3;i++)o[s++]=t++,o[s++]=t,o[s++]=a;return o}var O=new i.Cartesian3;var S=new r.BoundingSphere,L=new r.BoundingSphere;function R(e){var n=e.center,f=e.ellipsoid,h=e.semiMajorAxis,w=i.Cartesian3.multiplyByScalar(f.geodeticSurfaceNormal(n,x),e.height,x);S.center=i.Cartesian3.add(n,w,S.center),S.radius=h,w=i.Cartesian3.multiplyByScalar(f.geodeticSurfaceNormal(n,w),e.extrudedHeight,w),L.center=i.Cartesian3.add(n,w,L.center),L.radius=h;var O=l.EllipseGeometryLibrary.computeEllipsePositions(e,!0,!0),R=O.positions,j=O.numPts,k=O.outerPositions,z=r.BoundingSphere.union(S,L),B=V(R,e,!0),Y=D(j),H=Y.length;Y.length=2*H;for(var U=R.length/3,Q=0;Q<H;Q+=3)Y[Q+H]=Y[Q+2]+U,Y[Q+1+H]=Y[Q+1]+U,Y[Q+2+H]=Y[Q]+U;var W=d.IndexDatatype.createTypedArray(2*U/3,Y),J=new u.Geometry({attributes:B,indices:W,primitiveType:r.PrimitiveType.TRIANGLES}),q=function(e,n){var l=n.vertexFormat,c=n.center,y=n.semiMajorAxis,d=n.semiMinorAxis,f=n.ellipsoid,h=n.height,w=n.extrudedHeight,V=n.stRotation,D=e.length/3*2,O=new Float64Array(3*D),S=l.st?new Float32Array(2*D):void 0,L=l.normal?new Float32Array(3*D):void 0,R=l.tangent?new Float32Array(3*D):void 0,j=l.bitangent?new Float32Array(3*D):void 0,k=n.shadowVolume,z=k?new Float32Array(3*D):void 0,B=0,Y=E,H=I,U=T,Q=new r.GeographicProjection(f),W=Q.project(f.cartesianToCartographic(c,G),N),J=f.scaleToGeodeticSurface(c,x);f.geodeticSurfaceNormal(J,J);for(var q=u.Quaternion.fromAxisAngle(J,V,M),Z=A.Matrix3.fromQuaternion(q,C),K=a.Cartesian2.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,F),X=a.Cartesian2.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,P),$=e.length,ee=$/3*2,te=0;te<$;te+=3){var re,ae=te+1,ie=te+2,ne=i.Cartesian3.fromArray(e,te,x);if(l.st){var oe=A.Matrix3.multiplyByVector(Z,ne,g),se=Q.project(f.cartesianToCartographic(oe,G),_);i.Cartesian3.subtract(se,W,se),v.x=(se.x+y)/(2*y),v.y=(se.y+d)/(2*d),K.x=Math.min(v.x,K.x),K.y=Math.min(v.y,K.y),X.x=Math.max(v.x,X.x),X.y=Math.max(v.y,X.y),S[B+ee]=v.x,S[B+1+ee]=v.y,S[B++]=v.x,S[B++]=v.y}ne=f.scaleToGeodeticSurface(ne,ne),re=i.Cartesian3.clone(ne,g),Y=f.geodeticSurfaceNormal(ne,Y),k&&(z[te+$]=-Y.x,z[ae+$]=-Y.y,z[ie+$]=-Y.z);var le=i.Cartesian3.multiplyByScalar(Y,h,b);if(ne=i.Cartesian3.add(ne,le,ne),le=i.Cartesian3.multiplyByScalar(Y,w,le),re=i.Cartesian3.add(re,le,re),l.position&&(O[te+$]=re.x,O[ae+$]=re.y,O[ie+$]=re.z,O[te]=ne.x,O[ae]=ne.y,O[ie]=ne.z),l.normal||l.tangent||l.bitangent){U=i.Cartesian3.clone(Y,U);var ue=i.Cartesian3.fromArray(e,(te+3)%$,b);i.Cartesian3.subtract(ue,ne,ue);var me=i.Cartesian3.subtract(re,ne,_);Y=i.Cartesian3.normalize(i.Cartesian3.cross(me,ue,Y),Y),l.normal&&(L[te]=Y.x,L[ae]=Y.y,L[ie]=Y.z,L[te+$]=Y.x,L[ae+$]=Y.y,L[ie+$]=Y.z),l.tangent&&(H=i.Cartesian3.normalize(i.Cartesian3.cross(U,Y,H),H),R[te]=H.x,R[ae]=H.y,R[ie]=H.z,R[te+$]=H.x,R[te+1+$]=H.y,R[te+2+$]=H.z),l.bitangent&&(j[te]=U.x,j[ae]=U.y,j[ie]=U.z,j[te+$]=U.x,j[ae+$]=U.y,j[ie+$]=U.z)}}if(l.st){$=S.length;for(var ce=0;ce<$;ce+=2)S[ce]=(S[ce]-K.x)/(X.x-K.x),S[ce+1]=(S[ce+1]-K.y)/(X.y-K.y)}var pe=new m.GeometryAttributes;if(l.position&&(pe.position=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:O})),l.st&&(pe.st=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:S})),l.normal&&(pe.normal=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:L})),l.tangent&&(pe.tangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:R})),l.bitangent&&(pe.bitangent=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:j})),k&&(pe.extrudeDirection=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:z})),s.defined(n.offsetAttribute)){var ye=new Uint8Array(D);if(n.offsetAttribute===p.GeometryOffsetAttribute.TOP)ye=t.arrayFill(ye,1,0,D/2);else{var de=n.offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;ye=t.arrayFill(ye,de)}pe.applyOffset=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:ye})}return pe}(k,e);Y=function(e){for(var t=e.length/3,r=d.IndexDatatype.createTypedArray(t,6*t),a=0,i=0;i<t;i++){var n=i,o=i+t,s=(n+1)%t,l=s+t;r[a++]=n,r[a++]=o,r[a++]=s,r[a++]=s,r[a++]=o,r[a++]=l}return r}(k);var Z=d.IndexDatatype.createTypedArray(2*k.length/3,Y),K=new u.Geometry({attributes:q,indices:Z,primitiveType:r.PrimitiveType.TRIANGLES}),X=y.GeometryPipeline.combineInstances([new c.GeometryInstance({geometry:J}),new c.GeometryInstance({geometry:K})]);return{boundingSphere:z,attributes:X[0].attributes,indices:X[0].indices}}function j(e,t,r,n,o,s,u){for(var m=l.EllipseGeometryLibrary.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:r,rotation:n,granularity:o},!1,!0).outerPositions,c=m.length/3,p=new Array(c),y=0;y<c;++y)p[y]=i.Cartesian3.fromArray(m,3*y);var d=a.Rectangle.fromCartesianArray(p,s,u);return d.width>f.CesiumMath.PI&&(d.north=d.north>0?f.CesiumMath.PI_OVER_TWO-f.CesiumMath.EPSILON7:d.north,d.south=d.south<0?f.CesiumMath.EPSILON7-f.CesiumMath.PI_OVER_TWO:d.south,d.east=f.CesiumMath.PI,d.west=-f.CesiumMath.PI),d}function k(e){var t=(e=s.defaultValue(e,s.defaultValue.EMPTY_OBJECT)).center,r=s.defaultValue(e.ellipsoid,a.Ellipsoid.WGS84),n=e.semiMajorAxis,o=e.semiMinorAxis,l=s.defaultValue(e.granularity,f.CesiumMath.RADIANS_PER_DEGREE),u=s.defaultValue(e.vertexFormat,h.VertexFormat.DEFAULT),m=s.defaultValue(e.height,0),c=s.defaultValue(e.extrudedHeight,m);this._center=i.Cartesian3.clone(t),this._semiMajorAxis=n,this._semiMinorAxis=o,this._ellipsoid=a.Ellipsoid.clone(r),this._rotation=s.defaultValue(e.rotation,0),this._stRotation=s.defaultValue(e.stRotation,0),this._height=Math.max(c,m),this._granularity=l,this._vertexFormat=h.VertexFormat.clone(u),this._extrudedHeight=Math.min(c,m),this._shadowVolume=s.defaultValue(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}k.packedLength=i.Cartesian3.packedLength+a.Ellipsoid.packedLength+h.VertexFormat.packedLength+9,k.pack=function(e,t,r){return r=s.defaultValue(r,0),i.Cartesian3.pack(e._center,t,r),r+=i.Cartesian3.packedLength,a.Ellipsoid.pack(e._ellipsoid,t,r),r+=a.Ellipsoid.packedLength,h.VertexFormat.pack(e._vertexFormat,t,r),r+=h.VertexFormat.packedLength,t[r++]=e._semiMajorAxis,t[r++]=e._semiMinorAxis,t[r++]=e._rotation,t[r++]=e._stRotation,t[r++]=e._height,t[r++]=e._granularity,t[r++]=e._extrudedHeight,t[r++]=e._shadowVolume?1:0,t[r]=s.defaultValue(e._offsetAttribute,-1),t};var z=new i.Cartesian3,B=new a.Ellipsoid,Y=new h.VertexFormat,H={center:z,ellipsoid:B,vertexFormat:Y,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};k.unpack=function(e,t,r){t=s.defaultValue(t,0);var n=i.Cartesian3.unpack(e,t,z);t+=i.Cartesian3.packedLength;var o=a.Ellipsoid.unpack(e,t,B);t+=a.Ellipsoid.packedLength;var l=h.VertexFormat.unpack(e,t,Y);t+=h.VertexFormat.packedLength;var u=e[t++],m=e[t++],c=e[t++],p=e[t++],y=e[t++],d=e[t++],f=e[t++],A=1===e[t++],x=e[t];return s.defined(r)?(r._center=i.Cartesian3.clone(n,r._center),r._ellipsoid=a.Ellipsoid.clone(o,r._ellipsoid),r._vertexFormat=h.VertexFormat.clone(l,r._vertexFormat),r._semiMajorAxis=u,r._semiMinorAxis=m,r._rotation=c,r._stRotation=p,r._height=y,r._granularity=d,r._extrudedHeight=f,r._shadowVolume=A,r._offsetAttribute=-1===x?void 0:x,r):(H.height=y,H.extrudedHeight=f,H.granularity=d,H.stRotation=p,H.rotation=c,H.semiMajorAxis=u,H.semiMinorAxis=m,H.shadowVolume=A,H.offsetAttribute=-1===x?void 0:x,new k(H))},k.computeRectangle=function(e,t){var r=(e=s.defaultValue(e,s.defaultValue.EMPTY_OBJECT)).center,i=s.defaultValue(e.ellipsoid,a.Ellipsoid.WGS84),n=e.semiMajorAxis,o=e.semiMinorAxis,l=s.defaultValue(e.granularity,f.CesiumMath.RADIANS_PER_DEGREE);return j(r,n,o,s.defaultValue(e.rotation,0),l,i,t)},k.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var a=e._height,n=e._extrudedHeight,m=!f.CesiumMath.equalsEpsilon(a,n,0,f.CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var c,y={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:a,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};if(m)y.extrudedHeight=n,y.shadowVolume=e._shadowVolume,y.offsetAttribute=e._offsetAttribute,c=R(y);else if(c=function(e){var t=e.center;O=i.Cartesian3.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,O),e.height,O),O=i.Cartesian3.add(t,O,O);var a=new r.BoundingSphere(O,e.semiMajorAxis),n=l.EllipseGeometryLibrary.computeEllipsePositions(e,!0,!1),o=n.positions,s=n.numPts,u=V(o,e,!1),m=D(s);return{boundingSphere:a,attributes:u,indices:m=d.IndexDatatype.createTypedArray(o.length/3,m)}}(y),s.defined(e._offsetAttribute)){var A=c.attributes.position.values.length,h=new Uint8Array(A/3),x=e._offsetAttribute===p.GeometryOffsetAttribute.NONE?0:1;t.arrayFill(h,x),c.attributes.applyOffset=new u.GeometryAttribute({componentDatatype:o.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return new u.Geometry({attributes:c.attributes,indices:c.indices,primitiveType:r.PrimitiveType.TRIANGLES,boundingSphere:c.boundingSphere,offsetAttribute:e._offsetAttribute})}},k.createShadowVolume=function(e,t,r){var a=e._granularity,i=e._ellipsoid,n=t(a,i),o=r(a,i);return new k({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:i,rotation:e._rotation,stRotation:e._stRotation,granularity:a,extrudedHeight:n,height:o,vertexFormat:h.VertexFormat.POSITION_ONLY,shadowVolume:!0})},Object.defineProperties(k.prototype,{rectangle:{get:function(){return s.defined(this._rectangle)||(this._rectangle=j(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return s.defined(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=function(e){var t=-e._stRotation;if(0===t)return[0,0,0,1,1,0];for(var r=l.EllipseGeometryLibrary.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,a=r.length/3,n=new Array(a),o=0;o<a;++o)n[o]=i.Cartesian3.fromArray(r,3*o);var s=e._ellipsoid,m=e.rectangle;return u.Geometry._textureCoordinateRotationPoints(n,t,s,m)}(this)),this._textureCoordinateRotationPoints}}}),e.EllipseGeometry=k}));
|