1 |
- define(["exports","./Matrix2-ccd5b911","./when-4bbc8319","./RuntimeError-346a3079","./EllipsoidGeodesic-19ea7553","./EllipsoidRhumbLine-aa9e6266","./IntersectionTests-4d6f5c54","./ComponentDatatype-93750d1a","./Plane-18bb00f8"],function(a,m,p,e,r,d,v,w,P){"use strict";var T={numberOfPoints:function(a,e,r){e=m.Cartesian3.distance(a,e);return Math.ceil(e/r)},numberOfPointsRhumbLine:function(a,e,r){e=Math.pow(a.longitude-e.longitude,2)+Math.pow(a.latitude-e.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(e/(r*r))))}},o=new m.Cartographic;T.extractHeights=function(a,e){for(var r=a.length,t=new Array(r),n=0;n<r;n++){var i=a[n];t[n]=e.cartesianToCartographic(i,o).height}return t};var y=new m.Matrix4,A=new m.Cartesian3,b=new m.Cartesian3,E=new P.Plane(m.Cartesian3.UNIT_X,0),R=new m.Cartesian3,M=new P.Plane(m.Cartesian3.UNIT_X,0),S=new m.Cartesian3,D=new m.Cartesian3,x=[];function N(a,e,r){var t=x;if(t.length=a,e===r){for(i=0;i<a;i++)t[i]=e;return t}for(var n=(r-e)/a,i=0;i<a;i++)t[i]=e+i*n;return t}var G=new m.Cartographic,I=new m.Cartographic,V=new m.Cartesian3,k=new m.Cartesian3,L=new m.Cartesian3,_=new r.EllipsoidGeodesic,O=new d.EllipsoidRhumbLine;T.wrapLongitude=function(a,e){var r=[],t=[];if(p.defined(a)&&0<a.length){e=p.defaultValue(e,m.Matrix4.IDENTITY);var n=m.Matrix4.inverseTransformation(e,y),e=m.Matrix4.multiplyByPoint(n,m.Cartesian3.ZERO,A),i=m.Cartesian3.normalize(m.Matrix4.multiplyByPointAsVector(n,m.Cartesian3.UNIT_Y,b),b),o=P.Plane.fromPointNormal(e,i,E),n=m.Cartesian3.normalize(m.Matrix4.multiplyByPointAsVector(n,m.Cartesian3.UNIT_X,R),R),s=P.Plane.fromPointNormal(e,n,M),c=1;r.push(m.Cartesian3.clone(a[0]));for(var l=r[0],u=a.length,h=1;h<u;++h){var g,f,C=a[h];(P.Plane.getPointDistance(s,l)<0||P.Plane.getPointDistance(s,C)<0)&&(g=v.IntersectionTests.lineSegmentPlane(l,C,o,S),p.defined(g)&&(f=m.Cartesian3.multiplyByScalar(i,5e-9,D),P.Plane.getPointDistance(o,l)<0&&m.Cartesian3.negate(f,f),r.push(m.Cartesian3.add(g,f,new m.Cartesian3)),t.push(c+1),m.Cartesian3.negate(f,f),r.push(m.Cartesian3.add(g,f,new m.Cartesian3)),c=1)),r.push(m.Cartesian3.clone(a[h])),c++,l=C}t.push(c)}return{positions:r,lengths:t}},T.generateArc=function(a){var e=(a=!p.defined(a)?{}:a).positions,r=e.length,t=p.defaultValue(a.ellipsoid,m.Ellipsoid.WGS84),n=p.defaultValue(a.height,0),i=Array.isArray(n);if(r<1)return[];if(1===r){var o,s=t.scaleToGeodeticSurface(e[0],k);return 0!==(n=i?n[0]:n)&&(o=t.geodeticSurfaceNormal(s,V),m.Cartesian3.multiplyByScalar(o,n,o),m.Cartesian3.add(s,o,s)),[s.x,s.y,s.z]}var c=a.minDistance;p.defined(c)||(f=p.defaultValue(a.granularity,w.CesiumMath.RADIANS_PER_DEGREE),c=w.CesiumMath.chordLength(f,t.maximumRadius));for(var l=0,u=0;u<r-1;u++)l+=T.numberOfPoints(e[u],e[u+1],c);var a=3*(l+1),h=new Array(a),g=0;for(u=0;u<r-1;u++)g=function(a,e,r,t,n,i,o,s){var c=t.scaleToGeodeticSurface(a,k),l=t.scaleToGeodeticSurface(e,L),u=T.numberOfPoints(a,e,r),c=t.cartesianToCartographic(c,G),l=t.cartesianToCartographic(l,I),h=N(u,n,i);_.setEndPoints(c,l);var g=_.surfaceDistance/u,f=s;c.height=n;var C=t.cartographicToCartesian(c,V);m.Cartesian3.pack(C,o,f),f+=3;for(var p=1;p<u;p++){var d=_.interpolateUsingSurfaceDistance(p*g,I);d.height=h[p],C=t.cartographicToCartesian(d,V),m.Cartesian3.pack(C,o,f),f+=3}return f}(e[u],e[u+1],c,t,i?n[u]:n,i?n[u+1]:n,h,g);x.length=0;var f=e[r-1],f=t.cartesianToCartographic(f,G);f.height=i?n[r-1]:n;f=t.cartographicToCartesian(f,V);return m.Cartesian3.pack(f,h,a-3),h};var B=new m.Cartographic,U=new m.Cartographic;T.generateRhumbArc=function(a){var e=(a=!p.defined(a)?{}:a).positions,r=e.length,t=p.defaultValue(a.ellipsoid,m.Ellipsoid.WGS84),n=p.defaultValue(a.height,0),i=Array.isArray(n);if(r<1)return[];if(1===r){var o,s=t.scaleToGeodeticSurface(e[0],k);return 0!==(n=i?n[0]:n)&&(o=t.geodeticSurfaceNormal(s,V),m.Cartesian3.multiplyByScalar(o,n,o),m.Cartesian3.add(s,o,s)),[s.x,s.y,s.z]}for(var c,l=p.defaultValue(a.granularity,w.CesiumMath.RADIANS_PER_DEGREE),u=0,h=t.cartesianToCartographic(e[0],B),g=0;g<r-1;g++)c=t.cartesianToCartographic(e[g+1],U),u+=T.numberOfPointsRhumbLine(h,c,l),h=m.Cartographic.clone(c,B);var s=3*(u+1),f=new Array(s),C=0;for(g=0;g<r-1;g++)C=function(a,e,r,t,n,i,o,s){var a=t.cartesianToCartographic(a,G),e=t.cartesianToCartographic(e,I),c=T.numberOfPointsRhumbLine(a,e,r);a.height=0,e.height=0;var l=N(c,n,i);(O=!O.ellipsoid.equals(t)?new d.EllipsoidRhumbLine(void 0,void 0,t):O).setEndPoints(a,e);var u=O.surfaceDistance/c,h=s;a.height=n;var g=t.cartographicToCartesian(a,V);m.Cartesian3.pack(g,o,h),h+=3;for(var f=1;f<c;f++){var C=O.interpolateUsingSurfaceDistance(f*u,I);C.height=l[f],g=t.cartographicToCartesian(C,V),m.Cartesian3.pack(g,o,h),h+=3}return h}(e[g],e[g+1],l,t,i?n[g]:n,i?n[g+1]:n,f,C);x.length=0;a=e[r-1],a=t.cartesianToCartographic(a,G);a.height=i?n[r-1]:n;a=t.cartographicToCartesian(a,V);return m.Cartesian3.pack(a,f,s-3),f},T.generateCartesianArc=function(a){for(var e=T.generateArc(a),r=e.length/3,t=new Array(r),n=0;n<r;n++)t[n]=m.Cartesian3.unpack(e,3*n);return t},T.generateCartesianRhumbArc=function(a){for(var e=T.generateRhumbArc(a),r=e.length/3,t=new Array(r),n=0;n<r;n++)t[n]=m.Cartesian3.unpack(e,3*n);return t},a.PolylinePipeline=T});
|