qa-regulatory-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/PolylineVolumeGeometryLibra...

2 lines
7.5 KiB
JavaScript

define(["exports","./Cartesian2-bd414876","./Cartesian3-e0307675","./Matrix4-4c545f70","./EllipsoidTangentPlane-4d138901","./Math-e73894ab","./PolylinePipeline-0e56eeb9","./Transforms-5b829630","./defaultValue-81eec7ed","./Check-741c5f3c"],(function(e,a,t,n,r,i,s,o,l,c){"use strict";var C=Object.freeze({ROUNDED:0,MITERED:1,BEVELED:2});const u={};function d(e,a){l.defined(u[e])||(u[e]=!0,console.warn(l.defaultValue(a,e)))}d.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.",d.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored",d.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored",d.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";const g=[new t.Cartesian3,new t.Cartesian3],y=new t.Cartesian3,h=new t.Cartesian3,f=new t.Cartesian3,m=new t.Cartesian3,p=new t.Cartesian3,w=new t.Cartesian3,x=new t.Cartesian3,E=new t.Cartesian3,P=new t.Cartesian3,b=new t.Cartesian3,M=new t.Cartesian3,T={};let B=new a.Cartographic;function z(e,a,n,r){const i=e[0],s=e[1],o=t.Cartesian3.angleBetween(i,s),l=Math.ceil(o/r),c=new Array(l);let C;if(a===n){for(C=0;C<l;C++)c[C]=a;return c.push(n),c}const u=(n-a)/l;for(C=1;C<l;C++){const e=a+C*u;c[C]=e}return c[0]=a,c.push(n),c}const S=new t.Cartesian3,A=new t.Cartesian3;const D=new t.Cartesian3(-1,0,0);let R=new n.Matrix4;const O=new n.Matrix4;let V=new n.Matrix3;const I=n.Matrix3.IDENTITY.clone(),N=new t.Cartesian3,v=new n.Cartesian4,G=new t.Cartesian3;function H(e,i,s,l,c,C,u,d){let g=N,y=v;R=o.Transforms.eastNorthUpToFixedFrame(e,c,R),g=n.Matrix4.multiplyByPointAsVector(R,D,g),g=t.Cartesian3.normalize(g,g);const h=function(e,n,i,s){const o=new r.EllipsoidTangentPlane(i,s),l=o.projectPointOntoPlane(t.Cartesian3.add(i,e,S),S),c=o.projectPointOntoPlane(t.Cartesian3.add(i,n,A),A),C=a.Cartesian2.angleBetween(l,c);return c.x*l.y-c.y*l.x>=0?-C:C}(g,i,e,c);V=n.Matrix3.fromRotationZ(h,V),G.z=C,R=n.Matrix4.multiplyTransformation(R,n.Matrix4.fromRotationTranslation(V,G,O),R);const f=I;f[0]=u;for(let e=0;e<d;e++)for(let e=0;e<s.length;e+=3)y=t.Cartesian3.fromArray(s,e,y),y=n.Matrix3.multiplyByVector(f,y,y),y=n.Matrix4.multiplyByPoint(R,y,y),l.push(y.x,y.y,y.z);return l}const L=new t.Cartesian3;function j(e,a,n,r,i,s,o){for(let l=0;l<e.length;l+=3){r=H(t.Cartesian3.fromArray(e,l,L),a,n,r,i,s[l/3],o,1)}return r}function Q(e,a){const t=e.length,n=new Array(3*t);let r=0;const i=a.x+a.width/2,s=a.y+a.height/2;for(let a=0;a<t;a++)n[r++]=e[a].x-i,n[r++]=0,n[r++]=e[a].y-s;return n}const q=new o.Quaternion,F=new t.Cartesian3,U=new n.Matrix3;function _(e,a,r,s,l,c,u,d,g,y){const h=t.Cartesian3.angleBetween(t.Cartesian3.subtract(a,e,b),t.Cartesian3.subtract(r,e,M)),f=s===C.BEVELED?0:Math.ceil(h/i.CesiumMath.toRadians(5));let m,p,w;if(m=l?n.Matrix3.fromQuaternion(o.Quaternion.fromAxisAngle(t.Cartesian3.negate(e,b),h/(f+1),q),U):n.Matrix3.fromQuaternion(o.Quaternion.fromAxisAngle(e,h/(f+1),q),U),a=t.Cartesian3.clone(a,F),f>0){const r=y?2:1;for(let i=0;i<f;i++)a=n.Matrix3.multiplyByVector(m,a,a),p=t.Cartesian3.subtract(a,e,b),p=t.Cartesian3.normalize(p,p),l||(p=t.Cartesian3.negate(p,p)),w=c.scaleToGeodeticSurface(a,M),u=H(w,p,d,u,c,g,1,r)}else p=t.Cartesian3.subtract(a,e,b),p=t.Cartesian3.normalize(p,p),l||(p=t.Cartesian3.negate(p,p)),w=c.scaleToGeodeticSurface(a,M),u=H(w,p,d,u,c,g,1,1),r=t.Cartesian3.clone(r,F),p=t.Cartesian3.subtract(r,e,b),p=t.Cartesian3.normalize(p,p),l||(p=t.Cartesian3.negate(p,p)),w=c.scaleToGeodeticSurface(r,M),u=H(w,p,d,u,c,g,1,1);return u}T.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let r=t-1,i=0;i<t;r=i++){const t=e[r],s=e[i];a.Cartesian2.equals(t,s)||n.push(s)}return n},T.angleIsGreaterThanPi=function(e,a,n,i){const s=new r.EllipsoidTangentPlane(n,i),o=s.projectPointOntoPlane(t.Cartesian3.add(n,e,S),S),l=s.projectPointOntoPlane(t.Cartesian3.add(n,a,A),A);return l.x*o.y-l.y*o.x>=0};const Z=new t.Cartesian3,k=new t.Cartesian3;T.computePositions=function(e,a,n,r,o){const l=r._ellipsoid,c=function(e,a){const t=new Array(e.length);for(let n=0;n<e.length;n++){const r=e[n];B=a.cartesianToCartographic(r,B),t[n]=B.height,e[n]=a.scaleToGeodeticSurface(r,r)}return t}(e,l),u=r._granularity,M=r._cornerType,S=o?function(e,a){const t=e.length,n=new Array(6*t);let r=0;const i=a.x+a.width/2,s=a.y+a.height/2;let o=e[0];n[r++]=o.x-i,n[r++]=0,n[r++]=o.y-s;for(let a=1;a<t;a++){o=e[a];const t=o.x-i,l=o.y-s;n[r++]=t,n[r++]=0,n[r++]=l,n[r++]=t,n[r++]=0,n[r++]=l}return o=e[0],n[r++]=o.x-i,n[r++]=0,n[r++]=o.y-s,n}(a,n):Q(a,n),A=o?Q(a,n):void 0,D=n.height/2,R=n.width/2;let O=e.length,V=[],I=o?[]:void 0,N=y,v=h,G=f,L=m,q=p,F=w,U=x,W=E,Y=P,J=e[0],K=e[1];L=l.geodeticSurfaceNormal(J,L),N=t.Cartesian3.subtract(K,J,N),N=t.Cartesian3.normalize(N,N),W=t.Cartesian3.cross(L,N,W),W=t.Cartesian3.normalize(W,W);let X,$,ee=c[0],ae=c[1];o&&(I=H(J,W,A,I,l,ee+D,1,1)),Y=t.Cartesian3.clone(J,Y),J=K,v=t.Cartesian3.negate(N,v);for(let a=1;a<O-1;a++){const n=o?2:1;if(K=e[a+1],J.equals(K)){d("Positions are too close and are considered equivalent with rounding error.");continue}N=t.Cartesian3.subtract(K,J,N),N=t.Cartesian3.normalize(N,N),G=t.Cartesian3.add(N,v,G),G=t.Cartesian3.normalize(G,G),L=l.geodeticSurfaceNormal(J,L);const r=t.Cartesian3.multiplyByScalar(L,t.Cartesian3.dot(N,L),Z);t.Cartesian3.subtract(N,r,r),t.Cartesian3.normalize(r,r);const y=t.Cartesian3.multiplyByScalar(L,t.Cartesian3.dot(v,L),k);t.Cartesian3.subtract(v,y,y),t.Cartesian3.normalize(y,y);if(!i.CesiumMath.equalsEpsilon(Math.abs(t.Cartesian3.dot(r,y)),1,i.CesiumMath.EPSILON7)){G=t.Cartesian3.cross(G,L,G),G=t.Cartesian3.cross(L,G,G),G=t.Cartesian3.normalize(G,G);const e=1/Math.max(.25,t.Cartesian3.magnitude(t.Cartesian3.cross(G,v,b))),a=T.angleIsGreaterThanPi(N,v,J,l);a?(q=t.Cartesian3.add(J,t.Cartesian3.multiplyByScalar(G,e*R,G),q),F=t.Cartesian3.add(q,t.Cartesian3.multiplyByScalar(W,R,F),F),g[0]=t.Cartesian3.clone(Y,g[0]),g[1]=t.Cartesian3.clone(F,g[1]),X=z(g,ee+D,ae+D,u),$=s.PolylinePipeline.generateArc({positions:g,granularity:u,ellipsoid:l}),V=j($,W,S,V,l,X,1),W=t.Cartesian3.cross(L,N,W),W=t.Cartesian3.normalize(W,W),U=t.Cartesian3.add(q,t.Cartesian3.multiplyByScalar(W,R,U),U),M===C.ROUNDED||M===C.BEVELED?_(q,F,U,M,a,l,V,S,ae+D,o):(G=t.Cartesian3.negate(G,G),V=H(J,G,S,V,l,ae+D,e,n)),Y=t.Cartesian3.clone(U,Y)):(q=t.Cartesian3.add(J,t.Cartesian3.multiplyByScalar(G,e*R,G),q),F=t.Cartesian3.add(q,t.Cartesian3.multiplyByScalar(W,-R,F),F),g[0]=t.Cartesian3.clone(Y,g[0]),g[1]=t.Cartesian3.clone(F,g[1]),X=z(g,ee+D,ae+D,u),$=s.PolylinePipeline.generateArc({positions:g,granularity:u,ellipsoid:l}),V=j($,W,S,V,l,X,1),W=t.Cartesian3.cross(L,N,W),W=t.Cartesian3.normalize(W,W),U=t.Cartesian3.add(q,t.Cartesian3.multiplyByScalar(W,-R,U),U),M===C.ROUNDED||M===C.BEVELED?_(q,F,U,M,a,l,V,S,ae+D,o):V=H(J,G,S,V,l,ae+D,e,n),Y=t.Cartesian3.clone(U,Y)),v=t.Cartesian3.negate(N,v)}else V=H(Y,W,S,V,l,ee+D,1,1),Y=J;ee=ae,ae=c[a+1],J=K}g[0]=t.Cartesian3.clone(Y,g[0]),g[1]=t.Cartesian3.clone(J,g[1]),X=z(g,ee+D,ae+D,u),$=s.PolylinePipeline.generateArc({positions:g,granularity:u,ellipsoid:l}),V=j($,W,S,V,l,X,1),o&&(I=H(J,W,A,I,l,ae+D,1,1)),O=V.length;const te=o?O+I.length:O,ne=new Float64Array(te);return ne.set(V),o&&ne.set(I,O),ne},e.CornerType=C,e.PolylineVolumeGeometryLibrary=T,e.oneTimeWarning=d}));