2 lines
6.9 KiB
JavaScript
2 lines
6.9 KiB
JavaScript
|
define(["exports","./Cartesian2-bd414876","./Check-741c5f3c","./defaultValue-81eec7ed","./Math-e73894ab"],(function(t,e,a,n,s){"use strict";function u(t,e,a,s){this.west=n.defaultValue(t,0),this.south=n.defaultValue(e,0),this.east=n.defaultValue(a,0),this.north=n.defaultValue(s,0)}Object.defineProperties(u.prototype,{width:{get:function(){return u.computeWidth(this)}},height:{get:function(){return u.computeHeight(this)}}}),u.packedLength=4,u.pack=function(t,e,a){return a=n.defaultValue(a,0),e[a++]=t.west,e[a++]=t.south,e[a++]=t.east,e[a]=t.north,e},u.unpack=function(t,e,a){return e=n.defaultValue(e,0),n.defined(a)||(a=new u),a.west=t[e++],a.south=t[e++],a.east=t[e++],a.north=t[e],a},u.computeWidth=function(t){let e=t.east;const a=t.west;return e<a&&(e+=s.CesiumMath.TWO_PI),e-a},u.computeHeight=function(t){return t.north-t.south},u.fromDegrees=function(t,e,a,i,o){return t=s.CesiumMath.toRadians(n.defaultValue(t,0)),e=s.CesiumMath.toRadians(n.defaultValue(e,0)),a=s.CesiumMath.toRadians(n.defaultValue(a,0)),i=s.CesiumMath.toRadians(n.defaultValue(i,0)),n.defined(o)?(o.west=t,o.south=e,o.east=a,o.north=i,o):new u(t,e,a,i)},u.fromRadians=function(t,e,a,s,i){return n.defined(i)?(i.west=n.defaultValue(t,0),i.south=n.defaultValue(e,0),i.east=n.defaultValue(a,0),i.north=n.defaultValue(s,0),i):new u(t,e,a,s)},u.fromCartographicArray=function(t,e){let a=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,h=-Number.MAX_VALUE,r=Number.MAX_VALUE,d=-Number.MAX_VALUE;for(let e=0,n=t.length;e<n;e++){const n=t[e];a=Math.min(a,n.longitude),i=Math.max(i,n.longitude),r=Math.min(r,n.latitude),d=Math.max(d,n.latitude);const u=n.longitude>=0?n.longitude:n.longitude+s.CesiumMath.TWO_PI;o=Math.min(o,u),h=Math.max(h,u)}return i-a>h-o&&(a=o,i=h,i>s.CesiumMath.PI&&(i-=s.CesiumMath.TWO_PI),a>s.CesiumMath.PI&&(a-=s.CesiumMath.TWO_PI)),n.defined(e)?(e.west=a,e.south=r,e.east=i,e.north=d,e):new u(a,r,i,d)},u.fromCartesianArray=function(t,a,i){a=n.defaultValue(a,e.Ellipsoid.WGS84);let o=Number.MAX_VALUE,h=-Number.MAX_VALUE,r=Number.MAX_VALUE,d=-Number.MAX_VALUE,l=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let e=0,n=t.length;e<n;e++){const n=a.cartesianToCartographic(t[e]);o=Math.min(o,n.longitude),h=Math.max(h,n.longitude),l=Math.min(l,n.latitude),c=Math.max(c,n.latitude);const u=n.longitude>=0?n.longitude:n.longitude+s.CesiumMath.TWO_PI;r=Math.min(r,u),d=Math.max(d,u)}return h-o>d-r&&(o=r,h=d,h>s.CesiumMath.PI&&(h-=s.CesiumMath.TWO_PI),o>s.CesiumMath.PI&&(o-=s.CesiumMath.TWO_PI)),n.defined(i)?(i.west=o,i.south=l,i.east=h,i.north=c,i):new u(o,l,h,c)},u.clone=function(t,e){if(n.defined(t))return n.defined(e)?(e.west=t.west,e.south=t.south,e.east=t.east,e.north=t.north,e):new u(t.west,t.south,t.east,t.north)},u.equalsEpsilon=function(t,e,a){return a=n.defaultValue(a,0),t===e||n.defined(t)&&n.defined(e)&&Math.abs(t.west-e.west)<=a&&Math.abs(t.south-e.south)<=a&&Math.abs(t.east-e.east)<=a&&Math.abs(t.north-e.north)<=a},u.prototype.clone=function(t){return u.clone(this,t)},u.prototype.equals=function(t){return u.equals(this,t)},u.equals=function(t,e){return t===e||n.defined(t)&&n.defined(e)&&t.west===e.west&&t.south===e.south&&t.east===e.east&&t.north===e.north},u.prototype.equalsEpsilon=function(t,e){return u.equalsEpsilon(this,t,e)},u.validate=function(t){},u.southwest=function(t,a){return n.defined(a)?(a.longitude=t.west,a.latitude=t.south,a.height=0,a):new e.Cartographic(t.west,t.south)},u.northwest=function(t,a){return n.defined(a)?(a.longitude=t.west,a.latitude=t.north,a.height=0,a):new e.Cartographic(t.west,t.north)},u.northeast=function(t,a){return n.defined(a)?(a.longitude=t.east,a.latitude=t.north,a.height=0,a):new e.Cartographic(t.east,t.north)},u.southeast=function(t,a){return n.defined(a)?(a.longitude=t.east,a.latitude=t.south,a.height=0,a):new e.Cartographic(t.east,t.south)},u.center=function(t,a){let u=t.east;const i=t.west;u<i&&(u+=s.CesiumMath.TWO_PI);const o=s.CesiumMath.negativePiToPi(.5*(i+u)),h=.5*(t.south+t.north);return n.defined(a)?(a.longitude=o,a.latitude=h,a.height=0,a):new e.Cartographic(o,h)},u.intersection=function(t,e,a){let
|