NONGYESHUZIDIZUO/public/Cesium/Workers/PolygonGeometryLibrary-34d6...

2 lines
8.6 KiB
JavaScript
Raw Permalink Normal View History

2023-11-16 09:58:20 +08:00
define(["exports","./when-b60132fc","./Check-7b2a090c","./buildModuleUrl-8cce5713","./ArcType-f8a754c5","./Cartesian4-b0ddc4ba","./FeatureDetection-ab6f364c","./EllipsoidRhumbLine-3ee4574a","./GeometryAttribute-923c2729","./GeometryAttributes-252e9929","./GeometryPipeline-54076c24","./IndexDatatype-3565e02d","./Math-31e539c2","./PolygonPipeline-f2f37e26"],(function(e,t,i,r,a,n,o,s,u,l,h,c,f,d){"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){var e=this._array,t=this._offset,i=e[t];return e[t]=void 0,++t>10&&2*t>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,i}},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)};var y={computeHierarchyPackedLength:function(e){for(var i=0,r=[e];r.length>0;){var a=r.pop();if(t.defined(a)){i+=2;var o=a.positions,s=a.holes;if(t.defined(o)&&(i+=o.length*n.Cartesian3.packedLength),t.defined(s))for(var u=s.length,l=0;l<u;++l)r.push(s[l])}}return i},packPolygonHierarchy:function(e,i,r){for(var a=[e];a.length>0;){var o=a.pop();if(t.defined(o)){var s=o.positions,u=o.holes;if(i[r++]=t.defined(s)?s.length:0,i[r++]=t.defined(u)?u.length:0,t.defined(s))for(var l=s.length,h=0;h<l;++h,r+=3)n.Cartesian3.pack(s[h],i,r);if(t.defined(u))for(var c=u.length,f=0;f<c;++f)a.push(u[f])}}return r},unpackPolygonHierarchy:function(e,t){for(var i=e[t++],r=e[t++],a=new Array(i),o=r>0?new Array(r):void 0,s=0;s<i;++s,t+=n.Cartesian3.packedLength)a[s]=n.Cartesian3.unpack(e,t);for(var u=0;u<r;++u)o[u]=y.unpackPolygonHierarchy(e,t),t=o[u].startingIndex,delete o[u].startingIndex;return{positions:a,holes:o,startingIndex:t}}},g=new n.Cartesian3;function v(e,t,i,r){return n.Cartesian3.subtract(t,e,g),n.Cartesian3.multiplyByScalar(g,i/r,g),n.Cartesian3.add(e,g,g),[g.x,g.y,g.z]}y.subdivideLineCount=function(e,t,i){var r=n.Cartesian3.distance(e,t)/i,a=Math.max(0,Math.ceil(f.Math3D.log2(r)));return Math.pow(2,a)};var m=new n.Cartographic,C=new n.Cartographic,b=new n.Cartographic,I=new n.Cartesian3;y.subdivideRhumbLineCount=function(e,t,i,r){var a=e.cartesianToCartographic(t,m),n=e.cartesianToCartographic(i,C),o=new s.EllipsoidRhumbLine(a,n,e).surfaceDistance/r,u=Math.max(0,Math.ceil(f.Math3D.log2(o)));return Math.pow(2,u)},y.subdivideLine=function(e,i,r,a){var o=y.subdivideLineCount(e,i,r),s=n.Cartesian3.distance(e,i),u=s/o;t.defined(a)||(a=[]);var l=a;l.length=3*o;for(var h=0,c=0;c<o;c++){var f=v(e,i,c*u,s);l[h++]=f[0],l[h++]=f[1],l[h++]=f[2]}return l},y.subdivideRhumbLine=function(e,i,r,a,n){var o=e.cartesianToCartographic(i,m),u=e.cartesianToCartographic(r,C),l=new s.EllipsoidRhumbLine(o,u,e),h=l.surfaceDistance/a,c=Math.max(0,Math.ceil(f.Math3D.log2(h))),d=Math.pow(2,c),p=l.surfaceDistance/d;t.defined(n)||(n=[]);var y=n;y.length=3*d;for(var g=0,v=0;v<d;v++){var T=l.interpolateUsingSurfaceDistance(v*p,b),w=e.cartographicToCartesian(T,I);y[g++]=w.x,y[g++]=w.y,y[g++]=w.z}return y};var T=new n.Cartesian3,w=new n.Cartesian3,E=new n.Cartesian3,x=new n.Cartesian3;y.scaleToGeodeticHeightExtruded=function(e,i,a,o,s){o=t.defaultValue(o,r.Ellipsoid.WGS84);var u=T,l=w,h=E,c=x;if(t.defined(e)&&t.defined(e.attributes)&&t.defined(e.attributes.position))for(var f=e.attributes.position.values,d=f.length/2,p=0;p<d;p+=3)n.Cartesian3.fromArray(f,p,h),o.geodeticSurfaceNormal(h,u),c=o.scaleToGeodeticSurface(h,c),l=n.Cartesian3.multiplyByScalar(u,a,l),l=n.Cartesian3.add(c,l,l),f[p+d]=l.x,f[p+1+d]=l.y,f[p+2+d]=l.z,s&&(c=n.Cartesian3.clone(h,c)),l=n.Cartesian3.multiplyByScalar(u,i,l),l=n.Cartesian3.add(c,l,l),f[p]=l.x,f[p+1]=l.y,f[p+2]=l.z;return e},y.polygonOutlinesFromHierarchy=function(e,i,r){var o,s,u,l=[],