1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-09 01:56:05 -05:00
sdrangel/plugins/feature/map/Cesium/Workers/EllipseOutlineGeometry-000dc678.js

2 lines
5.5 KiB
JavaScript
Raw Normal View History

2022-02-04 15:41:22 -05:00
define(["exports","./GeometryOffsetAttribute-4f901209","./Transforms-ab7258fe","./Matrix2-46444433","./ComponentDatatype-692a36d3","./when-229515d6","./RuntimeError-608565a6","./EllipseGeometryLibrary-c06dcaf7","./GeometryAttribute-d3bef603","./GeometryAttributes-b253752a","./IndexDatatype-7c683b18"],(function(e,t,i,r,n,a,o,s,l,u,d){"use strict";const c=new r.Cartesian3;let p=new r.Cartesian3;const f=new i.BoundingSphere,m=new i.BoundingSphere;function h(e){const t=(e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT)).center,i=a.defaultValue(e.ellipsoid,r.Ellipsoid.WGS84),o=e.semiMajorAxis,s=e.semiMinorAxis,l=a.defaultValue(e.granularity,n.CesiumMath.RADIANS_PER_DEGREE),u=a.defaultValue(e.height,0),d=a.defaultValue(e.extrudedHeight,u);this._center=r.Cartesian3.clone(t),this._semiMajorAxis=o,this._semiMinorAxis=s,this._ellipsoid=r.Ellipsoid.clone(i),this._rotation=a.defaultValue(e.rotation,0),this._height=Math.max(d,u),this._granularity=l,this._extrudedHeight=Math.min(d,u),this._numberOfVerticalLines=Math.max(a.defaultValue(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}h.packedLength=r.Cartesian3.packedLength+r.Ellipsoid.packedLength+8,h.pack=function(e,t,i){return i=a.defaultValue(i,0),r.Cartesian3.pack(e._center,t,i),i+=r.Cartesian3.packedLength,r.Ellipsoid.pack(e._ellipsoid,t,i),i+=r.Ellipsoid.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.defaultValue(e._offsetAttribute,-1),t};const y=new r.Cartesian3,b=new r.Ellipsoid,A={center:y,ellipsoid:b,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};h.unpack=function(e,t,i){t=a.defaultValue(t,0);const n=r.Cartesian3.unpack(e,t,y);t+=r.Cartesian3.packedLength;const o=r.Ellipsoid.unpack(e,t,b);t+=r.Ellipsoid.packedLength;const s=e[t++],l=e[t++],u=e[t++],d=e[t++],c=e[t++],p=e[t++],f=e[t++],m=e[t];return a.defined(i)?(i._center=r.Cartesian3.clone(n,i._center),i._ellipsoid=r.Ellipsoid.clone(o,i._ellipsoid),i._semiMajorAxis=s,i._semiMinorAxis=l,i._rotation=u,i._height=d,i._granularity=c,i._extrudedHeight=p,i._numberOfVerticalLines=f,i._offsetAttribute=-1===m?void 0:m,i):(A.height=d,A.extrudedHeight=p,A.granularity=c,A.rotation=u,A.semiMajorAxis=s,A.semiMinorAxis=l,A.numberOfVerticalLines=f,A.offsetAttribute=-1===m?void 0:m,new h(A))},h.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const o=e._height,h=e._extrudedHeight,y=!n.CesiumMath.equalsEpsilon(o,h,0,n.CesiumMath.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const b={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:o,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};let A;if(y)b.extrudedHeight=h,b.offsetAttribute=e._offsetAttribute,A=function(e){const o=e.center,p=e.ellipsoid,h=e.semiMajorAxis;let y=r.Cartesian3.multiplyByScalar(p.geodeticSurfaceNormal(o,c),e.height,c);f.center=r.Cartesian3.add(o,y,f.center),f.radius=h,y=r.Cartesian3.multiplyByScalar(p.geodeticSurfaceNormal(o,y),e.extrudedHeight,y),m.center=r.Cartesian3.add(o,y,m.center),m.radius=h;let b=s.EllipseGeometryLibrary.computeEllipsePositions(e,!1,!0).outerPositions;const A=new u.GeometryAttributes({position:new l.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:s.EllipseGeometryLibrary.raisePositionsToHeight(b,e,!0)})});b=A.position.values;const _=i.BoundingSphere.union(f,m);let g=b.length/3;if(a.defined(e.offsetAttribute)){let i=new Uint8Array(g);if(e.offsetAttribute===t.GeometryOffsetAttribute.TOP)i=t.arrayFill(i,1,0,g/2);else{const r=e.offsetAttribute===t.GeometryOffsetAttribute.NONE?0:1;i=t.arrayFill(i,r)}A.applyOffset=new l.GeometryAttribute({componentDatatype:n.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:1,values:i})}let x=