| 1 |
- import{a as x}from"./chunk-CQDUGEQJ.js";import{a as N,b as j}from"./chunk-APJGGXML.js";import{a as V}from"./chunk-XKBSMKNP.js";import{a as T}from"./chunk-J4ID4JKR.js";import{d as S,g as H,n as B,o as w}from"./chunk-K2IDXOCV.js";import{a as M}from"./chunk-JX5O4HI2.js";import{a as A}from"./chunk-CUQT2UK5.js";import{a as u}from"./chunk-I46SWINN.js";import{a as L}from"./chunk-LNIYJJXS.js";import{a as h}from"./chunk-4D2ERGZX.js";import{a as b}from"./chunk-PJGSCWXZ.js";import{a as m}from"./chunk-NUC3LT2W.js";var W=new u,g=new u;function F(e){var i=e.center;g=u.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(i,g),e.height,g),g=u.add(i,g,g);var t=new S(g,e.semiMajorAxis),a=x.computeEllipsePositions(e,!1,!0).outerPositions;a.push(a[0],a[1],a[2]);var o=new T({position:new w({componentDatatype:M.DOUBLE,componentsPerAttribute:3,values:x.raisePositionsToHeight(a,e,!1)})});o.sideness=new w({componentDatatype:M.FLOAT,componentsPerAttribute:2,values:new Float32Array([0,0,0,1,1,1,1,0])}),o.sideness.isInstanceAttribute=!0;for(var n=a.length/3,s=V.createTypedArray(n,n*2),c=0,r=0;r<n;++r)s[c++]=r,s[c++]=(r+1)%n;return{boundingSphere:t,attributes:o,indices:s}}var P=new S,k=new S;function Y(e){var i=e.center,t=e.ellipsoid,a=e.semiMajorAxis,o=u.multiplyByScalar(t.geodeticSurfaceNormal(i,W),e.height,W);P.center=u.add(i,o,P.center),P.radius=a,o=u.multiplyByScalar(t.geodeticSurfaceNormal(i,o),e.extrudedHeight,o),k.center=u.add(i,o,k.center),k.radius=a;var n=x.computeEllipsePositions(e,!1,!0).outerPositions,s=new T({position:new w({componentDatatype:M.DOUBLE,componentsPerAttribute:3,values:x.raisePositionsToHeight(n,e,!0)})});n=s.position.values;var c=S.union(P,k),r=n.length/3;if(m(e.offsetAttribute)){var p=new Uint8Array(r);if(e.offsetAttribute===j.TOP)p=N(p,1,0,r/2);else{var O=e.offsetAttribute===j.NONE?0:1;p=N(p,O)}s.applyOffset=new w({componentDatatype:M.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}var _=h(e.numberOfVerticalLines,16);_=L.clamp(_,0,r/2);var d=V.createTypedArray(r,r*2+_*2);r/=2;var v=0,f;for(f=0;f<r;++f)d[v++]=f,d[v++]=(f+1)%r,d[v++]=f+r,d[v++]=(f+1)%r+r;var D;if(_>0){var U=Math.min(_,r);D=Math.round(r/U);var R=Math.min(D*_,r);for(f=0;f<R;f+=D)d[v++]=f,d[v++]=f+r}return{boundingSphere:c,attributes:s,indices:d}}function E(e){e=h(e,h.EMPTY_OBJECT);var i=e.center,t=h(e.ellipsoid,A.WGS84),a=e.semiMajorAxis,o=e.semiMinorAxis,n=h(e.granularity,L.RADIANS_PER_DEGREE);if(!m(i))throw new b("center is required.");if(!m(a))throw new b("semiMajorAxis is required.");if(!m(o))throw new b("semiMinorAxis is required.");if(a<o)throw new b("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(n<=0)throw new b("granularity must be greater than zero.");var s=h(e.height,0),c=h(e.extrudedHeight,s);this._center=u.clone(i),this._semiMajorAxis=a,this._semiMinorAxis=o,this._ellipsoid=A.clone(t),this._rotation=h(e.rotation,0),this._height=Math.max(c,s),this._granularity=n,this._extrudedHeight=Math.min(c,s),this._numberOfVerticalLines=Math.max(h(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._outlineWidth=h(e.outlineWidth,1),this._workerName="createEllipseOutlineGeometry"}E.packedLength=u.packedLength+A.packedLength+9;E.pack=function(e,i,t){if(!m(e))throw new b("value is required");if(!m(i))throw new b("array is required");return t=h(t,0),u.pack(e._center,i,t),t+=u.packedLength,A.pack(e._ellipsoid,i,t),t+=A.packedLength,i[t++]=e._semiMajorAxis,i[t++]=e._semiMinorAxis,i[t++]=e._rotation,i[t++]=e._height,i[t++]=e._granularity,i[t++]=e._extrudedHeight,i[t++]=e._numberOfVerticalLines,i[t++]=h(e._offsetAttribute,-1),i[t]=e._outlineWidth,i};var q=new u,C=new A,l={center:q,ellipsoid:C,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0,outlineWidth:void 0};E.unpack=function(e,i,t){if(!m(e))throw new b("array is required");i=h(i,0);var a=u.unpack(e,i,q);i+=u.packedLength;var o=A.unpack(e,i,C);i+=A.packedLength;var n=e[i++],s=e[i++],c=e[i++],r=e[i++],p=e[i++],O=e[i++],_=e[i++],d=e[i++],v=e[i];return m(t)?(t._center=u.clone(a,t._center),t._ellipsoid=A.clone(o,t._ellipsoid),t._semiMajorAxis=n,t._semiMinorAxis=s,t._rotation=c,t._height=r,t._granularity=p,t._extrudedHeight=O,t._numberOfVerticalLines=_,t._offsetAttribute=d===-1?void 0:d,t._outlineWidth=v,t):(l.height=r,l.extrudedHeight=O,l.granularity=p,l.rotation=c,l.semiMajorAxis=n,l.semiMinorAxis=s,l.numberOfVerticalLines=_,l.offsetAttribute=d===-1?void 0:d,l.outlineWidth=v,new E(l))};E.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var i=e._height,t=e._extrudedHeight,a=!L.equalsEpsilon(i,t,0,L.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:i,granularity:e._granularity,outlineWidth:e._outlineWidth,numberOfVerticalLines:e._numberOfVerticalLines},n;if(a)o.extrudedHeight=t,o.offsetAttribute=e._offsetAttribute,n=Y(o);else if(n=F(o),m(e._offsetAttribute)){var s=n.attributes.position.values.length,c=new Uint8Array(s/3),r=e._offsetAttribute===j.NONE?0:1;N(c,r),n.attributes.applyOffset=new w({componentDatatype:M.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new B({attributes:n.attributes,indices:n.indices,primitiveType:a?H.LINES:H.TRIANGLES,boundingSphere:n.boundingSphere,offsetAttribute:e._offsetAttribute})}};var ae=E;export{ae as a};
|