mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-14 04:11:48 -05:00
2 lines
8.5 KiB
JavaScript
2 lines
8.5 KiB
JavaScript
|
define(["exports","./ArcType-e1641d8d","./arrayRemoveDuplicates-ee080d9d","./Matrix2-46444433","./ComponentDatatype-692a36d3","./when-229515d6","./EllipsoidRhumbLine-9cd85d72","./GeometryAttribute-d3bef603","./GeometryAttributes-b253752a","./GeometryPipeline-dfaf2218","./IndexDatatype-7c683b18","./PolygonPipeline-259e0bdf","./Transforms-ab7258fe"],(function(e,t,n,i,o,r,s,a,c,l,u,h,f){"use strict";function p(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(p.prototype,{length:{get:function(){return this._length}}}),p.prototype.enqueue=function(e){this._array.push(e),this._length++},p.prototype.dequeue=function(){if(0===this._length)return;const e=this._array;let t=this._offset;const n=e[t];return e[t]=void 0,t++,t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,n},p.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},p.prototype.contains=function(e){return-1!==this._array.indexOf(e)},p.prototype.clear=function(){this._array.length=this._offset=this._length=0},p.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const d={computeHierarchyPackedLength:function(e){let t=0;const n=[e];for(;n.length>0;){const e=n.pop();if(!r.defined(e))continue;t+=2;const o=e.positions,s=e.holes;if(r.defined(o)&&(t+=o.length*i.Cartesian3.packedLength),r.defined(s)){const e=s.length;for(let t=0;t<e;++t)n.push(s[t])}}return t},packPolygonHierarchy:function(e,t,n){const o=[e];for(;o.length>0;){const e=o.pop();if(!r.defined(e))continue;const s=e.positions,a=e.holes;if(t[n++]=r.defined(s)?s.length:0,t[n++]=r.defined(a)?a.length:0,r.defined(s)){const e=s.length;for(let o=0;o<e;++o,n+=3)i.Cartesian3.pack(s[o],t,n)}if(r.defined(a)){const e=a.length;for(let t=0;t<e;++t)o.push(a[t])}}return n},unpackPolygonHierarchy:function(e,t){const n=e[t++],o=e[t++],r=new Array(n),s=o>0?new Array(o):void 0;for(let o=0;o<n;++o,t+=i.Cartesian3.packedLength)r[o]=i.Cartesian3.unpack(e,t);for(let n=0;n<o;++n)s[n]=d.unpackPolygonHierarchy(e,t),t=s[n].startingIndex,delete s[n].startingIndex;return{positions:r,holes:s,startingIndex:t}}},y=new i.Cartesian3;function g(e,t,n,o){return i.Cartesian3.subtract(t,e,y),i.Cartesian3.multiplyByScalar(y,n/o,y),i.Cartesian3.add(e,y,y),[y.x,y.y,y.z]}d.subdivideLineCount=function(e,t,n){const r=i.Cartesian3.distance(e,t)/n,s=Math.max(0,Math.ceil(o.CesiumMath.log2(r)));return Math.pow(2,s)};const m=new i.Cartographic,C=new i.Cartographic,b=new i.Cartographic,w=new i.Cartesian3;d.subdivideRhumbLineCount=function(e,t,n,i){const r=e.cartesianToCartographic(t,m),a=e.cartesianToCartographic(n,C),c=new s.EllipsoidRhumbLine(r,a,e).surfaceDistance/i,l=Math.max(0,Math.ceil(o.CesiumMath.log2(c)));return Math.pow(2,l)},d.subdivideLine=function(e,t,n,o){const s=d.subdivideLineCount(e,t,n),a=i.Cartesian3.distance(e,t),c=a/s;r.defined(o)||(o=[]);const l=o;l.length=3*s;let u=0;for(let n=0;n<s;n++){const i=g(e,t,n*c,a);l[u++]=i[0],l[u++]=i[1],l[u++]=i[2]}return l},d.subdivideRhumbLine=function(e,t,n,i,a){const c=e.cartesianToCartographic(t,m),l=e.cartesianToCartographic(n,C),u=new s.EllipsoidRhumbLine(c,l,e),h=u.surfaceDistance/i,f=Math.max(0,Math.ceil(o.CesiumMath.log2(h))),p=Math.pow(2,f),d=u.surfaceDistance/p;r.defined(a)||(a=[]);const y=a;y.length=3*p;let g=0;for(let t=0;t<p;t++){const n=u.interpolateUsingSurfaceDistance(t*d,b),i=e.cartographicToCartesian(n,w);y[g++]=i.x,y[g++]=i.y,y[g++]=i.z}return y};const T=new i.Cartesian3,I=new i.Cartesian3,x=new i.Cartesian3,v=new i.Cartesian3;d.scaleToGeodeticHeightExtruded=function(e,t,n,o,s){o=r.defaultValue(o,i.Ellipsoid.WGS84);const a=T;let c=I;const l=x;let u=v;if(r.defined(e)&&r.defined(e.attributes)&&r.defined(e.attributes.position)){const r=e.attributes.position.values,h=r.length/2;for(let e=0;e<h;e+=3)i.Cartesian3.fromArray(r,e,l),o.geodeticSurfaceNormal(l,a),u=o.scaleToGeodeticSurface(l,u),c=i.Cartesian3.multiplyByScalar(a,n,c),c=i.Cartesian3.add(u,c,c),r[e+h]=c.x,r[e+1+h]=c.y,r[e+2+h]=c.z,s&&(u=i.Cartesian3.clone(l,u)),c=i.Cartesian3.multiplyByScalar
|