qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/PolygonPipeline-04baeb41.js

2 lines
11 KiB
JavaScript

define(["exports","./Cartesian2-bd414876","./Cartesian3-e0307675","./Check-741c5f3c","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./EllipsoidRhumbLine-592e8885","./GeometryAttribute-2b42a913","./Math-e73894ab","./WebGLConstants-508b9636"],(function(e,t,n,r,i,a,u,x,o,s){"use strict";var p=h,l=h;function h(e,t,n){n=n||2;var r,i,a,u,x,o,s,p=t&&t.length,l=p?t[0]*n:e.length,h=f(e,0,l,n,!0),v=[];if(!h||h.next===h.prev)return v;if(p&&(h=function(e,t,n,r){var i,a,u,x=[];for(i=0,a=t.length;i<a;i++)(u=f(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===u.next&&(u.steiner=!0),x.push(M(u));for(x.sort(g),i=0;i<x.length;i++)n=y(n=w(x[i],n),n.next);return n}(e,t,h,n)),e.length>80*n){r=a=e[0],i=u=e[1];for(var d=n;d<l;d+=n)(x=e[d])<r&&(r=x),(o=e[d+1])<i&&(i=o),x>a&&(a=x),o>u&&(u=o);s=0!==(s=Math.max(a-r,u-i))?1/s:0}return c(h,v,n,r,i,s),v}function f(e,t,n,r,i){var a,u;if(i===P(e,t,n,r)>0)for(a=t;a<n;a+=r)u=T(a,e[a],e[a+1],u);else for(a=n-r;a>=t;a-=r)u=T(a,e[a],e[a+1],u);return u&&z(u,u.next)&&(W(u),u=u.next),u}function y(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!z(r,r.next)&&0!==A(r.prev,r,r.next))r=r.next;else{if(W(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function c(e,t,n,r,i,a,u){if(e){!u&&a&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=E(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,u,x,o,s=1;do{for(n=e,e=null,a=null,u=0;n;){for(u++,r=n,x=0,t=0;t<s&&(x++,r=r.nextZ);t++);for(o=s;x>0||o>0&&r;)0!==x&&(0===o||!r||n.z<=r.z)?(i=n,n=n.nextZ,x--):(i=r,r=r.nextZ,o--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,s*=2}while(u>1)}(i)}(e,r,i,a);for(var x,o,s=e;e.prev!==e.next;)if(x=e.prev,o=e.next,a?d(e,r,i,a):v(e))t.push(x.i/n),t.push(e.i/n),t.push(o.i/n),W(e),e=o.next,s=o.next;else if((e=o)===s){u?1===u?c(e=m(y(e),t,n),t,n,r,i,a,2):2===u&&C(e,t,n,r,i,a):c(y(e),t,n,r,i,a,1);break}}}function v(e){var t=e.prev,n=e,r=e.next;if(A(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Z(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&A(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function d(e,t,n,r){var i=e.prev,a=e,u=e.next;if(A(i,a,u)>=0)return!1;for(var x=i.x<a.x?i.x<u.x?i.x:u.x:a.x<u.x?a.x:u.x,o=i.y<a.y?i.y<u.y?i.y:u.y:a.y<u.y?a.y:u.y,s=i.x>a.x?i.x>u.x?i.x:u.x:a.x>u.x?a.x:u.x,p=i.y>a.y?i.y>u.y?i.y:u.y:a.y>u.y?a.y:u.y,l=E(x,o,t,n,r),h=E(s,p,t,n,r),f=e.prevZ,y=e.nextZ;f&&f.z>=l&&y&&y.z<=h;){if(f!==e.prev&&f!==e.next&&Z(i.x,i.y,a.x,a.y,u.x,u.y,f.x,f.y)&&A(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,y!==e.prev&&y!==e.next&&Z(i.x,i.y,a.x,a.y,u.x,u.y,y.x,y.y)&&A(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;f&&f.z>=l;){if(f!==e.prev&&f!==e.next&&Z(i.x,i.y,a.x,a.y,u.x,u.y,f.x,f.y)&&A(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;y&&y.z<=h;){if(y!==e.prev&&y!==e.next&&Z(i.x,i.y,a.x,a.y,u.x,u.y,y.x,y.y)&&A(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function m(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!z(i,a)&&R(i,r,r.next,a)&&G(i,a)&&G(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),W(r),W(r.next),r=e=a),r=r.next}while(r!==e);return y(r)}function C(e,t,n,r,i,a){var u=e;do{for(var x=u.next.next;x!==u.prev;){if(u.i!==x.i&&S(u,x)){var o=O(u,x);return u=y(u,u.next),o=y(o,o.next),c(u,t,n,r,i,a),void c(o,t,n,r,i,a)}x=x.next}u=u.next}while(u!==e)}function g(e,t){return e.x-t.x}function w(e,t){var n=function(e,t){var n,r=t,i=e.x,a=e.y,u=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var x=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(x<=i&&x>u){if(u=x,x===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===u)return n;var o,s=n,p=n.x,l=n.y,h=1/0;r=n;do{i>=r.x&&r.x>=p&&i!==r.x&&Z(a<l?i:u,a,p,l,a<l?u:i,a,r.x,r.y)&&(o=Math.abs(a-r.y)/(i-r.x),G(r,e)&&(o<h||o===h&&(r.x>n.x||r.x===n.x&&b(n,r)))&&(n=r,h=o)),r=r.next}while(r!==s);return n}(e,t);if(!n)return t;var r=O(n,e),i=y(n,n.next);return y(r,r.next),t===n?i:t}function b(e,t){return A(e.prev,e,t.prev)<0&&A(t.next,e,e.next)<0}function E(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function M(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function Z(e,t,n,r,i,a,u,x){return(i-u)*(t-x)-(e-u)*(a-x)>=0&&(e-u)*(r-x)-(n-u)*(t-x)>=0&&(n-u)*(a-x)-(i-u)*(r-x)>=0}function S(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&R(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(G(e,t)&&G(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(A(e.prev,e,t.prev)||A(e,t.prev,t))||z(e,t)&&A(e.prev,e,e.next)>0&&A(t.prev,t,t.next)>0)}function A(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function z(e,t){return e.x===t.x&&e.y===t.y}function R(e,t,n,r){var i=D(A(e,t,n)),a=D(A(e,t,r)),u=D(A(n,r,e)),x=D(A(n,r,t));return i!==a&&u!==x||(!(0!==i||!L(e,n,t))||(!(0!==a||!L(e,r,t))||(!(0!==u||!L(n,e,r))||!(0!==x||!L(n,t,r)))))}function L(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function D(e){return e>0?1:e<0?-1:0}function G(e,t){return A(e.prev,e,e.next)<0?A(e,t,e.next)>=0&&A(e,e.prev,t)>=0:A(e,t,e.prev)<0||A(e,e.next,t)<0}function O(e,t){var n=new $(e.i,e.x,e.y),r=new $(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function T(e,t,n,r){var i=new $(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function W(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function $(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function P(e,t,n,r){for(var i=0,a=t,u=n-r;a<n;a+=r)i+=(e[u]-e[a])*(e[a+1]+e[u+1]),u=a;return i}h.deviation=function(e,t,n,r){var i=t&&t.length,a=i?t[0]*n:e.length,u=Math.abs(P(e,0,a,n));if(i)for(var x=0,o=t.length;x<o;x++){var s=t[x]*n,p=x<o-1?t[x+1]*n:e.length;u-=Math.abs(P(e,s,p,n))}var l=0;for(x=0;x<r.length;x+=3){var h=r[x]*n,f=r[x+1]*n,y=r[x+2]*n;l+=Math.abs((e[h]-e[y])*(e[f+1]-e[h+1])-(e[h]-e[f])*(e[y+1]-e[h+1]))}return 0===u&&0===l?0:Math.abs((l-u)/u)},h.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,i=0;i<e.length;i++){for(var a=0;a<e[i].length;a++)for(var u=0;u<t;u++)n.vertices.push(e[i][a][u]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},p.default=l;const I={CLOCKWISE:s.WebGLConstants.CW,COUNTER_CLOCKWISE:s.WebGLConstants.CCW,validate:function(e){return e===I.CLOCKWISE||e===I.COUNTER_CLOCKWISE}};var B=Object.freeze(I);const N=new n.Cartesian3,U=new n.Cartesian3,_={computeArea2D:function(e){const t=e.length;let n=0;for(let r=t-1,i=0;i<t;r=i++){const t=e[r],a=e[i];n+=t.x*a.y-a.x*t.y}return.5*n},computeWindingOrder2D:function(e){return _.computeArea2D(e)>0?B.COUNTER_CLOCKWISE:B.CLOCKWISE},triangulate:function(e,n){const r=t.Cartesian2.packArray(e);return p(r,n,2)}},K=new n.Cartesian3,V=new n.Cartesian3,k=new n.Cartesian3,q=new n.Cartesian3,F=new n.Cartesian3,j=new n.Cartesian3,H=new n.Cartesian3;_.computeSubdivision=function(e,t,r,u){u=a.defaultValue(u,o.CesiumMath.RADIANS_PER_DEGREE);const s=r.slice(0);let p;const l=t.length,h=new Array(3*l);let f=0;for(p=0;p<l;p++){const e=t[p];h[f++]=e.x,h[f++]=e.y,h[f++]=e.z}const y=[],c={},v=e.maximumRadius,d=o.CesiumMath.chordLength(u,v),m=d*d;for(;s.length>0;){const e=s.pop(),t=s.pop(),r=s.pop(),i=n.Cartesian3.fromArray(h,3*r,K),u=n.Cartesian3.fromArray(h,3*t,V),x=n.Cartesian3.fromArray(h,3*e,k),o=n.Cartesian3.multiplyByScalar(n.Cartesian3.normalize(i,q),v,q),l=n.Cartesian3.multiplyByScalar(n.Cartesian3.normalize(u,F),v,F),f=n.Cartesian3.multiplyByScalar(n.Cartesian3.normalize(x,j),v,j),d=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(o,l,H)),C=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(l,f,H)),g=n.Cartesian3.magnitudeSquared(n.Cartesian3.subtract(f,o,H)),w=Math.max(d,C,g);let b,E;w>m?d===w?(b=`${Math.min(r,t)} ${Math.max(r,t)}`,p=c[b],a.defined(p)||(E=n.Cartesian3.add(i,u,H),n.Cartesian3.multiplyByScalar(E,.5,E),h.push(E.x,E.y,E.z),p=h.length/3-1,c[b]=p),s.push(r,p,e),s.push(p,t,e)):C===w?(b=`${Math.min(t,e)} ${Math.max(t,e)}`,p=c[b],a.defined(p)||(E=n.Cartesian3.add(u,x,H),n.Cartesian3.multiplyByScalar(E,.5,E),h.push(E.x,E.y,E.z),p=h.length/3-1,c[b]=p),s.push(t,p,r),s.push(p,e,r)):g===w&&(b=`${Math.min(e,r)} ${Math.max(e,r)}`,p=c[b],a.defined(p)||(E=n.Cartesian3.add(x,i,H),n.Cartesian3.multiplyByScalar(E,.5,E),h.push(E.x,E.y,E.z),p=h.length/3-1,c[b]=p),s.push(e,p,t),s.push(p,r,t)):(y.push(r),y.push(t),y.push(e))}return new x.Geometry({attributes:{position:new x.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:h})},indices:y,primitiveType:x.PrimitiveType.TRIANGLES})};const J=new t.Cartographic,Q=new t.Cartographic,X=new t.Cartographic,Y=new t.Cartographic;_.computeRhumbLineSubdivision=function(e,t,r,s){s=a.defaultValue(s,o.CesiumMath.RADIANS_PER_DEGREE);const p=r.slice(0);let l;const h=t.length,f=new Array(3*h);let y=0;for(l=0;l<h;l++){const e=t[l];f[y++]=e.x,f[y++]=e.y,f[y++]=e.z}const c=[],v={},d=e.maximumRadius,m=o.CesiumMath.chordLength(s,d),C=new u.EllipsoidRhumbLine(void 0,void 0,e),g=new u.EllipsoidRhumbLine(void 0,void 0,e),w=new u.EllipsoidRhumbLine(void 0,void 0,e);for(;p.length>0;){const t=p.pop(),r=p.pop(),i=p.pop(),u=n.Cartesian3.fromArray(f,3*i,K),x=n.Cartesian3.fromArray(f,3*r,V),o=n.Cartesian3.fromArray(f,3*t,k),s=e.cartesianToCartographic(u,J),h=e.cartesianToCartographic(x,Q),y=e.cartesianToCartographic(o,X);C.setEndPoints(s,h);const d=C.surfaceDistance;g.setEndPoints(h,y);const b=g.surfaceDistance;w.setEndPoints(y,s);const E=w.surfaceDistance,M=Math.max(d,b,E);let Z,S,A,z;M>m?d===M?(Z=`${Math.min(i,r)} ${Math.max(i,r)}`,l=v[Z],a.defined(l)||(S=C.interpolateUsingFraction(.5,Y),A=.5*(s.height+h.height),z=n.Cartesian3.fromRadians(S.longitude,S.latitude,A,e,H),f.push(z.x,z.y,z.z),l=f.length/3-1,v[Z]=l),p.push(i,l,t),p.push(l,r,t)):b===M?(Z=`${Math.min(r,t)} ${Math.max(r,t)}`,l=v[Z],a.defined(l)||(S=g.interpolateUsingFraction(.5,Y),A=.5*(h.height+y.height),z=n.Cartesian3.fromRadians(S.longitude,S.latitude,A,e,H),f.push(z.x,z.y,z.z),l=f.length/3-1,v[Z]=l),p.push(r,l,i),p.push(l,t,i)):E===M&&(Z=`${Math.min(t,i)} ${Math.max(t,i)}`,l=v[Z],a.defined(l)||(S=w.interpolateUsingFraction(.5,Y),A=.5*(y.height+s.height),z=n.Cartesian3.fromRadians(S.longitude,S.latitude,A,e,H),f.push(z.x,z.y,z.z),l=f.length/3-1,v[Z]=l),p.push(t,l,r),p.push(l,i,r)):(c.push(i),c.push(r),c.push(t))}return new x.Geometry({attributes:{position:new x.GeometryAttribute({componentDatatype:i.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:f})},indices:c,primitiveType:x.PrimitiveType.TRIANGLES})},_.scaleToGeodeticHeight=function(e,r,i,u){i=a.defaultValue(i,t.Ellipsoid.WGS84);let x=N,o=U;if(r=a.defaultValue(r,0),u=a.defaultValue(u,!0),a.defined(e)){const t=e.length;for(let a=0;a<t;a+=3)n.Cartesian3.fromArray(e,a,o),u&&(o=i.scaleToGeodeticSurface(o,o)),0!==r&&(x=i.geodeticSurfaceNormal(o,x),n.Cartesian3.multiplyByScalar(x,r,x),n.Cartesian3.add(o,x,o)),e[a]=o.x,e[a+1]=o.y,e[a+2]=o.z}return e},e.PolygonPipeline=_,e.WindingOrder=B}));