qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/PolylinePipeline-0e56eeb9.js

2 lines
5.3 KiB
JavaScript
Raw Normal View History

2024-01-02 14:12:39 +08:00
define(["exports","./Cartesian3-e0307675","./Cartesian2-bd414876","./defaultValue-81eec7ed","./Check-741c5f3c","./EllipsoidGeodesic-e7a5ca44","./EllipsoidRhumbLine-592e8885","./IntersectionTests-80510c7b","./Math-e73894ab","./Matrix4-4c545f70","./Plane-bc8b6777"],(function(e,t,a,n,i,r,o,s,c,l,u){"use strict";const h={numberOfPoints:function(e,a,n){const i=t.Cartesian3.distance(e,a);return Math.ceil(i/n)},numberOfPointsRhumbLine:function(e,t,a){const n=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(n/(a*a))))}},f=new a.Cartographic;h.extractHeights=function(e,t){const a=e.length,n=new Array(a);for(let i=0;i<a;i++){const a=e[i];n[i]=t.cartesianToCartographic(a,f).height}return n};const g=new l.Matrix4,C=new t.Cartesian3,p=new t.Cartesian3,d=new u.Plane(t.Cartesian3.UNIT_X,0),m=new t.Cartesian3,w=new u.Plane(t.Cartesian3.UNIT_X,0),P=new t.Cartesian3,T=new t.Cartesian3,y=[];function A(e,t,a){const n=y;let i;if(n.length=e,t===a){for(i=0;i<e;i++)n[i]=t;return n}const r=(a-t)/e;for(i=0;i<e;i++){const e=t+i*r;n[i]=e}return n}const b=new a.Cartographic,E=new a.Cartographic,M=new t.Cartesian3,R=new t.Cartesian3,S=new t.Cartesian3,x=new r.EllipsoidGeodesic;let D=new o.EllipsoidRhumbLine;function N(e,a,n,i,r,o,s,c){const l=i.scaleToGeodeticSurface(e,R),u=i.scaleToGeodeticSurface(a,S),f=h.numberOfPoints(e,a,n),g=i.cartesianToCartographic(l,b),C=i.cartesianToCartographic(u,E),p=A(f,r,o);x.setEndPoints(g,C);const d=x.surfaceDistance/f;let m=c;g.height=r;let w=i.cartographicToCartesian(g,M);t.Cartesian3.pack(w,s,m),m+=3;for(let e=1;e<f;e++){const a=x.interpolateUsingSurfaceDistance(e*d,E);a.height=p[e],w=i.cartographicToCartesian(a,M),t.Cartesian3.pack(w,s,m),m+=3}return m}function G(e,a,n,i,r,s,c,l){const u=i.cartesianToCartographic(e,b),f=i.cartesianToCartographic(a,E),g=h.numberOfPointsRhumbLine(u,f,n);u.height=0,f.height=0;const C=A(g,r,s);D.ellipsoid.equals(i)||(D=new o.EllipsoidRhumbLine(void 0,void 0,i)),D.setEndPoints(u,f);const p=D.surfaceDistance/g;let d=l;u.height=r;let m=i.cartographicToCartesian(u,M);t.Cartesian3.pack(m,c,d),d+=3;for(let e=1;e<g;e++){const a=D.interpolateUsingSurfaceDistance(e*p,E);a.height=C[e],m=i.cartographicToCartesian(a,M),t.Cartesian3.pack(m,c,d),d+=3}return d}h.wrapLongitude=function(e,a){const i=[],r=[];if(n.defined(e)&&e.length>0){a=n.defaultValue(a,l.Matrix4.IDENTITY);const o=l.Matrix4.inverseTransformation(a,g),c=l.Matrix4.multiplyByPoint(o,t.Cartesian3.ZERO,C),h=t.Cartesian3.normalize(l.Matrix4.multiplyByPointAsVector(o,t.Cartesian3.UNIT_Y,p),p),f=u.Plane.fromPointNormal(c,h,d),y=t.Cartesian3.normalize(l.Matrix4.multiplyByPointAsVector(o,t.Cartesian3.UNIT_X,m),m),A=u.Plane.fromPointNormal(c,y,w);let b=1;i.push(t.Cartesian3.clone(e[0]));let E=i[0];const M=e.length;for(let a=1;a<M;++a){const o=e[a];if(u.Plane.getPointDistance(A,E)<0||u.Plane.getPointDistance(A,o)<0){const e=s.IntersectionTests.lineSegmentPlane(E,o,f,P);if(n.defined(e)){const a=t.Cartesian3.multiplyByScalar(h,5e-9,T);u.Plane.getPointDistance(f,E)<0&&t.Cartesian3.negate(a,a),i.push(t.Cartesian3.add(e,a,new t.Cartesian3)),r.push(b+1),t.Cartesian3.negate(a,a),i.push(t.Cartesian3.add(e,a,new t.Cartesian3)),b=1}}i.push(t.Cartesian3.clone(e[a])),b++,E=o}r.push(b)}return{positions:i,lengths:r}},h.generateArc=function(e){n.defined(e)||(e={});const i=e.positions,r=i.length,o=n.defaultValue(e.ellipsoid,a.Ellipsoid.WGS84);let s=n.defaultValue(e.height,0);const l=Array.isArray(s);if(r<1)return[];if(1===r){const e=o.scaleToGeodeticSurface(i[0],R);if(s=l?s[0]:s,0!==s){const a=o.geodeticSurfaceNormal(e,M);t.Cartesian3.multiplyByScalar(a,s,a),t.Cartesian3.add(e,a,e)}return[e.x,e.y,e.z]}let u=e.minDistance;if(!n.defined(u)){const t=n.defaultValue(e.granularity,c.CesiumMath.RADIANS_PER_DEGREE);u=c.CesiumMath.chordLength(t,o.maximumRadius)}let f,g=0;for(f=0;f<r-1;f++)g+=h.numberOfPoints(i[f],i[f+1],u);const C=3*(g+1),p=new Array(C);let d=0;for(f=0;f<r-1;f++){d=N(i[f],i[f+1],u,o,l?s[f]:s,l?s[f+1]:s,p,d)}y.length=0;const m=i[r-1],w=o.cartesianToCartographic(m,b);w.height=l?s[r-1]:s;const P=o