qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/Cartesian2-bd414876.js

2 lines
12 KiB
JavaScript

define(["exports","./Cartesian3-e0307675","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-e73894ab"],(function(e,t,n,i,a){"use strict";const r=new t.Cartesian3,o=new t.Cartesian3;function u(e,n,u,s,d){const c=e.x,l=e.y,f=e.z,h=n.x,m=n.y,y=n.z,p=c*c*h*h,C=l*l*m*m,g=f*f*y*y,x=p+C+g,_=Math.sqrt(1/x),S=t.Cartesian3.multiplyByScalar(e,_,r);if(x<s)return isFinite(_)?t.Cartesian3.clone(S,d):void 0;const q=u.x,w=u.y,M=u.z,R=o;R.x=S.x*q*2,R.y=S.y*w*2,R.z=S.z*M*2;let O,z,v,T,b,A,E,N,V,k,I,B=(1-_)*t.Cartesian3.magnitude(e)/(.5*t.Cartesian3.magnitude(R)),U=0;do{B-=U,v=1/(1+B*q),T=1/(1+B*w),b=1/(1+B*M),A=v*v,E=T*T,N=b*b,V=A*v,k=E*T,I=N*b,O=p*A+C*E+g*N-1,z=p*V*q+C*k*w+g*I*M;U=O/(-2*z)}while(Math.abs(O)>a.CesiumMath.EPSILON12);return i.defined(d)?(d.x=c*v,d.y=l*T,d.z=f*b,d):new t.Cartesian3(c*v,l*T,f*b)}function s(e,t,n){this.longitude=i.defaultValue(e,0),this.latitude=i.defaultValue(t,0),this.height=i.defaultValue(n,0)}s.fromRadians=function(e,t,n,a){return n=i.defaultValue(n,0),i.defined(a)?(a.longitude=e,a.latitude=t,a.height=n,a):new s(e,t,n)},s.fromDegrees=function(e,t,n,i){return e=a.CesiumMath.toRadians(e),t=a.CesiumMath.toRadians(t),s.fromRadians(e,t,n,i)};const d=new t.Cartesian3,c=new t.Cartesian3,l=new t.Cartesian3,f=new t.Cartesian3(1/6378137,1/6378137,1/6356752.314245179),h=new t.Cartesian3(1/40680631590769,1/40680631590769,1/40408299984661.445),m=a.CesiumMath.EPSILON1;function y(e,n,r,o){n=i.defaultValue(n,0),r=i.defaultValue(r,0),o=i.defaultValue(o,0),e._radii=new t.Cartesian3(n,r,o),e._radiiSquared=new t.Cartesian3(n*n,r*r,o*o),e._radiiToTheFourth=new t.Cartesian3(n*n*n*n,r*r*r*r,o*o*o*o),e._oneOverRadii=new t.Cartesian3(0===n?0:1/n,0===r?0:1/r,0===o?0:1/o),e._oneOverRadiiSquared=new t.Cartesian3(0===n?0:1/(n*n),0===r?0:1/(r*r),0===o?0:1/(o*o)),e._minimumRadius=Math.min(n,r,o),e._maximumRadius=Math.max(n,r,o),e._centerToleranceSquared=a.CesiumMath.EPSILON1,0!==e._radiiSquared.z&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function p(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,y(this,e,t,n)}s.fromCartesian=function(e,n,r){const o=i.defined(n)?n.oneOverRadii:f,y=i.defined(n)?n.oneOverRadiiSquared:h,p=u(e,o,y,i.defined(n)?n._centerToleranceSquared:m,c);if(!i.defined(p))return;let C=t.Cartesian3.multiplyComponents(p,y,d);C=t.Cartesian3.normalize(C,C);const g=t.Cartesian3.subtract(e,p,l),x=Math.atan2(C.y,C.x),_=Math.asin(C.z),S=a.CesiumMath.sign(t.Cartesian3.dot(g,e))*t.Cartesian3.magnitude(g);return i.defined(r)?(r.longitude=x,r.latitude=_,r.height=S,r):new s(x,_,S)},s.toCartesian=function(e,n,i){return t.Cartesian3.fromRadians(e.longitude,e.latitude,e.height,n,i)},s.clone=function(e,t){if(i.defined(e))return i.defined(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new s(e.longitude,e.latitude,e.height)},s.equals=function(e,t){return e===t||i.defined(e)&&i.defined(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height},s.equalsEpsilon=function(e,t,n){return n=i.defaultValue(n,0),e===t||i.defined(e)&&i.defined(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n},s.ZERO=Object.freeze(new s(0,0,0)),s.prototype.clone=function(e){return s.clone(this,e)},s.prototype.equals=function(e){return s.equals(this,e)},s.prototype.equalsEpsilon=function(e,t){return s.equalsEpsilon(this,e,t)},s.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`},Object.defineProperties(p.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),p.clone=function(e,n){if(!i.defined(e))return;const a=e._radii;return i.defined(n)?(t.Cartesian3.clone(a,n._radii),t.Cartesian3.clone(e._radiiSquared,n._radiiSquared),t.Cartesian3.clone(e._radiiToTheFourth,n._radiiToTheFourth),t.Cartesian3.clone(e._oneOverRadii,n._oneOverRadii),t.Cartesian3.clone(e._oneOverRadiiSquared,n._oneOverRadiiSquared),n._minimumRadius=e._minimumRadius,n._maximumRadius=e._maximumRadius,n._centerToleranceSquared=e._centerToleranceSquared,n):new p(a.x,a.y,a.z)},p.fromCartesian3=function(e,t){return i.defined(t)||(t=new p),i.defined(e)?(y(t,e.x,e.y,e.z),t):t},p.WGS84=Object.freeze(new p(6378137,6378137,6356752.314245179)),p.UNIT_SPHERE=Object.freeze(new p(1,1,1)),p.MOON=Object.freeze(new p(a.CesiumMath.LUNAR_RADIUS,a.CesiumMath.LUNAR_RADIUS,a.CesiumMath.LUNAR_RADIUS)),p.prototype.clone=function(e){return p.clone(this,e)},p.packedLength=t.Cartesian3.packedLength,p.pack=function(e,n,a){return a=i.defaultValue(a,0),t.Cartesian3.pack(e._radii,n,a),n},p.unpack=function(e,n,a){n=i.defaultValue(n,0);const r=t.Cartesian3.unpack(e,n);return p.fromCartesian3(r,a)},p.prototype.geocentricSurfaceNormal=t.Cartesian3.normalize,p.prototype.geodeticSurfaceNormalCartographic=function(e,n){const a=e.longitude,r=e.latitude,o=Math.cos(r),u=o*Math.cos(a),s=o*Math.sin(a),d=Math.sin(r);return i.defined(n)||(n=new t.Cartesian3),n.x=u,n.y=s,n.z=d,t.Cartesian3.normalize(n,n)},p.prototype.geodeticSurfaceNormal=function(e,n){if(!t.Cartesian3.equalsEpsilon(e,t.Cartesian3.ZERO,a.CesiumMath.EPSILON14))return i.defined(n)||(n=new t.Cartesian3),n=t.Cartesian3.multiplyComponents(e,this._oneOverRadiiSquared,n),t.Cartesian3.normalize(n,n)};const C=new t.Cartesian3,g=new t.Cartesian3;p.prototype.cartographicToCartesian=function(e,n){const a=C,r=g;this.geodeticSurfaceNormalCartographic(e,a),t.Cartesian3.multiplyComponents(this._radiiSquared,a,r);const o=Math.sqrt(t.Cartesian3.dot(a,r));return t.Cartesian3.divideByScalar(r,o,r),t.Cartesian3.multiplyByScalar(a,e.height,a),i.defined(n)||(n=new t.Cartesian3),t.Cartesian3.add(r,a,n)},p.prototype.cartographicArrayToCartesianArray=function(e,t){const n=e.length;i.defined(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};const x=new t.Cartesian3,_=new t.Cartesian3,S=new t.Cartesian3;p.prototype.cartesianToCartographic=function(e,n){const r=this.scaleToGeodeticSurface(e,_);if(!i.defined(r))return;const o=this.geodeticSurfaceNormal(r,x),u=t.Cartesian3.subtract(e,r,S),d=Math.atan2(o.y,o.x),c=Math.asin(o.z),l=a.CesiumMath.sign(t.Cartesian3.dot(u,e))*t.Cartesian3.magnitude(u);return i.defined(n)?(n.longitude=d,n.latitude=c,n.height=l,n):new s(d,c,l)},p.prototype.cartesianArrayToCartographicArray=function(e,t){const n=e.length;i.defined(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t},p.prototype.scaleToGeodeticSurface=function(e,t){return u(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},p.prototype.scaleToGeocentricSurface=function(e,n){i.defined(n)||(n=new t.Cartesian3);const a=e.x,r=e.y,o=e.z,u=this._oneOverRadiiSquared,s=1/Math.sqrt(a*a*u.x+r*r*u.y+o*o*u.z);return t.Cartesian3.multiplyByScalar(e,s,n)},p.prototype.transformPositionToScaledSpace=function(e,n){return i.defined(n)||(n=new t.Cartesian3),t.Cartesian3.multiplyComponents(e,this._oneOverRadii,n)},p.prototype.transformPositionFromScaledSpace=function(e,n){return i.defined(n)||(n=new t.Cartesian3),t.Cartesian3.multiplyComponents(e,this._radii,n)},p.prototype.equals=function(e){return this===e||i.defined(e)&&t.Cartesian3.equals(this._radii,e._radii)},p.prototype.toString=function(){return this._radii.toString()},p.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,n,a){n=i.defaultValue(n,0);const r=this._squaredXOverSquaredZ;if(i.defined(a)||(a=new t.Cartesian3),a.x=0,a.y=0,a.z=e.z*(1-r),!(Math.abs(a.z)>=this._radii.z-n))return a};const q=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],w=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function M(e,t,n){const i=.5*(t+e),a=.5*(t-e);let r=0;for(let e=0;e<5;e++){const t=a*q[e];r+=w[e]*(n(i+t)+n(i-t))}return r*=a,r}function R(e,t){this.x=i.defaultValue(e,0),this.y=i.defaultValue(t,0)}p.prototype.surfaceArea=function(e){const t=e.west;let n=e.east;const i=e.south,r=e.north;for(;n<t;)n+=a.CesiumMath.TWO_PI;const o=this._radiiSquared,u=o.x,s=o.y,d=o.z,c=u*s;return M(i,r,(function(e){const i=Math.cos(e),a=Math.sin(e);return Math.cos(e)*M(t,n,(function(e){const t=Math.cos(e),n=Math.sin(e);return Math.sqrt(c*a*a+d*(s*t*t+u*n*n)*i*i)}))}))},R.fromElements=function(e,t,n){return i.defined(n)?(n.x=e,n.y=t,n):new R(e,t)},R.clone=function(e,t){if(i.defined(e))return i.defined(t)?(t.x=e.x,t.y=e.y,t):new R(e.x,e.y)},R.fromCartesian3=R.clone,R.fromCartesian4=R.clone,R.packedLength=2,R.pack=function(e,t,n){return n=i.defaultValue(n,0),t[n++]=e.x,t[n]=e.y,t},R.unpack=function(e,t,n){return t=i.defaultValue(t,0),i.defined(n)||(n=new R),n.x=e[t++],n.y=e[t],n},R.packArray=function(e,t){const n=e.length,a=2*n;i.defined(t)?(Array.isArray(t)||t.length===a)&&t.length!==a&&(t.length=a):t=new Array(a);for(let i=0;i<n;++i)R.pack(e[i],t,2*i);return t},R.unpackArray=function(e,t){const n=e.length;i.defined(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){const n=i/2;t[n]=R.unpack(e,i,t[n])}return t},R.fromArray=R.unpack,R.maximumComponent=function(e){return Math.max(e.x,e.y)},R.minimumComponent=function(e){return Math.min(e.x,e.y)},R.minimumByComponent=function(e,t,n){return n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n},R.maximumByComponent=function(e,t,n){return n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n},R.magnitudeSquared=function(e){return e.x*e.x+e.y*e.y},R.magnitude=function(e){return Math.sqrt(R.magnitudeSquared(e))};const O=new R;R.distance=function(e,t){return R.subtract(e,t,O),R.magnitude(O)},R.distanceSquared=function(e,t){return R.subtract(e,t,O),R.magnitudeSquared(O)},R.normalize=function(e,t){const n=R.magnitude(e);return t.x=e.x/n,t.y=e.y/n,t},R.dot=function(e,t){return e.x*t.x+e.y*t.y},R.cross=function(e,t){return e.x*t.y-e.y*t.x},R.multiplyComponents=function(e,t,n){return n.x=e.x*t.x,n.y=e.y*t.y,n},R.divideComponents=function(e,t,n){return n.x=e.x/t.x,n.y=e.y/t.y,n},R.add=function(e,t,n){return n.x=e.x+t.x,n.y=e.y+t.y,n},R.subtract=function(e,t,n){return n.x=e.x-t.x,n.y=e.y-t.y,n},R.multiplyByScalar=function(e,t,n){return n.x=e.x*t,n.y=e.y*t,n},R.divideByScalar=function(e,t,n){return n.x=e.x/t,n.y=e.y/t,n},R.negate=function(e,t){return t.x=-e.x,t.y=-e.y,t},R.abs=function(e,t){return t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};const z=new R;R.lerp=function(e,t,n,i){return R.multiplyByScalar(t,n,z),i=R.multiplyByScalar(e,1-n,i),R.add(z,i,i)};const v=new R,T=new R;R.angleBetween=function(e,t){return R.normalize(e,v),R.normalize(t,T),a.CesiumMath.acosClamped(R.dot(v,T))};const b=new R;R.mostOrthogonalAxis=function(e,t){const n=R.normalize(e,b);return R.abs(n,n),t=n.x<=n.y?R.clone(R.UNIT_X,t):R.clone(R.UNIT_Y,t)},R.equals=function(e,t){return e===t||i.defined(e)&&i.defined(t)&&e.x===t.x&&e.y===t.y},R.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]},R.equalsEpsilon=function(e,t,n,r){return e===t||i.defined(e)&&i.defined(t)&&a.CesiumMath.equalsEpsilon(e.x,t.x,n,r)&&a.CesiumMath.equalsEpsilon(e.y,t.y,n,r)},R.ZERO=Object.freeze(new R(0,0)),R.ONE=Object.freeze(new R(1,1)),R.UNIT_X=Object.freeze(new R(1,0)),R.UNIT_Y=Object.freeze(new R(0,1)),R.prototype.clone=function(e){return R.clone(this,e)},R.prototype.equals=function(e){return R.equals(this,e)},R.prototype.equalsEpsilon=function(e,t,n){return R.equalsEpsilon(this,e,t,n)},R.prototype.toString=function(){return`(${this.x}, ${this.y})`},e.Cartesian2=R,e.Cartographic=s,e.Ellipsoid=p}));