Agriculture-front-end/dist/Cesium/Workers/PolylineVolumeGeometryLibrary-3333255c.js
2023-09-11 21:56:39 +08:00

2 lines
9.9 KiB
JavaScript

define(["exports","./Cartesian2-47311507","./Cartographic-3309dd0d","./Cartesian4-3ca25aab","./EllipsoidTangentPlane-b2b18d75","./Math-119be1a3","./BoundingSphere-561b54d0","./PolylinePipeline-971d8853","./Transforms-cb0006b0"],(function(a,e,r,n,t,i,s,o,l){"use strict";var C=Object.freeze({ROUNDED:0,MITERED:1,BEVELED:2}),c=[new r.Cartesian3,new r.Cartesian3],u=new r.Cartesian3,y=new r.Cartesian3,m=new r.Cartesian3,d=new r.Cartesian3,p=new r.Cartesian3,g=new r.Cartesian3,f=new r.Cartesian3,h=new r.Cartesian3,v=new r.Cartesian3,w=new r.Cartesian3,x=new r.Cartesian3,M={},P=new r.Cartographic;function E(a,e){for(var r=new Array(a.length),n=0;n<a.length;n++){var t=a[n];P=e.cartesianToCartographic(t,P),r[n]=P.height,a[n]=e.scaleToGeodeticSurface(t,t)}return r}function B(a,e,n,t){var i,s=a[0],o=a[1],l=r.Cartesian3.angleBetween(s,o),C=Math.ceil(l/t),c=new Array(C);if(e===n){for(i=0;i<C;i++)c[i]=e;return c.push(n),c}var u=(n-e)/C;for(i=1;i<C;i++){var y=e+i*u;c[i]=y}return c[0]=e,c.push(n),c}var T=new r.Cartesian3,z=new r.Cartesian3;function S(a,n,i,s){var o=new t.EllipsoidTangentPlane(i,s),l=o.projectPointOntoPlane(r.Cartesian3.add(i,a,T),T),C=o.projectPointOntoPlane(r.Cartesian3.add(i,n,z),z),c=e.Cartesian2.angleBetween(l,C);return C.x*l.y-C.y*l.x>=0?-c:c}var b=new r.Cartesian3(-1,0,0),A=s.Matrix4.clone(s.Matrix4.IDENTITY),D=new s.Matrix4,N=new s.Matrix3,O=s.Matrix3.IDENTITY.clone(),V=new r.Cartesian3,R=new n.Cartesian4,I=new r.Cartesian3;function L(a,e,n,t,i,o,C,c){var u=V,y=R;A=l.Transforms.eastNorthUpToFixedFrame(a,i,A),u=s.Matrix4.multiplyByPointAsVector(A,b,u);var m=S(u=r.Cartesian3.normalize(u,u),e,a,i);N=s.Matrix3.fromRotationZ(m,N),I.z=o,A=s.Matrix4.multiplyTransformation(A,s.Matrix4.fromRotationTranslation(N,I,D),A);var d=O;d[0]=C;for(var p=0;p<c;p++)for(var g=0;g<n.length;g+=3)y=r.Cartesian3.fromArray(n,g,y),y=s.Matrix3.multiplyByVector(d,y,y),y=s.Matrix4.multiplyByPoint(A,y,y),t.push(y.x,y.y,y.z);return t}function F(a,e,n,t,i,o,C,c,u){var y=V,m=R;A=l.Transforms.eastNorthUpToFixedFrame(a,i,A),y=s.Matrix4.multiplyByPointAsVector(A,b,y);var d=S(y=r.Cartesian3.normalize(y,y),e,a,i);N=s.Matrix3.fromRotationZ(d,N),I.z=o,A=s.Matrix4.multiplyTransformation(A,s.Matrix4.fromRotationTranslation(N,I,D),A);var p=O;p[0]=C;for(var g=0;g<c;g++)for(var f=0;f<n.length;f+=3)m=r.Cartesian3.fromArray(n,f,m),m=s.Matrix3.multiplyByVector(p,m,m),m=s.Matrix4.multiplyByPoint(A,m,m),m=s.Matrix4.multiplyByPoint(u,m,m),t.push(m.x,m.y,m.z);return t}var G=new r.Cartesian3;function U(a,e,n,t,i,s,o){for(var l=0;l<a.length;l+=3){t=L(r.Cartesian3.fromArray(a,l,G),e,n,t,i,s[l/3],o,1)}return t}function _(a,e){var r=a.length,n=new Array(6*r),t=0,i=e.x+e.width/2,s=e.y+e.height/2,o=a[0];n[t++]=o.x-i,n[t++]=0,n[t++]=o.y-s;for(var l=1;l<r;l++){var C=(o=a[l]).x-i,c=o.y-s;n[t++]=C,n[t++]=0,n[t++]=c,n[t++]=C,n[t++]=0,n[t++]=c}return o=a[0],n[t++]=o.x-i,n[t++]=0,n[t++]=o.y-s,n}function j(a,e){for(var r=a.length,n=new Array(3*r),t=0,i=e.x+e.width/2,s=e.y+e.height/2,o=0;o<r;o++)n[t++]=a[o].x-i,n[t++]=0,n[t++]=a[o].y-s;return n}var Q=new l.Quaternion,q=new r.Cartesian3,Y=new s.Matrix3;function Z(a,e,n,t,o,c,u,y,m,d){var p,g,f=r.Cartesian3.angleBetween(r.Cartesian3.subtract(e,a,w),r.Cartesian3.subtract(n,a,x)),h=t===C.BEVELED?0:Math.ceil(f/i.CesiumMath.toRadians(5));if(p=o?s.Matrix3.fromQuaternion(l.Quaternion.fromAxisAngle(r.Cartesian3.negate(a,w),f/(h+1),Q),Y):s.Matrix3.fromQuaternion(l.Quaternion.fromAxisAngle(a,f/(h+1),Q),Y),e=r.Cartesian3.clone(e,q),h>0)for(var v=d?2:1,M=0;M<h;M++)e=s.Matrix3.multiplyByVector(p,e,e),g=r.Cartesian3.subtract(e,a,w),g=r.Cartesian3.normalize(g,g),o||(g=r.Cartesian3.negate(g,g)),u=L(c.scaleToGeodeticSurface(e,x),g,y,u,c,m,1,v);else g=r.Cartesian3.subtract(e,a,w),g=r.Cartesian3.normalize(g,g),o||(g=r.Cartesian3.negate(g,g)),u=L(c.scaleToGeodeticSurface(e,x),g,y,u,c,m,1,1),n=r.Cartesian3.clone(n,q),g=r.Cartesian3.subtract(n,a,w),g=r.Cartesian3.normalize(g,g),o||(g=r.Cartesian3.negate(g,g)),u=L(c.scaleToGeodeticSurface(n,x),g,y,u,c,m,1,1);return u}M.removeDuplicatesFromShape=function(a){for(var r=a.length,n=[],t=r-1,i=0;i<r;t=i++){var s=a[t],o=a[i];e.Cartesian2.equals(s,o)||n.push(o)}return n},M.angleIsGreaterThanPi=function(a,e,n,i){var s=new t.EllipsoidTangentPlane(n,i),o=s.projectPointOntoPlane(r.Cartesian3.add(n,a,T),T),l=s.projectPointOntoPlane(r.Cartesian3.add(n,e,z),z);return l.x*o.y-l.y*o.x>=0};var k=new r.Cartesian3,H=new r.Cartesian3;M.computePositions=function(a,e,n,t,s){var l=t._ellipsoid,x=E(a,l),P=t._granularity,T=t._cornerType,z=s?_(e,n):j(e,n),S=s?j(e,n):void 0,b=n.height/2,A=n.width/2,D=a.length,N=[],O=s?[]:void 0,V=u,R=y,I=m,F=d,G=p,Q=g,q=f,Y=h,J=v,K=a[0],W=a[1];F=l.geodeticSurfaceNormal(K,F),V=r.Cartesian3.subtract(W,K,V),V=r.Cartesian3.normalize(V,V),Y=r.Cartesian3.cross(F,V,Y),Y=r.Cartesian3.normalize(Y,Y);var X,$=x[0],aa=x[1];s&&(O=L(K,Y,S,O,l,$+b,1,1)),J=r.Cartesian3.clone(K,J),K=W,R=r.Cartesian3.negate(V,R);for(var ea=1;ea<D-1;ea++){var ra=s?2:1;W=a[ea+1],V=r.Cartesian3.subtract(W,K,V),V=r.Cartesian3.normalize(V,V),I=r.Cartesian3.add(V,R,I),I=r.Cartesian3.normalize(I,I),F=l.geodeticSurfaceNormal(K,F);var na=r.Cartesian3.multiplyByScalar(F,r.Cartesian3.dot(V,F),k);r.Cartesian3.subtract(V,na,na),r.Cartesian3.normalize(na,na);var ta=r.Cartesian3.multiplyByScalar(F,r.Cartesian3.dot(R,F),H);if(r.Cartesian3.subtract(R,ta,ta),r.Cartesian3.normalize(ta,ta),!i.CesiumMath.equalsEpsilon(Math.abs(r.Cartesian3.dot(na,ta)),1,i.CesiumMath.EPSILON7)){I=r.Cartesian3.cross(I,F,I),I=r.Cartesian3.cross(F,I,I),I=r.Cartesian3.normalize(I,I);var ia=1/Math.max(.25,r.Cartesian3.magnitude(r.Cartesian3.cross(I,R,w))),sa=M.angleIsGreaterThanPi(V,R,K,l);sa?(G=r.Cartesian3.add(K,r.Cartesian3.multiplyByScalar(I,ia*A,I),G),Q=r.Cartesian3.add(G,r.Cartesian3.multiplyByScalar(Y,A,Q),Q),c[0]=r.Cartesian3.clone(J,c[0]),c[1]=r.Cartesian3.clone(Q,c[1]),X=B(c,$+b,aa+b,P),N=U(o.PolylinePipeline.generateArc({positions:c,granularity:P,ellipsoid:l}),Y,z,N,l,X,1),Y=r.Cartesian3.cross(F,V,Y),Y=r.Cartesian3.normalize(Y,Y),q=r.Cartesian3.add(G,r.Cartesian3.multiplyByScalar(Y,A,q),q),T===C.ROUNDED||T===C.BEVELED?Z(G,Q,q,T,sa,l,N,z,aa+b,s):N=L(K,I=r.Cartesian3.negate(I,I),z,N,l,aa+b,ia,ra),J=r.Cartesian3.clone(q,J)):(G=r.Cartesian3.add(K,r.Cartesian3.multiplyByScalar(I,ia*A,I),G),Q=r.Cartesian3.add(G,r.Cartesian3.multiplyByScalar(Y,-A,Q),Q),c[0]=r.Cartesian3.clone(J,c[0]),c[1]=r.Cartesian3.clone(Q,c[1]),X=B(c,$+b,aa+b,P),N=U(o.PolylinePipeline.generateArc({positions:c,granularity:P,ellipsoid:l}),Y,z,N,l,X,1),Y=r.Cartesian3.cross(F,V,Y),Y=r.Cartesian3.normalize(Y,Y),q=r.Cartesian3.add(G,r.Cartesian3.multiplyByScalar(Y,-A,q),q),T===C.ROUNDED||T===C.BEVELED?Z(G,Q,q,T,sa,l,N,z,aa+b,s):N=L(K,I,z,N,l,aa+b,ia,ra),J=r.Cartesian3.clone(q,J)),R=r.Cartesian3.negate(V,R)}else N=L(J,Y,z,N,l,$+b,1,1),J=K;$=aa,aa=x[ea+1],K=W}c[0]=r.Cartesian3.clone(J,c[0]),c[1]=r.Cartesian3.clone(K,c[1]),X=B(c,$+b,aa+b,P),N=U(o.PolylinePipeline.generateArc({positions:c,granularity:P,ellipsoid:l}),Y,z,N,l,X,1),s&&(O=L(K,Y,S,O,l,aa+b,1,1)),D=N.length;var oa=s?D+O.length:D,la=new Float64Array(oa);return la.set(N),s&&la.set(O,D),la},M.computeLocalPositions=function(a,e,n,t,x,P){var T=t._ellipsoid,z=E(a,T),S=t._granularity,b=t._cornerType,A=x?_(e,n):j(e,n),D=x?j(e,n):void 0,N=n.width/2,O=a.length,V=[],R=x?[]:void 0,I=u,L=y,Q=m,q=d,Y=p,J=g,K=f,W=h,X=v,$=l.Transforms.eastNorthUpToFixedFrame(P,T,new s.Matrix4),aa=s.Matrix4.inverse($,new s.Matrix4),ea=a[0],ra=a[1];q=T.geodeticSurfaceNormal(ea,q),I=r.Cartesian3.subtract(ra,ea,I),I=r.Cartesian3.normalize(I,I),W=r.Cartesian3.cross(q,I,W),W=r.Cartesian3.normalize(W,W);var na,ta=z[0],ia=z[1];x&&(R=F(ea,W,D,R,T,ta+0,1,1,aa)),X=r.Cartesian3.clone(ea,X),ea=ra,L=r.Cartesian3.negate(I,L);for(var sa=1;sa<O-1;sa++){var oa=x?2:1;ra=a[sa+1],I=r.Cartesian3.subtract(ra,ea,I),I=r.Cartesian3.normalize(I,I),Q=r.Cartesian3.add(I,L,Q),Q=r.Cartesian3.normalize(Q,Q),q=T.geodeticSurfaceNormal(ea,q);var la=r.Cartesian3.multiplyByScalar(q,r.Cartesian3.dot(I,q),k);r.Cartesian3.subtract(I,la,la),r.Cartesian3.normalize(la,la);var Ca=r.Cartesian3.multiplyByScalar(q,r.Cartesian3.dot(L,q),H);if(r.Cartesian3.subtract(L,Ca,Ca),r.Cartesian3.normalize(Ca,Ca),!i.CesiumMath.equalsEpsilon(Math.abs(r.Cartesian3.dot(la,Ca)),1,i.CesiumMath.EPSILON7)){Q=r.Cartesian3.cross(Q,q,Q),Q=r.Cartesian3.cross(q,Q,Q),Q=r.Cartesian3.normalize(Q,Q);var ca=1/Math.max(.25,r.Cartesian3.magnitude(r.Cartesian3.cross(Q,L,w))),ua=M.angleIsGreaterThanPi(I,L,ea,T);ua?(Y=r.Cartesian3.add(ea,r.Cartesian3.multiplyByScalar(Q,ca*N,Q),Y),J=r.Cartesian3.add(Y,r.Cartesian3.multiplyByScalar(W,N,J),J),c[0]=r.Cartesian3.clone(X,c[0]),c[1]=r.Cartesian3.clone(J,c[1]),na=B(c,ta+0,ia+0,S),V=U(o.PolylinePipeline.generateArc({positions:c,granularity:S,ellipsoid:T}),W,A,V,T,na,1,fromEnu),W=r.Cartesian3.cross(q,I,W),W=r.Cartesian3.normalize(W,W),K=r.Cartesian3.add(Y,r.Cartesian3.multiplyByScalar(W,N,K),K),b===C.ROUNDED||b===C.BEVELED?Z(Y,J,K,b,ua,T,V,A,ia+0,x):V=F(ea,Q=r.Cartesian3.negate(Q,Q),A,V,T,ia+0,ca,oa,aa),X=r.Cartesian3.clone(K,X)):(Y=r.Cartesian3.add(ea,r.Cartesian3.multiplyByScalar(Q,ca*N,Q),Y),J=r.Cartesian3.add(Y,r.Cartesian3.multiplyByScalar(W,-N,J),J),c[0]=r.Cartesian3.clone(X,c[0]),c[1]=r.Cartesian3.clone(J,c[1]),na=B(c,ta+0,ia+0,S),V=U(o.PolylinePipeline.generateArc({positions:c,granularity:S,ellipsoid:T}),W,A,V,T,na,1),W=r.Cartesian3.cross(q,I,W),W=r.Cartesian3.normalize(W,W),K=r.Cartesian3.add(Y,r.Cartesian3.multiplyByScalar(W,-N,K),K),b===C.ROUNDED||b===C.BEVELED?Z(Y,J,K,b,ua,T,V,A,ia+0,x):V=F(ea,Q,A,V,T,ia+0,ca,oa,aa),X=r.Cartesian3.clone(K,X)),L=r.Cartesian3.negate(I,L)}else V=F(X,W,A,V,T,ta+0,1,1,aa),X=ea;ta=ia,ia=z[sa+1],ea=ra}c[0]=r.Cartesian3.clone(X,c[0]),c[1]=r.Cartesian3.clone(ea,c[1]),na=B(c,ta+0,ia+0,S),V=function(a,e,n,t,i,s,o,l){for(var C=0;C<a.length;C+=3)t=F(r.Cartesian3.fromArray(a,C,G),e,n,t,i,s[C/3],o,1,l);return t}(o.PolylinePipeline.generateArc({positions:c,granularity:S,ellipsoid:T}),W,A,V,T,na,1,aa),x&&(R=F(ea,W,D,R,T,ia+0,1,1,aa)),O=V.length;var ya=x?O+R.length:O,ma=new Float64Array(ya);return ma.set(V),x&&ma.set(R,O),ma},a.CornerType=C,a.PolylineVolumeGeometryLibrary=M}));