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
5.1 KiB
2 lines
5.1 KiB
12 months ago
|
define(["exports","./when-cbf8cd21","./Check-35e1a91d","./Math-6a1814d8","./Cartesian2-c451a606","./Transforms-e4be2a30","./IntersectionTests-8371bf29","./Plane-929e0674","./EllipsoidRhumbLine-8c93f67a","./EllipsoidGeodesic-19b1a191"],function(a,w,e,P,T,v,m,y,A,r){"use strict";var b={numberOfPoints:function(a,e,r){var t=T.Cartesian3.distance(a,e);return Math.ceil(t/r)},numberOfPointsRhumbLine:function(a,e,r){var t=Math.pow(a.longitude-e.longitude,2)+Math.pow(a.latitude-e.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(t/(r*r))))}},o=new T.Cartographic;b.extractHeights=function(a,e){for(var r=a.length,t=new Array(r),i=0;i<r;i++){var n=a[i];t[i]=e.cartesianToCartographic(n,o).height}return t};var E=new v.Matrix4,R=new T.Cartesian3,M=new T.Cartesian3,S=new y.Plane(T.Cartesian3.UNIT_X,0),D=new T.Cartesian3,x=new y.Plane(T.Cartesian3.UNIT_X,0),N=new T.Cartesian3,G=new T.Cartesian3,I=[];function k(a,e,r){var t,i=I;if(i.length=a,e===r){for(t=0;t<a;t++)i[t]=e;return i}var n=(r-e)/a;for(t=0;t<a;t++){var o=e+t*n;i[t]=o}return i}var V=new T.Cartographic,L=new T.Cartographic,_=new T.Cartesian3,O=new T.Cartesian3,B=new T.Cartesian3,U=new r.EllipsoidGeodesic,z=new A.EllipsoidRhumbLine;function X(a,e,r,t,i,n,o,s){var c=t.scaleToGeodeticSurface(a,O),l=t.scaleToGeodeticSurface(e,B),u=b.numberOfPoints(a,e,r),h=t.cartesianToCartographic(c,V),f=t.cartesianToCartographic(l,L),g=k(u,i,n);U.setEndPoints(h,f);var C=U.surfaceDistance/u,p=s;h.height=i;var d=t.cartographicToCartesian(h,_);T.Cartesian3.pack(d,o,p),p+=3;for(var v=1;v<u;v++){var m=U.interpolateUsingSurfaceDistance(v*C,L);m.height=g[v],d=t.cartographicToCartesian(m,_),T.Cartesian3.pack(d,o,p),p+=3}return p}function q(a,e,r,t,i,n,o,s){var c=t.cartesianToCartographic(a,V),l=t.cartesianToCartographic(e,L),u=b.numberOfPointsRhumbLine(c,l,r);c.height=0,l.height=0;var h=k(u,i,n);z.ellipsoid.equals(t)||(z=new A.EllipsoidRhumbLine(void 0,void 0,t)),z.setEndPoints(c,l);var f=z.surfaceDistance/u,g=s;c.height=i;var C=t.cartographicToCartesian(c,_);T.Cartesian3.pack(C,o,g),g+=3;for(var p=1;p<u;p++){var d=z.interpolateUsingSurfaceDistance(p*f,L);d.height=h[p],C=t.cartographicToCartesian(d,_),T.Cartesian3.pack(C,o,g),g+=3}return g}b.wrapLongitude=function(a,e){var r=[],t=[];if(w.defined(a)&&0<a.length){e=w.defaultValue(e,v.Matrix4.IDENTITY);var i=v.Matrix4.inverseTransformation(e,E),n=v.Matrix4.multiplyByPoint(i,T.Cartesian3.ZERO,R),o=T.Cartesian3.normalize(v.Matrix4.multiplyByPointAsVector(i,T.Cartesian3.UNIT_Y,M),M),s=y.Plane.fromPointNormal(n,o,S),c=T.Cartesian3.normalize(v.Matrix4.multiplyByPointAsVector(i,T.Cartesian3.UNIT_X,D),D),l=y.Plane.fromPointNormal(n,c,x),u=1;r.push(T.Cartesian3.clone(a[0]));for(var h=r[0],f=a.length,g=1;g<f;++g){var C=a[g];if(y.Plane.getPointDistance(l,h)<0||y.Plane.getPointDistance(l,C)<0){var p=m.IntersectionTests.lineSegmentPlane(h,C,s,N);if(w.defined(p)){var d=T.Cartesian3.multiplyByScalar(o,5e-9,G);y.Plane.getPointDistance(s,h)<0&&T.Cartesian3.negate(d,d),r.push(T.Cartesian3.add(p,d,new T.Cartesian3)),t.push(u+1),T.Cartesian3.negate(d,d),r.push(T.Cartesian3.add(p,d,new T.Cartesian3)),u=1}}r.push(T.Cartesian3.clone(a[g])),u++,h=C}t.push(u)}return{positions:r,lengths:t}},b.generateArc=function(a){w.defined(a)||(a={});var e=a.positions,r=e.length,t=w.defaultValue(a.ellipsoid,T.Ellipsoid.WGS84),i=w.defaultValue(a.height,0),n=Array.isArray(i);if(r<1)return[];if(1===r){var o=t.scaleToGeodeticSurface(e[0],O);if(0!==(i=n?i[0]:i)){var s=t.geodeticSurfaceNormal(o,_);T.Cartesian3.multiplyByScalar(s,i,s),T.Cartesian3.add(o,s,o)}return[o.x,o.y,o.z]}var c=a.minDistance;if(!w.defined(c)){var l=w.defaultValue(a.granularity,P.CesiumMath.RADIANS_PER_DEGREE);c=P.CesiumMath.chordLength(l,t.maximumRadius)}var u,h=0;for(u=0;u<r-1;u++)h+=b.numberOfPoints(e[u],e[u+1],c);var f=3*(h+1),g=new Array(f),C=0;for(u=0;u<r-1;u++){C=X(e[u],e[u+1],c,t,n?i[u]:i,n?i[u+1]:i,g,C)}I.length=0;var p=e[r-1],d=t.cartesianToCartographic(p,V);d.height=n?i[r-1]:i;var v=t.cartographicToCartesian(d,_);return T.Cartesian3.pack(v,g,f-3),g};var W=new T.Cartographic,Y=new T.Cartographic;b.generateRhumbArc=functi
|