1 |
- define(["exports","./buildModuleUrl-8cce5713","./Cartesian4-b0ddc4ba","./Check-7b2a090c","./when-b60132fc"],(function(t,e,i,n,h){"use strict";function r(t,e,i,n){this.x=h.defaultValue(t,0),this.y=h.defaultValue(e,0),this.width=h.defaultValue(i,0),this.height=h.defaultValue(n,0)}r.packedLength=4,r.pack=function(t,e,i){return i=h.defaultValue(i,0),e[i++]=t.x,e[i++]=t.y,e[i++]=t.width,e[i]=t.height,e},r.unpack=function(t,e,i){return e=h.defaultValue(e,0),h.defined(i)||(i=new r),i.x=t[e++],i.y=t[e++],i.width=t[e++],i.height=t[e],i},r.fromPoints=function(t,e){if(h.defined(e)||(e=new r),!h.defined(t)||0===t.length)return e.x=0,e.y=0,e.width=0,e.height=0,e;for(var i=t.length,n=t[0].x,a=t[0].y,d=t[0].x,u=t[0].y,c=1;c<i;c++){var o=t[c],f=o.x,x=o.y;n=Math.min(f,n),d=Math.max(f,d),a=Math.min(x,a),u=Math.max(x,u)}return e.x=n,e.y=a,e.width=d-n,e.height=u-a,e};var a=new e.GeographicProjection,d=new i.Cartographic,u=new i.Cartographic;r.fromRectangle=function(t,i,n){if(h.defined(n)||(n=new r),!h.defined(t))return n.x=0,n.y=0,n.width=0,n.height=0,n;var c=(i=h.defaultValue(i,a)).project(e.Rectangle.southwest(t,d)),o=i.project(e.Rectangle.northeast(t,u));return e.Cartesian2.subtract(o,c,o),n.x=c.x,n.y=c.y,n.width=o.x,n.height=o.y,n},r.clone=function(t,e){if(h.defined(t))return h.defined(e)?(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e):new r(t.x,t.y,t.width,t.height)},r.union=function(t,e,i){h.defined(i)||(i=new r);var n=Math.min(t.x,e.x),a=Math.min(t.y,e.y),d=Math.max(t.x+t.width,e.x+e.width),u=Math.max(t.y+t.height,e.y+e.height);return i.x=n,i.y=a,i.width=d-n,i.height=u-a,i},r.expand=function(t,e,i){i=r.clone(t,i);var n=e.x-i.x,h=e.y-i.y;return n>i.width?i.width=n:n<0&&(i.width-=n,i.x=e.x),h>i.height?i.height=h:h<0&&(i.height-=h,i.y=e.y),i},r.intersect=function(t,i){var n=t.x,h=t.y,r=i.x,a=i.y;return n>r+i.width||n+t.width<r||h+t.height<a||h>a+i.height?e.Intersect.OUTSIDE:e.Intersect.INTERSECTING},r.equals=function(t,e){return t===e||h.defined(t)&&h.defined(e)&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height},r.prototype.clone=function(t){return r.clone(this,t)},r.prototype.intersect=function(t){return r.intersect(this,t)},r.prototype.equals=function(t){return r.equals(this,t)},t.BoundingRectangle=r}));
|