Agriculture-front-end/public/Cesium/Workers/PolygonPipeline-660e1625.js
2023-04-16 22:33:44 +08:00

2 lines
4.9 KiB
JavaScript

define(["exports","./earcut-2.2.1-20c8012f","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./ComponentDatatype-c140a87d","./when-b60132fc","./EllipsoidRhumbLine-ed1a6bf4","./GeometryAttribute-3a88ba31","./Math-119be1a3","./PrimitiveType-a54dc62f","./WebGLConstants-4ae0db90"],(function(a,e,t,i,r,n,s,o,u,p,h,d){"use strict";var C={CLOCKWISE:d.WebGLConstants.CW,COUNTER_CLOCKWISE:d.WebGLConstants.CCW,NONE:d.WebGLConstants.NONE,validate:function(a){return a===C.CLOCKWISE||a===C.COUNTER_CLOCKWISE}},l=Object.freeze(C),m=new i.Cartesian3,c=new i.Cartesian3,y={computeArea2D:function(a){for(var e=a.length,t=0,i=e-1,r=0;r<e;i=r++){var n=a[i],s=a[r];t+=n.x*s.y-s.x*n.y}return.5*t},computeWindingOrder2D:function(a){return y.computeArea2D(a)>0?l.COUNTER_CLOCKWISE:l.CLOCKWISE},triangulate:function(a,i){var r=t.Cartesian2.packArray(a);return e.earcut(r,i,2)}},f=new i.Cartesian3,g=new i.Cartesian3,v=new i.Cartesian3,E=new i.Cartesian3,b=new i.Cartesian3,S=new i.Cartesian3,w=new i.Cartesian3;y.computeSubdivision=function(a,e,t,r,o){o=s.defaultValue(o,!1),r=s.defaultValue(r,p.CesiumMath.RADIANS_PER_DEGREE);var d,C=t.slice(0),l=e.length,m=new Array(3*l),c=0;for(d=0;d<l;d++){var y=e[d];m[c++]=y.x,m[c++]=y.y,m[c++]=y.z}for(var A=[],x={},L=a.maximumRadius,R=p.CesiumMath.chordLength(r,L),M=R*R;C.length>0;){var D,G,O=C.pop(),T=C.pop(),W=C.pop(),z=i.Cartesian3.fromArray(m,3*W,f),N=i.Cartesian3.fromArray(m,3*T,g),P=i.Cartesian3.fromArray(m,3*O,v),I=o?z:i.Cartesian3.multiplyByScalar(i.Cartesian3.normalize(z,E),L,E),B=o?N:i.Cartesian3.multiplyByScalar(i.Cartesian3.normalize(N,b),L,b),U=o?P:i.Cartesian3.multiplyByScalar(i.Cartesian3.normalize(P,S),L,S),_=i.Cartesian3.magnitudeSquared(i.Cartesian3.subtract(I,B,w)),K=i.Cartesian3.magnitudeSquared(i.Cartesian3.subtract(B,U,w)),V=i.Cartesian3.magnitudeSquared(i.Cartesian3.subtract(U,I,w)),q=Math.max(_,K,V);q>M?_===q?(d=x[D=Math.min(W,T)+" "+Math.max(W,T)],s.defined(d)||(G=i.Cartesian3.add(z,N,w),i.Cartesian3.multiplyByScalar(G,.5,G),m.push(G.x,G.y,G.z),d=m.length/3-1,x[D]=d),C.push(W,d,O),C.push(d,T,O)):K===q?(d=x[D=Math.min(T,O)+" "+Math.max(T,O)],s.defined(d)||(G=i.Cartesian3.add(N,P,w),i.Cartesian3.multiplyByScalar(G,.5,G),m.push(G.x,G.y,G.z),d=m.length/3-1,x[D]=d),C.push(T,d,W),C.push(d,O,W)):V===q&&(d=x[D=Math.min(O,W)+" "+Math.max(O,W)],s.defined(d)||(G=i.Cartesian3.add(P,z,w),i.Cartesian3.multiplyByScalar(G,.5,G),m.push(G.x,G.y,G.z),d=m.length/3-1,x[D]=d),C.push(O,d,T),C.push(d,W,T)):(A.push(W),A.push(T),A.push(O))}return new u.Geometry({attributes:{position:new u.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:m})},indices:A,primitiveType:h.PrimitiveType.TRIANGLES})};var A=new i.Cartographic,x=new i.Cartographic,L=new i.Cartographic,R=new i.Cartographic;y.computeRhumbLineSubdivision=function(a,e,t,r){r=s.defaultValue(r,p.CesiumMath.RADIANS_PER_DEGREE);var d,C=t.slice(0),l=e.length,m=new Array(3*l),c=0;for(d=0;d<l;d++){var y=e[d];m[c++]=y.x,m[c++]=y.y,m[c++]=y.z}for(var E=[],b={},S=a.maximumRadius,M=p.CesiumMath.chordLength(r,S),D=new o.EllipsoidRhumbLine(void 0,void 0,a),G=new o.EllipsoidRhumbLine(void 0,void 0,a),O=new o.EllipsoidRhumbLine(void 0,void 0,a);C.length>0;){var T=C.pop(),W=C.pop(),z=C.pop(),N=i.Cartesian3.fromArray(m,3*z,f),P=i.Cartesian3.fromArray(m,3*W,g),I=i.Cartesian3.fromArray(m,3*T,v),B=a.cartesianToCartographic(N,A),U=a.cartesianToCartographic(P,x),_=a.cartesianToCartographic(I,L);D.setEndPoints(B,U);var K=D.surfaceDistance;G.setEndPoints(U,_);var V=G.surfaceDistance;O.setEndPoints(_,B);var q,F,k,j,H=O.surfaceDistance,J=Math.max(K,V,H);J>M?K===J?(d=b[q=Math.min(z,W)+" "+Math.max(z,W)],s.defined(d)||(F=D.interpolateUsingFraction(.5,R),k=.5*(B.height+U.height),j=i.Cartesian3.fromRadians(F.longitude,F.latitude,k,a,w),m.push(j.x,j.y,j.z),d=m.length/3-1,b[q]=d),C.push(z,d,T),C.push(d,W,T)):V===J?(d=b[q=Math.min(W,T)+" "+Math.max(W,T)],s.defined(d)||(F=G.interpolateUsingFraction(.5,R),k=.5*(U.height+_.height),j=i.Cartesian3.fromRadians(F.longitude,F.latitude,k,a,w),m.push(j.x,j.y,j.z),d=m.length/3-1,b[q]=d),C.push(W,d,z),C.push(d,T,z)):H===J&&(d=b[q=Math.min(T,z)+" "+Math.max(T,z)],s.defined(d)||(F=O.interpolateUsingFraction(.5,R),k=.5*(_.height+B.height),j=i.Cartesian3.fromRadians(F.longitude,F.latitude,k,a,w),m.push(j.x,j.y,j.z),d=m.length/3-1,b[q]=d),C.push(T,d,W),C.push(d,z,W)):(E.push(z),E.push(W),E.push(T))}return new u.Geometry({attributes:{position:new u.GeometryAttribute({componentDatatype:n.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:m})},indices:E,primitiveType:h.PrimitiveType.TRIANGLES})},y.scaleToGeodeticHeight=function(a,e,r,n){r=s.defaultValue(r,t.Ellipsoid.WGS84);var o=m,u=c;if(e=s.defaultValue(e,0),n=s.defaultValue(n,!0),s.defined(a))for(var p=a.length,h=0;h<p;h+=3)i.Cartesian3.fromArray(a,h,u),n&&(u=r.scaleToGeodeticSurface(u,u)),0!==e&&(o=r.geodeticSurfaceNormal(u,o),i.Cartesian3.multiplyByScalar(o,e,o),i.Cartesian3.add(u,o,u)),a[h]=u.x,a[h+1]=u.y,a[h+2]=u.z;return a},a.PolygonPipeline=y,a.WindingOrder=l}));