You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
8.5 KiB

9 months ago
define(["exports","./ArcType-fc72c06c","./arrayRemoveDuplicates-dc2f4046","./Matrix2-47e98d76","./ComponentDatatype-a15c9a19","./defaultValue-81eec7ed","./EllipsoidRhumbLine-6145377b","./GeometryAttribute-64b853f6","./GeometryAttributes-32b29525","./GeometryPipeline-7ffd77ba","./IndexDatatype-f1dcdf35","./PolygonPipeline-32809f7a","./Transforms-08771371"],(function(e,t,n,i,o,r,a,s,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,a=e.holes;if(r.defined(o)&&(t+=o.length*i.Cartesian3.packedLength),r.defined(a)){const e=a.length;for(let t=0;t<e;++t)n.push(a[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 a=e.positions,s=e.holes;if(t[n++]=r.defined(a)?a.length:0,t[n++]=r.defined(s)?s.length:0,r.defined(a)){const e=a.length;for(let o=0;o<e;++o,n+=3)i.Cartesian3.pack(a[o],t,n)}if(r.defined(s)){const e=s.length;for(let t=0;t<e;++t)o.push(s[t])}}return n},unpackPolygonHierarchy:function(e,t){const n=e[t++],o=e[t++],r=new Array(n),a=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)a[n]=d.unpackPolygonHierarchy(e,t),t=a[n].startingIndex,delete a[n].startingIndex;return{positions:r,holes:a,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,a=Math.max(0,Math.ceil(o.CesiumMath.log2(r)));return Math.pow(2,a)};const m=new i.Cartographic,C=new i.Cartographic,b=new i.Cartographic,T=new i.Cartesian3;d.subdivideRhumbLineCount=function(e,t,n,i){const r=e.cartesianToCartographic(t,m),s=e.cartesianToCartographic(n,C),c=new a.EllipsoidRhumbLine(r,s,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 a=d.subdivideLineCount(e,t,n),s=i.Cartesian3.distance(e,t),c=s/a;r.defined(o)||(o=[]);const l=o;l.length=3*a;let u=0;for(let n=0;n<a;n++){const i=g(e,t,n*c,s);l[u++]=i[0],l[u++]=i[1],l[u++]=i[2]}return l},d.subdivideRhumbLine=function(e,t,n,i,s){const c=e.cartesianToCartographic(t,m),l=e.cartesianToCartographic(n,C),u=new a.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(s)||(s=[]);const y=s;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,T);y[g++]=i.x,y[g++]=i.y,y[g++]=i.z}return y};const w=new i.Cartesian3,I=new i.Cartesian3,x=new i.Cartesian3,v=new i.Cartesian3;d.scaleToGeodeticHeightExtruded=function(e,t,n,o,a){o=r.defaultValue(o,i.Ellipsoid.WGS84);const s=w;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,s),u=o.scaleToGeodeticSurface(l,u),c=i.Cartesian3.multiplyByScalar(s,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,a&&(u=i.Cartesian3.clone(l,u)),c=i.Cartesian3.multiply