chunk-CUQT2UK5.js 12 KB

1
  1. import{a as f,b as q,c as T}from"./chunk-I46SWINN.js";import{a as o}from"./chunk-LNIYJJXS.js";import{a as _}from"./chunk-4D2ERGZX.js";import{a as h}from"./chunk-EDZQSM3T.js";import{a as S}from"./chunk-PJGSCWXZ.js";import{a as d}from"./chunk-NUC3LT2W.js";function P(a,t,e,n){t=_(t,0),e=_(e,0),n=_(n,0),h.typeOf.number.greaterThanOrEquals("x",t,0),h.typeOf.number.greaterThanOrEquals("y",e,0),h.typeOf.number.greaterThanOrEquals("z",n,0),o.equalsEpsilon(n,6356752314245179e-9,o.EPSILON10)&&(o.Radius=n),a._radii=new f(t,e,n),a._radiiSquared=new f(t*t,e*e,n*n),a._radiiToTheFourth=new f(t*t*t*t,e*e*e*e,n*n*n*n),a._oneOverRadii=new f(t===0?0:1/t,e===0?0:1/e,n===0?0:1/n),a._oneOverRadiiSquared=new f(t===0?0:1/(t*t),e===0?0:1/(e*e),n===0?0:1/(n*n)),a._minimumRadius=Math.min(t,e,n),a._maximumRadius=Math.max(t,e,n),a._centerToleranceSquared=o.EPSILON1,a._radii.x>0&&(a._f=(a._radii.x-a._radii.z)/a._radii.x,a._e2=2*a._f-a._f*a._f),a._radiiSquared.z!==0&&(a._squaredXOverSquaredZ=a._radiiSquared.x/a._radiiSquared.z)}function c(a,t,e){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,P(this,a,t,e)}Object.defineProperties(c.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}}});c.clone=function(a,t){if(!!d(a)){var e=a._radii;return d(t)?(f.clone(e,t._radii),f.clone(a._radiiSquared,t._radiiSquared),f.clone(a._radiiToTheFourth,t._radiiToTheFourth),f.clone(a._oneOverRadii,t._oneOverRadii),t._f=a._f,t._e2=a._e2,t._minimumRadius=a._minimumRadius,t._maximumRadius=a._maximumRadius,t._centerToleranceSquared=a._centerToleranceSquared,t):new c(e.x,e.y,e.z)}};c.fromCartesian3=function(a,t){return d(t)||(t=new c),d(a)&&P(t,a.x,a.y,a.z),t};c.WGS84=Object.freeze(new c(6378137,6378137,o.Radius));c.XIAN80=Object.freeze(new c(6378140,6378140,635675529e-2));c.CGCS2000=Object.freeze(new c(6378137,6378137,635675231e-2));c.UNIT_SPHERE=Object.freeze(new c(1,1,1));c.MOON=Object.freeze(new c(o.LUNAR_RADIUS,o.LUNAR_RADIUS,o.LUNAR_RADIUS));c.prototype.clone=function(a){return c.clone(this,a)};c.packedLength=f.packedLength;c.pack=function(a,t,e){return h.typeOf.object("value",a),h.defined("array",t),e=_(e,0),f.pack(a._radii,t,e),t};c.unpack=function(a,t,e){h.defined("array",a),t=_(t,0);var n=f.unpack(a,t);return c.fromCartesian3(n,e)};c.prototype.geocentricSurfaceNormal=f.normalize;c.prototype.geodeticSurfaceNormalCartographic=function(a,t){h.typeOf.object("cartographic",a);var e=a.longitude,n=a.latitude,i=Math.cos(n),u=i*Math.cos(e),m=i*Math.sin(e),s=Math.sin(n);return d(t)||(t=new f),t.x=u,t.y=m,t.z=s,f.normalize(t,t)};c.prototype.geodeticSurfaceNormal=function(a,t){return d(t)||(t=new f),t=f.multiplyComponents(a,this._oneOverRadiiSquared,t),f.normalize(t,t)};var E=new f,R=new f;c.prototype.cartographicToCartesian=function(a,t){var e=E,n=R;this.geodeticSurfaceNormalCartographic(a,e),f.multiplyComponents(this._radiiSquared,e,n);var i=Math.sqrt(f.dot(e,n));return f.divideByScalar(n,i,n),f.multiplyByScalar(e,a.height,e),d(t)||(t=new f),f.add(n,e,t)};c.prototype.cartographicArrayToCartesianArray=function(a,t){h.defined("cartographics",a);var e=a.length;d(t)?t.length=e:t=new Array(e);for(var n=0;n<e;n++)t[n]=this.cartographicToCartesian(a[n],t[n]);return t};var A=new f,C=new f,I=new f;c.prototype.cartesianToCartographic=function(a,t){var e=this.scaleToGeodeticSurface(a,C);if(!!d(e)){var n=this.geodeticSurfaceNormal(e,A),i=f.subtract(a,e,I),u=Math.atan2(n.y,n.x),m=Math.asin(n.z),s=o.sign(f.dot(i,a))*f.magnitude(i);return d(t)?(t.longitude=u,t.latitude=m,t.height=s,t):new T(u,m,s)}};c.prototype.cartesianArrayToCartographicArray=function(a,t){h.defined("cartesians",a);var e=a.length;d(t)?t.length=e:t=new Array(e);for(var n=0;n<e;++n)t[n]=this.cartesianToCartographic(a[n],t[n]);return t};c.prototype.scaleToGeodeticSurface=function(a,t){return q(a,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)};c.prototype.scaleToGeocentricSurface=function(a,t){h.typeOf.object("cartesian",a),d(t)||(t=new f);var e=a.x,n=a.y,i=a.z,u=this._oneOverRadiiSquared,m=1/Math.sqrt(e*e*u.x+n*n*u.y+i*i*u.z);return f.multiplyByScalar(a,m,t)};c.prototype.transformPositionToScaledSpace=function(a,t){return d(t)||(t=new f),f.multiplyComponents(a,this._oneOverRadii,t)};c.prototype.transformPositionFromScaledSpace=function(a,t){return d(t)||(t=new f),f.multiplyComponents(a,this._radii,t)};c.prototype.equals=function(a){return this===a||d(a)&&f.equals(this._radii,a._radii)};c.prototype.toString=function(){return this._radii.toString()};c.prototype.getSurfaceNormalIntersectionWithZAxis=function(a,t,e){if(h.typeOf.object("position",a),!o.equalsEpsilon(this._radii.x,this._radii.y,o.EPSILON15))throw new S("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");h.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=_(t,0);var n=this._squaredXOverSquaredZ;if(d(e)||(e=new f),e.x=0,e.y=0,e.z=a.z*(1-n),!(Math.abs(e.z)>=this._radii.z-t))return e};var b=c;function r(a,t,e,n){this.west=_(a,0),this.south=_(t,0),this.east=_(e,0),this.north=_(n,0)}Object.defineProperties(r.prototype,{width:{get:function(){return r.computeWidth(this)}},height:{get:function(){return r.computeHeight(this)}}});r.packedLength=4;r.pack=function(a,t,e){return h.typeOf.object("value",a),h.defined("array",t),e=_(e,0),t[e++]=a.west,t[e++]=a.south,t[e++]=a.east,t[e]=a.north,t};r.unpack=function(a,t,e){return h.defined("array",a),t=_(t,0),d(e)||(e=new r),e.west=a[t++],e.south=a[t++],e.east=a[t++],e.north=a[t],e};r.computeWidth=function(a){h.typeOf.object("rectangle",a);var t=a.east,e=a.west;return t<e&&(t+=o.TWO_PI),t-e};r.computeHeight=function(a){return h.typeOf.object("rectangle",a),a.north-a.south};r.fromDegrees=function(a,t,e,n,i){return a=o.toRadians(_(a,0)),t=o.toRadians(_(t,0)),e=o.toRadians(_(e,0)),n=o.toRadians(_(n,0)),d(i)?(i.west=a,i.south=t,i.east=e,i.north=n,i):new r(a,t,e,n)};r.fromRadians=function(a,t,e,n,i){return d(i)?(i.west=_(a,0),i.south=_(t,0),i.east=_(e,0),i.north=_(n,0),i):new r(a,t,e,n)};r.fromCartographicArray=function(a,t){h.defined("cartographics",a);for(var e=Number.MAX_VALUE,n=-Number.MAX_VALUE,i=Number.MAX_VALUE,u=-Number.MAX_VALUE,m=Number.MAX_VALUE,s=-Number.MAX_VALUE,O=0,v=a.length;O<v;O++){var p=a[O];e=Math.min(e,p.longitude),n=Math.max(n,p.longitude),m=Math.min(m,p.latitude),s=Math.max(s,p.latitude);var w=p.longitude>=0?p.longitude:p.longitude+o.TWO_PI;i=Math.min(i,w),u=Math.max(u,w)}return n-e>u-i&&(e=i,n=u,n>o.PI&&(n=n-o.TWO_PI),e>o.PI&&(e=e-o.TWO_PI)),d(t)?(t.west=e,t.south=m,t.east=n,t.north=s,t):new r(e,m,n,s)};r.fromCartesianArray=function(a,t,e){h.defined("cartesians",a),t=_(t,b.WGS84);for(var n=Number.MAX_VALUE,i=-Number.MAX_VALUE,u=Number.MAX_VALUE,m=-Number.MAX_VALUE,s=Number.MAX_VALUE,O=-Number.MAX_VALUE,v=0,p=a.length;v<p;v++){var w=t.cartesianToCartographic(a[v]);n=Math.min(n,w.longitude),i=Math.max(i,w.longitude),s=Math.min(s,w.latitude),O=Math.max(O,w.latitude);var y=w.longitude>=0?w.longitude:w.longitude+o.TWO_PI;u=Math.min(u,y),m=Math.max(m,y)}return i-n>m-u&&(n=u,i=m,i>o.PI&&(i=i-o.TWO_PI),n>o.PI&&(n=n-o.TWO_PI)),d(e)?(e.west=n,e.south=s,e.east=i,e.north=O,e):new r(n,s,i,O)};r.clone=function(a,t){if(!!d(a))return d(t)?(t.west=a.west,t.south=a.south,t.east=a.east,t.north=a.north,t):new r(a.west,a.south,a.east,a.north)};r.equalsEpsilon=function(a,t,e){return h.typeOf.number("absoluteEpsilon",e),a===t||d(a)&&d(t)&&Math.abs(a.west-t.west)<=e&&Math.abs(a.south-t.south)<=e&&Math.abs(a.east-t.east)<=e&&Math.abs(a.north-t.north)<=e};r.prototype.clone=function(a){return r.clone(this,a)};r.prototype.equals=function(a){return r.equals(this,a)};r.equals=function(a,t){return a===t||d(a)&&d(t)&&a.west===t.west&&a.south===t.south&&a.east===t.east&&a.north===t.north};r.prototype.equalsEpsilon=function(a,t){return h.typeOf.number("epsilon",t),r.equalsEpsilon(this,a,t)};r.validate=function(a){h.typeOf.object("rectangle",a);var t=a.north;h.typeOf.number.greaterThanOrEquals("north",t,-o.PI_OVER_TWO),h.typeOf.number.lessThanOrEquals("north",t,o.PI_OVER_TWO);var e=a.south;h.typeOf.number.greaterThanOrEquals("south",e,-o.PI_OVER_TWO),h.typeOf.number.lessThanOrEquals("south",e,o.PI_OVER_TWO);var n=a.west;h.typeOf.number.greaterThanOrEquals("west",n,-Math.PI),h.typeOf.number.lessThanOrEquals("west",n,Math.PI);var i=a.east;h.typeOf.number.greaterThanOrEquals("east",i,-Math.PI),h.typeOf.number.lessThanOrEquals("east",i,Math.PI)};r.southwest=function(a,t){return h.typeOf.object("rectangle",a),d(t)?(t.longitude=a.west,t.latitude=a.south,t.height=0,t):new T(a.west,a.south)};r.northwest=function(a,t){return h.typeOf.object("rectangle",a),d(t)?(t.longitude=a.west,t.latitude=a.north,t.height=0,t):new T(a.west,a.north)};r.northeast=function(a,t){return h.typeOf.object("rectangle",a),d(t)?(t.longitude=a.east,t.latitude=a.north,t.height=0,t):new T(a.east,a.north)};r.southeast=function(a,t){return h.typeOf.object("rectangle",a),d(t)?(t.longitude=a.east,t.latitude=a.south,t.height=0,t):new T(a.east,a.south)};r.center=function(a,t){h.typeOf.object("rectangle",a);var e=a.east,n=a.west;e<n&&(e+=o.TWO_PI);var i=o.negativePiToPi((n+e)*.5),u=(a.south+a.north)*.5;return d(t)?(t.longitude=i,t.latitude=u,t.height=0,t):new T(i,u)};r.intersection=function(a,t,e){h.typeOf.object("rectangle",a),h.typeOf.object("otherRectangle",t);var n=a.east,i=a.west,u=t.east,m=t.west;n<i&&u>0?n+=o.TWO_PI:u<m&&n>0&&(u+=o.TWO_PI),n<i&&m<0?m+=o.TWO_PI:u<m&&i<0&&(i+=o.TWO_PI);var s=o.negativePiToPi(Math.max(i,m)),O=o.negativePiToPi(Math.min(n,u));if(!((a.west<a.east||t.west<t.east)&&O<=s)){var v=Math.max(a.south,t.south),p=Math.min(a.north,t.north);if(!(v>=p))return d(e)?(e.west=s,e.south=v,e.east=O,e.north=p,e):new r(s,v,O,p)}};r.simpleIntersection=function(a,t,e){h.typeOf.object("rectangle",a),h.typeOf.object("otherRectangle",t);var n=Math.max(a.west,t.west),i=Math.max(a.south,t.south),u=Math.min(a.east,t.east),m=Math.min(a.north,t.north);if(!(i>=m||n>=u))return d(e)?(e.west=n,e.south=i,e.east=u,e.north=m,e):new r(n,i,u,m)};r.union=function(a,t,e){h.typeOf.object("rectangle",a),h.typeOf.object("otherRectangle",t),d(e)||(e=new r);var n=a.east,i=a.west,u=t.east,m=t.west;n<i&&u>0?n+=o.TWO_PI:u<m&&n>0&&(u+=o.TWO_PI),n<i&&m<0?m+=o.TWO_PI:u<m&&i<0&&(i+=o.TWO_PI);var s=o.convertLongitudeRange(Math.min(i,m)),O=o.convertLongitudeRange(Math.max(n,u));return e.west=s,e.south=Math.min(a.south,t.south),e.east=O,e.north=Math.max(a.north,t.north),e};r.expand=function(a,t,e){return h.typeOf.object("rectangle",a),h.typeOf.object("cartographic",t),d(e)||(e=new r),e.west=Math.min(a.west,t.longitude),e.south=Math.min(a.south,t.latitude),e.east=Math.max(a.east,t.longitude),e.north=Math.max(a.north,t.latitude),e};r.contains=function(a,t){h.typeOf.object("rectangle",a),h.typeOf.object("cartographic",t);var e=t.longitude,n=t.latitude,i=a.west,u=a.east;return u<i&&(u+=o.TWO_PI,e<0&&(e+=o.TWO_PI)),(e>i||o.equalsEpsilon(e,i,o.EPSILON14))&&(e<u||o.equalsEpsilon(e,u,o.EPSILON14))&&n>=a.south&&n<=a.north};var W=new T;r.subsample=function(a,t,e,n){h.typeOf.object("rectangle",a),t=_(t,b.WGS84),e=_(e,0),d(n)||(n=[]);var i=0,u=a.north,m=a.south,s=a.east,O=a.west,v=W;v.height=e,v.longitude=O,v.latitude=u,n[i]=t.cartographicToCartesian(v,n[i]),i++,v.longitude=s,n[i]=t.cartographicToCartesian(v,n[i]),i++,v.latitude=m,n[i]=t.cartographicToCartesian(v,n[i]),i++,v.longitude=O,n[i]=t.cartographicToCartesian(v,n[i]),i++,u<0?v.latitude=u:m>0?v.latitude=m:v.latitude=0;for(var p=1;p<8;++p)v.longitude=-Math.PI+p*o.PI_OVER_TWO,r.contains(a,v)&&(n[i]=t.cartographicToCartesian(v,n[i]),i++);return v.latitude===0&&(v.longitude=O,n[i]=t.cartographicToCartesian(v,n[i]),i++,v.longitude=s,n[i]=t.cartographicToCartesian(v,n[i]),i++),n.length=i,n};var M=new T;r.prototype.contains=function(a){return r.contains(this,r.southwest(a,M))&&r.contains(this,r.northwest(a,M))&&r.contains(this,r.southeast(a,M))&&r.contains(this,r.northeast(a,M))};r.MAX_VALUE=Object.freeze(new r(-Math.PI,-o.PI_OVER_TWO,Math.PI,o.PI_OVER_TWO));var H=r;export{b as a,H as b};