chunk-4OFJNL3O.js 14 KB

1
  1. import{a as ae}from"./chunk-CQDUGEQJ.js";import{a as te,b as re}from"./chunk-APJGGXML.js";import{a as _e}from"./chunk-PWT2ZHRH.js";import{a as Ee}from"./chunk-AOW426VA.js";import{a as L}from"./chunk-W2I2FV32.js";import{a as he}from"./chunk-XKBSMKNP.js";import{a as pe}from"./chunk-J4ID4JKR.js";import{a as xe,d as ue,g as le,h as ve,n as fe,o as N}from"./chunk-K2IDXOCV.js";import{a as P}from"./chunk-45OWWDV7.js";import{a as E}from"./chunk-JX5O4HI2.js";import{a as J}from"./chunk-FEOWMVRK.js";import{a as V,b as Te}from"./chunk-CUQT2UK5.js";import{a as s,c as Me}from"./chunk-I46SWINN.js";import{a as I}from"./chunk-LNIYJJXS.js";import{a as y}from"./chunk-4D2ERGZX.js";import{a as Y}from"./chunk-EDZQSM3T.js";import{a as ce}from"./chunk-PJGSCWXZ.js";import{a as $}from"./chunk-NUC3LT2W.js";var ne=new s,ye=new s,be=new s,Ne=new s,p=new J,Fe=new P,Ye=new P,we=new ve,Se=new s,Oe=new s,Ce=new s,ge=new Me,Pe=new s,Ie=new J,Re=new J;function je(r,t,e){var a=t.vertexFormat,o=t.center,n=t.semiMajorAxis,i=t.semiMinorAxis,m=t.ellipsoid,d=t.stRotation,b=e?r.length/3*2:r.length/3,g=t.shadowVolume,c=a.st?new Float32Array(b*2):void 0,u=a.normal?new Float32Array(b*3):void 0,A=a.tangent?new Float32Array(b*3):void 0,l=a.bitangent?new Float32Array(b*3):void 0,O=g?new Float32Array(b*3):void 0,z=0,x=Se,_=Oe,f=Ce,F=new xe(m),R=F.project(m.cartesianToCartographic(o,ge),Pe),Z=m.scaleToGeodeticSurface(o,ne);m.geodeticSurfaceNormal(Z,Z);var K=Fe,W=Ye;if(d!==0){var ie=ve.fromAxisAngle(Z,d,we);K=P.fromQuaternion(ie,K),ie=ve.fromAxisAngle(Z,-d,we),W=P.fromQuaternion(ie,W)}else K=P.clone(P.IDENTITY,K),W=P.clone(P.IDENTITY,W);for(var B=J.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Ie),S=J.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Re),j=r.length,v=e?j:0,oe=v/3*2,h=0;h<j;h+=3){var M=h+1,T=h+2,w=s.fromArray(r,h,ne);if(a.st){var H=P.multiplyByVector(K,w,ye),ee=F.project(m.cartesianToCartographic(H,ge),be);s.subtract(ee,R,ee),p.x=(ee.x+n)/(2*n),p.y=(ee.y+i)/(2*i),B.x=Math.min(p.x,B.x),B.y=Math.min(p.y,B.y),S.x=Math.max(p.x,S.x),S.y=Math.max(p.y,S.y),e&&(c[z+oe]=p.x,c[z+1+oe]=p.y),c[z++]=p.x,c[z++]=p.y}(a.normal||a.tangent||a.bitangent||g)&&(x=m.geodeticSurfaceNormal(w,x),g&&(O[h+v]=-x.x,O[M+v]=-x.y,O[T+v]=-x.z),(a.normal||a.tangent||a.bitangent)&&((a.tangent||a.bitangent)&&(_=s.normalize(s.cross(s.UNIT_Z,x,_),_),P.multiplyByVector(W,_,_)),a.normal&&(u[h]=x.x,u[M]=x.y,u[T]=x.z,e&&(u[h+v]=-x.x,u[M+v]=-x.y,u[T+v]=-x.z)),a.tangent&&(A[h]=_.x,A[M]=_.y,A[T]=_.z,e&&(A[h+v]=-_.x,A[M+v]=-_.y,A[T+v]=-_.z)),a.bitangent&&(f=s.normalize(s.cross(x,_,f),f),l[h]=f.x,l[M]=f.y,l[T]=f.z,e&&(l[h+v]=f.x,l[M+v]=f.y,l[T+v]=f.z))))}if(a.st){j=c.length;for(var D=0;D<j;D+=2)c[D]=(c[D]-B.x)/(S.x-B.x),c[D+1]=(c[D+1]-B.y)/(S.y-B.y)}var C=new pe;if(a.position){var se=ae.raisePositionsToHeight(r,t,e);C.position=new N({componentDatatype:E.DOUBLE,componentsPerAttribute:3,values:se})}if(a.st&&(C.st=new N({componentDatatype:E.FLOAT,componentsPerAttribute:2,values:c})),a.normal&&(C.normal=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:u})),a.tangent&&(C.tangent=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:A})),a.bitangent&&(C.bitangent=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:l})),g&&(C.extrudeDirection=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:O})),e&&$(t.offsetAttribute)){var X=new Uint8Array(b);if(t.offsetAttribute===re.TOP)X=te(X,1,0,b/2);else{var q=t.offsetAttribute===re.NONE?0:1;X=te(X,q)}C.applyOffset=new N({componentDatatype:E.UNSIGNED_BYTE,componentsPerAttribute:1,values:X})}return C}function De(r){var t=new Array(12*(r*(r+1))-6),e=0,a,o,n,i,m;for(a=0,n=1,i=0;i<3;i++)t[e++]=n++,t[e++]=a,t[e++]=n;for(i=2;i<r+1;++i){for(n=i*(i+1)-1,a=(i-1)*i-1,t[e++]=n++,t[e++]=a,t[e++]=n,o=2*i,m=0;m<o-1;++m)t[e++]=n,t[e++]=a++,t[e++]=a,t[e++]=n++,t[e++]=a,t[e++]=n;t[e++]=n++,t[e++]=a,t[e++]=n}for(o=r*2,++n,++a,i=0;i<o-1;++i)t[e++]=n,t[e++]=a++,t[e++]=a,t[e++]=n++,t[e++]=a,t[e++]=n;for(t[e++]=n,t[e++]=a++,t[e++]=a,t[e++]=n++,t[e++]=a++,t[e++]=a,++a,i=r-1;i>1;--i){for(t[e++]=a++,t[e++]=a,t[e++]=n,o=2*i,m=0;m<o-1;++m)t[e++]=n,t[e++]=a++,t[e++]=a,t[e++]=n++,t[e++]=a,t[e++]=n;t[e++]=a++,t[e++]=a++,t[e++]=n++}for(i=0;i<3;i++)t[e++]=a++,t[e++]=a,t[e++]=n;return t}var G=new s;function ke(r){var t=r.center;G=s.multiplyByScalar(r.ellipsoid.geodeticSurfaceNormal(t,G),r.height,G),G=s.add(t,G,G);var e=new ue(G,r.semiMajorAxis),a=ae.computeEllipsePositions(r,!0,!1),o=a.positions,n=a.numPts,i=je(o,r,!1),m=De(n);return m=he.createTypedArray(o.length/3,m),{boundingSphere:e,attributes:i,indices:m}}function Ue(r,t){var e=t.vertexFormat,a=t.center,o=t.semiMajorAxis,n=t.semiMinorAxis,i=t.ellipsoid,m=t.height,d=t.extrudedHeight,b=t.stRotation,g=r.length/3*2,c=new Float64Array(g*3),u=e.st?new Float32Array(g*2):void 0,A=e.normal?new Float32Array(g*3):void 0,l=e.tangent?new Float32Array(g*3):void 0,O=e.bitangent?new Float32Array(g*3):void 0,z=t.shadowVolume,x=z?new Float32Array(g*3):void 0,_=0,f=Se,F=Oe,R=Ce,Z=new xe(i),K=Z.project(i.cartesianToCartographic(a,ge),Pe),W=i.scaleToGeodeticSurface(a,ne);i.geodeticSurfaceNormal(W,W);for(var ie=ve.fromAxisAngle(W,b,we),B=P.fromQuaternion(ie,Fe),S=J.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Ie),j=J.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Re),v=r.length,oe=v/3*2,h=0;h<v;h+=3){var M=h+1,T=h+2,w=s.fromArray(r,h,ne),H;if(e.st){var ee=P.multiplyByVector(B,w,ye),D=Z.project(i.cartesianToCartographic(ee,ge),be);s.subtract(D,K,D),p.x=(D.x+o)/(2*o),p.y=(D.y+n)/(2*n),S.x=Math.min(p.x,S.x),S.y=Math.min(p.y,S.y),j.x=Math.max(p.x,j.x),j.y=Math.max(p.y,j.y),u[_+oe]=p.x,u[_+1+oe]=p.y,u[_++]=p.x,u[_++]=p.y}w=i.scaleToGeodeticSurface(w,w),H=s.clone(w,ye),f=i.geodeticSurfaceNormal(w,f),z&&(x[h+v]=-f.x,x[M+v]=-f.y,x[T+v]=-f.z);var C=s.multiplyByScalar(f,m,Ne);if(w=s.add(w,C,w),C=s.multiplyByScalar(f,d,C),H=s.add(H,C,H),e.position&&(c[h+v]=H.x,c[M+v]=H.y,c[T+v]=H.z,c[h]=w.x,c[M]=w.y,c[T]=w.z),e.normal||e.tangent||e.bitangent){R=s.clone(f,R);var se=s.fromArray(r,(h+3)%v,Ne);s.subtract(se,w,se);var X=s.subtract(H,w,be);f=s.normalize(s.cross(X,se,f),f),e.normal&&(A[h]=f.x,A[M]=f.y,A[T]=f.z,A[h+v]=f.x,A[M+v]=f.y,A[T+v]=f.z),e.tangent&&(F=s.normalize(s.cross(R,f,F),F),l[h]=F.x,l[M]=F.y,l[T]=F.z,l[h+v]=F.x,l[h+1+v]=F.y,l[h+2+v]=F.z),e.bitangent&&(O[h]=R.x,O[M]=R.y,O[T]=R.z,O[h+v]=R.x,O[M+v]=R.y,O[T+v]=R.z)}}if(e.st){v=u.length;for(var q=0;q<v;q+=2)u[q]=(u[q]-S.x)/(j.x-S.x),u[q+1]=(u[q+1]-S.y)/(j.y-S.y)}var Q=new pe;if(e.position&&(Q.position=new N({componentDatatype:E.DOUBLE,componentsPerAttribute:3,values:c})),e.st&&(Q.st=new N({componentDatatype:E.FLOAT,componentsPerAttribute:2,values:u})),e.normal&&(Q.normal=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:A})),e.tangent&&(Q.tangent=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:l})),e.bitangent&&(Q.bitangent=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:O})),z&&(Q.extrudeDirection=new N({componentDatatype:E.FLOAT,componentsPerAttribute:3,values:x})),$(t.offsetAttribute)){var me=new Uint8Array(g);if(t.offsetAttribute===re.TOP)me=te(me,1,0,g/2);else{var He=t.offsetAttribute===re.NONE?0:1;me=te(me,He)}Q.applyOffset=new N({componentDatatype:E.UNSIGNED_BYTE,componentsPerAttribute:1,values:me})}return Q}function We(r){for(var t=r.length/3,e=he.createTypedArray(t,t*6),a=0,o=0;o<t;o++){var n=o,i=o+t,m=(n+1)%t,d=m+t;e[a++]=n,e[a++]=i,e[a++]=m,e[a++]=m,e[a++]=i,e[a++]=d}return e}var de=new ue,Ae=new ue;function qe(r){var t=r.center,e=r.ellipsoid,a=r.semiMajorAxis,o=s.multiplyByScalar(e.geodeticSurfaceNormal(t,ne),r.height,ne);de.center=s.add(t,o,de.center),de.radius=a,o=s.multiplyByScalar(e.geodeticSurfaceNormal(t,o),r.extrudedHeight,o),Ae.center=s.add(t,o,Ae.center),Ae.radius=a;var n=ae.computeEllipsePositions(r,!0,!0),i=n.positions,m=n.numPts,d=n.outerPositions,b=ue.union(de,Ae),g=je(i,r,!0),c=De(m),u=c.length;c.length=u*2;for(var A=i.length/3,l=0;l<u;l+=3)c[l+u]=c[l+2]+A,c[l+1+u]=c[l+1]+A,c[l+2+u]=c[l]+A;var O=he.createTypedArray(A*2/3,c),z=new fe({attributes:g,indices:O,primitiveType:le.TRIANGLES}),x=Ue(d,r);c=We(d);var _=he.createTypedArray(d.length*2/3,c),f=new fe({attributes:x,indices:_,primitiveType:le.TRIANGLES}),F=Ee.combineInstances([new _e({geometry:z}),new _e({geometry:f})]);return{boundingSphere:b,attributes:F[0].attributes,indices:F[0].indices}}function Ve(r,t,e,a,o,n,i){for(var m=ae.computeEllipsePositions({center:r,semiMajorAxis:t,semiMinorAxis:e,rotation:a,granularity:o},!1,!0),d=m.outerPositions,b=d.length/3,g=new Array(b),c=0;c<b;++c)g[c]=s.fromArray(d,c*3);var u=Te.fromCartesianArray(g,n,i);return u.width>I.PI&&(u.north=u.north>0?I.PI_OVER_TWO-I.EPSILON7:u.north,u.south=u.south<0?I.EPSILON7-I.PI_OVER_TWO:u.south,u.east=I.PI,u.west=-I.PI),u}function U(r){r=y(r,y.EMPTY_OBJECT);var t=r.center,e=y(r.ellipsoid,V.WGS84),a=r.semiMajorAxis,o=r.semiMinorAxis,n=y(r.granularity,I.RADIANS_PER_DEGREE),i=y(r.vertexFormat,L.DEFAULT);if(Y.defined("options.center",t),Y.typeOf.number("options.semiMajorAxis",a),Y.typeOf.number("options.semiMinorAxis",o),a<o)throw new ce("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(n<=0)throw new ce("granularity must be greater than zero.");var m=y(r.height,0),d=y(r.extrudedHeight,m);this._center=s.clone(t),this._semiMajorAxis=a,this._semiMinorAxis=o,this._ellipsoid=V.clone(e),this._rotation=y(r.rotation,0),this._stRotation=y(r.stRotation,0),this._height=Math.max(d,m),this._granularity=n,this._vertexFormat=L.clone(i),this._extrudedHeight=Math.min(d,m),this._shadowVolume=y(r.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=r.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}U.packedLength=s.packedLength+V.packedLength+L.packedLength+9;U.pack=function(r,t,e){return Y.defined("value",r),Y.defined("array",t),e=y(e,0),s.pack(r._center,t,e),e+=s.packedLength,V.pack(r._ellipsoid,t,e),e+=V.packedLength,L.pack(r._vertexFormat,t,e),e+=L.packedLength,t[e++]=r._semiMajorAxis,t[e++]=r._semiMinorAxis,t[e++]=r._rotation,t[e++]=r._stRotation,t[e++]=r._height,t[e++]=r._granularity,t[e++]=r._extrudedHeight,t[e++]=r._shadowVolume?1:0,t[e]=y(r._offsetAttribute,-1),t};var Le=new s,ze=new V,Be=new L,k={center:Le,ellipsoid:ze,vertexFormat:Be,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};U.unpack=function(r,t,e){Y.defined("array",r),t=y(t,0);var a=s.unpack(r,t,Le);t+=s.packedLength;var o=V.unpack(r,t,ze);t+=V.packedLength;var n=L.unpack(r,t,Be);t+=L.packedLength;var i=r[t++],m=r[t++],d=r[t++],b=r[t++],g=r[t++],c=r[t++],u=r[t++],A=r[t++]===1,l=r[t];return $(e)?(e._center=s.clone(a,e._center),e._ellipsoid=V.clone(o,e._ellipsoid),e._vertexFormat=L.clone(n,e._vertexFormat),e._semiMajorAxis=i,e._semiMinorAxis=m,e._rotation=d,e._stRotation=b,e._height=g,e._granularity=c,e._extrudedHeight=u,e._shadowVolume=A,e._offsetAttribute=l===-1?void 0:l,e):(k.height=g,k.extrudedHeight=u,k.granularity=c,k.stRotation=b,k.rotation=d,k.semiMajorAxis=i,k.semiMinorAxis=m,k.shadowVolume=A,k.offsetAttribute=l===-1?void 0:l,new U(k))};U.computeRectangle=function(r,t){r=y(r,y.EMPTY_OBJECT);var e=r.center,a=y(r.ellipsoid,V.WGS84),o=r.semiMajorAxis,n=r.semiMinorAxis,i=y(r.granularity,I.RADIANS_PER_DEGREE),m=y(r.rotation,0);if(Y.defined("options.center",e),Y.typeOf.number("options.semiMajorAxis",o),Y.typeOf.number("options.semiMinorAxis",n),o<n)throw new ce("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(i<=0)throw new ce("granularity must be greater than zero.");return Ve(e,o,n,m,i,a,t)};U.createGeometry=function(r){if(!(r._semiMajorAxis<=0||r._semiMinorAxis<=0)){var t=r._height,e=r._extrudedHeight,a=!I.equalsEpsilon(t,e,0,I.EPSILON2);r._center=r._ellipsoid.scaleToGeodeticSurface(r._center,r._center);var o={center:r._center,semiMajorAxis:r._semiMajorAxis,semiMinorAxis:r._semiMinorAxis,ellipsoid:r._ellipsoid,rotation:r._rotation,height:t,granularity:r._granularity,vertexFormat:r._vertexFormat,stRotation:r._stRotation},n;if(a)o.extrudedHeight=e,o.shadowVolume=r._shadowVolume,o.offsetAttribute=r._offsetAttribute,n=qe(o);else if(n=ke(o),$(r._offsetAttribute)){var i=n.attributes.position.values.length,m=new Uint8Array(i/3),d=r._offsetAttribute===re.NONE?0:1;te(m,d),n.attributes.applyOffset=new N({componentDatatype:E.UNSIGNED_BYTE,componentsPerAttribute:1,values:m})}return new fe({attributes:n.attributes,indices:n.indices,primitiveType:le.TRIANGLES,boundingSphere:n.boundingSphere,offsetAttribute:r._offsetAttribute})}};U.createShadowVolume=function(r,t,e){var a=r._granularity,o=r._ellipsoid,n=t(a,o),i=e(a,o);return new U({center:r._center,semiMajorAxis:r._semiMajorAxis,semiMinorAxis:r._semiMinorAxis,ellipsoid:o,rotation:r._rotation,stRotation:r._stRotation,granularity:a,extrudedHeight:n,height:i,vertexFormat:L.POSITION_ONLY,shadowVolume:!0})};function Qe(r){var t=-r._stRotation;if(t===0)return[0,0,0,1,1,0];for(var e=ae.computeEllipsePositions({center:r._center,semiMajorAxis:r._semiMajorAxis,semiMinorAxis:r._semiMinorAxis,rotation:r._rotation,granularity:r._granularity},!1,!0),a=e.outerPositions,o=a.length/3,n=new Array(o),i=0;i<o;++i)n[i]=s.fromArray(a,i*3);var m=r._ellipsoid,d=r.rectangle;return fe._textureCoordinateRotationPoints(n,t,m,d)}Object.defineProperties(U.prototype,{rectangle:{get:function(){return $(this._rectangle)||(this._rectangle=Ve(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return $(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=Qe(this)),this._textureCoordinateRotationPoints}}});var _t=U;export{_t as a};