EllipseOutlineGeometry-00d24bf0.js 5.6 KB

1
  1. define(["exports","./arrayFill-0358accf","./buildModuleUrl-3d15f25c","./Cartographic-67e73ef9","./ComponentDatatype-81047f82","./when-92c6cf3c","./Check-52a7d806","./EllipseGeometryLibrary-f97eafbd","./Rectangle-bab7abf0","./GeometryAttribute-ef657318","./GeometryAttributes-7f66ea53","./GeometryOffsetAttribute-b4d599f5","./IndexDatatype-4c0e98b8","./Math-92c3b5f7","./PrimitiveType-cdfe443e"],(function(e,t,i,r,n,a,o,s,u,d,l,c,f,h,p){"use strict";var m=new r.t,_=new r.t;var A=new i.i,b=new i.i;function g(e){var t=(e=a.u(e,a.u.EMPTY_OBJECT)).center,i=a.u(e.ellipsoid,u.t.WGS84),n=e.semiMajorAxis,s=e.semiMinorAxis,d=a.u(e.granularity,h.e.RADIANS_PER_DEGREE);if(!a.e(t))throw new o.t("center is required.");if(!a.e(n))throw new o.t("semiMajorAxis is required.");if(!a.e(s))throw new o.t("semiMinorAxis is required.");if(n<s)throw new o.t("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(d<=0)throw new o.t("granularity must be greater than zero.");var l=a.u(e.height,0),c=a.u(e.extrudedHeight,l);this._center=r.t.clone(t),this._semiMajorAxis=n,this._semiMinorAxis=s,this._ellipsoid=u.t.clone(i),this._rotation=a.u(e.rotation,0),this._height=Math.max(c,l),this._granularity=d,this._extrudedHeight=Math.min(c,l),this._numberOfVerticalLines=Math.max(a.u(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._outlineWidth=a.u(e.outlineWidth,1),this._workerName="createEllipseOutlineGeometry"}g.packedLength=r.t.packedLength+u.t.packedLength+9,g.pack=function(e,t,i){if(!a.e(e))throw new o.t("value is required");if(!a.e(t))throw new o.t("array is required");return i=a.u(i,0),r.t.pack(e._center,t,i),i+=r.t.packedLength,u.t.pack(e._ellipsoid,t,i),i+=u.t.packedLength,t[i++]=e._semiMajorAxis,t[i++]=e._semiMinorAxis,t[i++]=e._rotation,t[i++]=e._height,t[i++]=e._granularity,t[i++]=e._extrudedHeight,t[i++]=e._numberOfVerticalLines,t[i++]=a.u(e._offsetAttribute,-1),t[i]=e._outlineWidth,t};var y=new r.t,v=new u.t,x={center:y,ellipsoid:v,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};g.unpack=function(e,t,i){if(!a.e(e))throw new o.t("array is required");t=a.u(t,0);var n=r.t.unpack(e,t,y);t+=r.t.packedLength;var s=u.t.unpack(e,t,v);t+=u.t.packedLength;var d=e[t++],l=e[t++],c=e[t++],f=e[t++],h=e[t++],p=e[t++],m=e[t++],_=e[t++],A=e[t];return a.e(i)?(i._center=r.t.clone(n,i._center),i._ellipsoid=u.t.clone(s,i._ellipsoid),i._semiMajorAxis=d,i._semiMinorAxis=l,i._rotation=c,i._height=f,i._granularity=h,i._extrudedHeight=p,i._numberOfVerticalLines=m,i._offsetAttribute=-1===_?void 0:_,i._outlineWidth=A,i):(x.height=f,x.extrudedHeight=p,x.granularity=h,x.rotation=c,x.semiMajorAxis=d,x.semiMinorAxis=l,x.numberOfVerticalLines=m,x.offsetAttribute=-1===_?void 0:_,x.outlineWidth=A,new g(x))},g.createGeometry=function(e){if(!(e._semiMajorAxis<=0||e._semiMinorAxis<=0)){var o=e._height,u=e._extrudedHeight,g=!h.e.equalsEpsilon(o,u,0,h.e.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);var y,v={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:o,granularity:e._granularity,outlineWidth:e._outlineWidth,numberOfVerticalLines:e._numberOfVerticalLines};if(g)v.extrudedHeight=u,v.offsetAttribute=e._offsetAttribute,y=function(e){var o=e.center,u=e.ellipsoid,p=e.semiMajorAxis,_=r.t.multiplyByScalar(u.geodeticSurfaceNormal(o,m),e.height,m);A.center=r.t.add(o,_,A.center),A.radius=p,_=r.t.multiplyByScalar(u.geodeticSurfaceNormal(o,_),e.extrudedHeight,_),b.center=r.t.add(o,_,b.center),b.radius=p;var g=s.C.computeEllipsePositions(e,!1,!0).outerPositions,y=new l.a({position:new d.o({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:s.C.raisePositionsToHeight(g,e,!0)})});g=y.position.values;var v=i.i.union(A,b),x=g.length/3;if(a.e(e.offsetAttribute)){var w=new Uint8Array(x);if(e.offsetAttribute===c.z.TOP)w=t.d(w,1,0,x/2);else{var M=e.offsetAttribute===c.z.NONE?0:1;w=t.d(w,M)}y.applyOffset=new d.o({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:w})}var L=a.u(e.numberOfVerticalLines,16);L=h.e.clamp(L,0,x/2);var E=f.IndexDatatype.createTypedArray(x,2*x+2*L);x/=2;var O,D,S=0;for(O=0;O<x;++O)E[S++]=O,E[S++]=(O+1)%x,E[S++]=O+x,E[S++]=(O+1)%x+x;if(L>0){var N=Math.min(L,x);D=Math.round(x/N);var P=Math.min(D*L,x);for(O=0;O<P;O+=D)E[S++]=O,E[S++]=O+x}return{boundingSphere:v,attributes:y,indices:E}}(v);else if(y=function(e){var t=e.center;_=r.t.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,_),e.height,_),_=r.t.add(t,_,_);var a=new i.i(_,e.semiMajorAxis),o=s.C.computeEllipsePositions(e,!1,!0).outerPositions;o.push(o[0],o[1],o[2]);var u=new l.a({position:new d.o({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:s.C.raisePositionsToHeight(o,e,!1)})});u.sideness=new d.o({componentDatatype:n.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array([0,0,0,1,1,1,1,0])}),u.sideness.isInstanceAttribute=!0;for(var c=o.length/3,h=f.IndexDatatype.createTypedArray(c,2*c),p=0,m=0;m<c;++m)h[p++]=m,h[p++]=(m+1)%c;return{boundingSphere:a,attributes:u,indices:h}}(v),a.e(e._offsetAttribute)){var x=y.attributes.position.values.length,w=new Uint8Array(x/3),M=e._offsetAttribute===c.z.NONE?0:1;t.d(w,M),y.attributes.applyOffset=new d.o({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:w})}return new d.I({attributes:y.attributes,indices:y.indices,primitiveType:g?p._0x29ba75.LINES:p._0x29ba75.TRIANGLES,boundingSphere:y.boundingSphere,offsetAttribute:e._offsetAttribute})}},e.M=g}));