NONGYESHUZIDIZUO/public/Cesium/Workers/PolygonGeometryLibrary-190f...

2 lines
7.5 KiB
JavaScript
Raw Normal View History

2025-01-21 08:36:33 +08:00
define(["exports","./ArcType-198c1070","./arrayRemoveDuplicates-74caa2f4","./Cartesian2-2b41fabe","./Cartographic-1d953166","./ComponentDatatype-07894a2b","./when-d186add7","./Rectangle-f841217d","./EllipsoidRhumbLine-394d2834","./GeometryAttribute-95780fd1","./GeometryAttributes-9c67dd14","./GeometryPipeline-6f0b08bc","./IndexDatatype-61ffec74","./Math-7f5f2992","./FeatureDetection-4281d393","./PolygonPipeline-6809c3ce"],(function(e,t,r,n,i,o,a,s,u,h,c,l,f,p,v,d){"use strict";function g(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(g.prototype,{length:{get:function(){return this._length}}}),g.prototype.enqueue=function(e){this._array.push(e),this._length++},g.prototype.dequeue=function(){if(0!==this._length){var e=this._array,t=this._offset,r=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--,r}},g.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},g.prototype.contains=function(e){return-1!==this._array.indexOf(e)},g.prototype.clear=function(){this._array.length=this._offset=this._length=0},g.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 t=0,r=[e];r.length>0;){var n=r.pop();if(a.e(n)){t+=2;var o=n.positions,s=n.holes;if(a.e(o)&&(t+=o.length*i.t.packedLength),a.e(s))for(var u=s.length,h=0;h<u;++h)r.push(s[h])}}return t},packPolygonHierarchy:function(e,t,r){for(var n=[e];n.length>0;){var o=n.pop();if(a.e(o)){var s=o.positions,u=o.holes;if(t[r++]=a.e(s)?s.length:0,t[r++]=a.e(u)?u.length:0,a.e(s))for(var h=s.length,c=0;c<h;++c,r+=3)i.t.pack(s[c],t,r);if(a.e(u))for(var l=u.length,f=0;f<l;++f)n.push(u[f])}}return r},unpackPolygonHierarchy:function(e,t){for(var r=e[t++],n=e[t++],o=new Array(r),a=n>0?new Array(n):void 0,s=0;s<r;++s,t+=i.t.packedLength)o[s]=i.t.unpack(e,t);for(var u=0;u<n;++u)a[u]=y.unpackPolygonHierarchy(e,t),t=a[u].startingIndex,delete a[u].startingIndex;return{positions:o,holes:a,startingIndex:t}}},m=new i.t;function b(e,t,r,n){return i.t.subtract(t,e,m),i.t.multiplyByScalar(m,r/n,m),i.t.add(e,m,m),[m.x,m.y,m.z]}y.subdivideLineCount=function(e,t,r){var n=i.t.distance(e,t)/r,o=Math.max(0,Math.ceil(p.e.log2(n)));return Math.pow(2,o)};var I=new i.t$1,w=new i.t$1,_=new i.t$1,L=new i.t;y.subdivideRhumbLineCount=function(e,t,r,n){var i=e.cartesianToCartographic(t,I),o=e.cartesianToCartographic(r,w),a=new u.P(i,o,e).surfaceDistance/n,s=Math.max(0,Math.ceil(p.e.log2(a)));return Math.pow(2,s)},y.subdivideLine=function(e,t,r,n){var o=y.subdivideLineCount(e,t,r),s=i.t.distance(e,t),u=s/o;a.e(n)||(n=[]);var h=n;h.length=3*o;for(var c=0,l=0;l<o;l++){var f=b(e,t,l*u,s);h[c++]=f[0],h[c++]=f[1],h[c++]=f[2]}return h},y.subdivideRhumbLine=function(e,t,r,n,i){var o=e.cartesianToCartographic(t,I),s=e.cartesianToCartographic(r,w),h=new u.P(o,s,e),c=h.surfaceDistance/n,l=Math.max(0,Math.ceil(p.e.log2(c))),f=Math.pow(2,l),v=h.surfaceDistance/f;a.e(i)||(i=[]);var d=i;d.length=3*f;for(var g=0,y=0;y<f;y++){var m=h.interpolateUsingSurfaceDistance(y*v,_),b=e.cartographicToCartesian(m,L);d[g++]=b.x,d[g++]=b.y,d[g++]=b.z}return d};var x=new i.t,E=new i.t,D=new i.t,S=new i.t;y.scaleToGeodeticHeightExtruded=function(e,t,r,n,o){n=a.u(n,s.t.WGS84);var u=x,h=E,c=D,l=S;if(a.e(e)&&a.e(e.attributes)&&a.e(e.attributes.position))for(var f=e.attributes.position.values,p=f.length/2,v=0;v<p;v+=3)i.t.fromArray(f,v,c),n.geodeticSurfaceNormal(c,u),l=n.scaleToGeodeticSurface(c,l),h=i.t.multiplyByScalar(u,r,h),h=i.t.add(l,h,h),f[v+p]=h.x,f[v+1+p]=h.y,f[v+2+p]=h.z,o&&(l=i.t.clone(c,l)),h=i.t.multiplyByScalar(u,t,h),h=i.t.add(l,h,h),f[v]=h.x,f[v+1]=h.y,f[v+2]=h.z;return e},y.polygonOutlinesFromHierarchy=function(e,t,n){var o,s,u,h=[],c=new g;for(c.enqueue(e);0!==c.length;){var l=c.dequeue(),f=l.positions;if(t)for(u=f.length,o=0;o<u;o++)n.scaleToGeodeticSurface(f[o],f[o]);if(!((f=r.D(f,i.t.equalsEpsilon,!0)).length<3)){var p=l.holes?l.holes.length:0;for(o=0;o<p;o++){var v=l.holes[o],d=v.positions;if(t)for(u=d.length,s=0