Agriculture-front-end/public/Cesium/Workers/PolygonGeometryLibrary-ae9ad77c.js

2 lines
8.4 KiB
JavaScript
Raw Normal View History

2023-04-16 22:33:44 +08:00
define(["exports","./ArcType-29cf2197","./arrayRemoveDuplicates-d2f048c5","./Cartesian2-47311507","./Cartographic-3309dd0d","./ComponentDatatype-c140a87d","./when-b60132fc","./EllipsoidRhumbLine-ed1a6bf4","./GeometryAttribute-3a42bbdc","./GeometryAttributes-252e9929","./GeometryPipeline-e1b82a4e","./IndexDatatype-8a5eead4","./Math-119be1a3","./BoundingSphere-561b54d0","./PolygonPipeline-f49953b9","./PrimitiveType-39acab88","./Transforms-cb0006b0"],(function(e,t,r,i,a,n,o,s,u,l,h,c,f,p,d,y,g){"use strict";function v(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(v.prototype,{length:{get:function(){return this._length}}}),v.prototype.enqueue=function(e){this._array.push(e),this._length++},v.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}},v.prototype.peek=function(){if(0!==this._length)return this._array[this._offset]},v.prototype.contains=function(e){return-1!==this._array.indexOf(e)},v.prototype.clear=function(){this._array.length=this._offset=this._length=0},v.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};var m={computeHierarchyPackedLength:function(e){for(var t=0,r=[e];r.length>0;){var i=r.pop();if(o.defined(i)){t+=2;var n=i.positions,s=i.holes;if(o.defined(n)&&(t+=n.length*a.Cartesian3.packedLength),o.defined(s))for(var u=s.length,l=0;l<u;++l)r.push(s[l])}}return t},packPolygonHierarchy:function(e,t,r){for(var i=[e];i.length>0;){var n=i.pop();if(o.defined(n)){var s=n.positions,u=n.holes;if(t[r++]=o.defined(s)?s.length:0,t[r++]=o.defined(u)?u.length:0,o.defined(s))for(var l=s.length,h=0;h<l;++h,r+=3)a.Cartesian3.pack(s[h],t,r);if(o.defined(u))for(var c=u.length,f=0;f<c;++f)i.push(u[f])}}return r},unpackPolygonHierarchy:function(e,t){for(var r=e[t++],i=e[t++],n=new Array(r),o=i>0?new Array(i):void 0,s=0;s<r;++s,t+=a.Cartesian3.packedLength)n[s]=a.Cartesian3.unpack(e,t);for(var u=0;u<i;++u)o[u]=m.unpackPolygonHierarchy(e,t),t=o[u].startingIndex,delete o[u].startingIndex;return{positions:n,holes:o,startingIndex:t}}},C=new a.Cartesian3;function b(e,t,r,i){return a.Cartesian3.subtract(t,e,C),a.Cartesian3.multiplyByScalar(C,r/i,C),a.Cartesian3.add(e,C,C),[C.x,C.y,C.z]}m.subdivideLineCount=function(e,t,r){var i=a.Cartesian3.distance(e,t)/r,n=Math.max(0,Math.ceil(f.CesiumMath.log2(i)));return Math.pow(2,n)};var w=new a.Cartographic,T=new a.Cartographic,I=new a.Cartographic,E=new a.Cartesian3;m.subdivideRhumbLineCount=function(e,t,r,i){var a=e.cartesianToCartographic(t,w),n=e.cartesianToCartographic(r,T),o=new s.EllipsoidRhumbLine(a,n,e).surfaceDistance/i,u=Math.max(0,Math.ceil(f.CesiumMath.log2(o)));return Math.pow(2,u)},m.subdivideLine=function(e,t,r,i){var n=m.subdivideLineCount(e,t,r),s=a.Cartesian3.distance(e,t),u=s/n;o.defined(i)||(i=[]);var l=i;l.length=3*n;for(var h=0,c=0;c<n;c++){var f=b(e,t,c*u,s);l[h++]=f[0],l[h++]=f[1],l[h++]=f[2]}return l},m.subdivideRhumbLine=function(e,t,r,i,a){var n=e.cartesianToCartographic(t,w),u=e.cartesianToCartographic(r,T),l=new s.EllipsoidRhumbLine(n,u,e),h=l.surfaceDistance/i,c=Math.max(0,Math.ceil(f.CesiumMath.log2(h))),p=Math.pow(2,c),d=l.surfaceDistance/p;o.defined(a)||(a=[]);var y=a;y.length=3*p;for(var g=0,v=0;v<p;v++){var m=l.interpolateUsingSurfaceDistance(v*d,I),C=e.cartographicToCartesian(m,E);y[g++]=C.x,y[g++]=C.y,y[g++]=C.z}return y};var P=new a.Cartesian3,x=new a.Cartesian3,_=new a.Cartesian3,A=new a.Cartesian3;m.scaleToGeodeticHeightExtruded=function(e,t,r,n,s){n=o.defaultValue(n,i.Ellipsoid.WGS84);var u=P,l=x,h=_,c=A;if(o.defined(e)&&o.defined(e.attributes)&&o.defined(e.attributes.position))for(var f=e.attributes.position.values,p=f.length/2,d=0;d<p;d+=3)a.Cartesian3.fromArray(f,d,h),n.geodeticSurfaceNormal(h,u),c=n.scaleToGeodeticSurface(h,c),l=a.Cartesian3.multiplyByScalar(u,r,l),l=a.Cartesian3.add(c,l,l),f[d+p]=l.x,f[d+1+p]=l.y,f[d+2+p]=l.z,s&&(c=a.Cartesian3.clone(h,c)),l=a.Cartesian3.multiplyByScalar(u,t,l),l=a.Cartesian3.ad