BoundingRectangle-418864a2.js 2.3 KB

1
  1. define(["exports","./Cartesian2-6033fa5d","./Cartographic-67e73ef9","./Check-52a7d806","./when-92c6cf3c","./Intersect-b97e930a","./Rectangle-bab7abf0"],(function(t,e,h,i,n,r,o){"use strict";function a(t,e,h,i){this.x=n.u(t,0),this.y=n.u(e,0),this.width=n.u(h,0),this.height=n.u(i,0)}a.packedLength=4,a.pack=function(t,e,h){return i.o.typeOf.object("value",t),i.o.defined("array",e),h=n.u(h,0),e[h++]=t.x,e[h++]=t.y,e[h++]=t.width,e[h]=t.height,e},a.unpack=function(t,e,h){return i.o.defined("array",t),e=n.u(e,0),n.e(h)||(h=new a),h.x=t[e++],h.y=t[e++],h.width=t[e++],h.height=t[e],h},a.fromPoints=function(t,e){if(n.e(e)||(e=new a),!n.e(t)||0===t.length)return e.x=0,e.y=0,e.width=0,e.height=0,e;for(var h=t.length,i=t[0].x,r=t[0].y,o=t[0].x,c=t[0].y,u=1;u<h;u++){var y=t[u],f=y.x,x=y.y;i=Math.min(f,i),o=Math.max(f,o),r=Math.min(x,r),c=Math.max(x,c)}return e.x=i,e.y=r,e.width=o-i,e.height=c-r,e};var c=new r.n,u=new h.t$1,y=new h.t$1;a.fromRectangle=function(t,h,i){if(n.e(i)||(i=new a),!n.e(t))return i.x=0,i.y=0,i.width=0,i.height=0,i;var r=(h=n.u(h,c)).project(o.h.southwest(t,u)),f=h.project(o.h.northeast(t,y));return e.o.subtract(f,r,f),i.x=r.x,i.y=r.y,i.width=f.x,i.height=f.y,i},a.clone=function(t,e){if(n.e(t))return n.e(e)?(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e):new a(t.x,t.y,t.width,t.height)},a.union=function(t,e,h){i.o.typeOf.object("left",t),i.o.typeOf.object("right",e),n.e(h)||(h=new a);var r=Math.min(t.x,e.x),o=Math.min(t.y,e.y),c=Math.max(t.x+t.width,e.x+e.width),u=Math.max(t.y+t.height,e.y+e.height);return h.x=r,h.y=o,h.width=c-r,h.height=u-o,h},a.expand=function(t,e,h){i.o.typeOf.object("rectangle",t),i.o.typeOf.object("point",e),h=a.clone(t,h);var n=e.x-h.x,r=e.y-h.y;return n>h.width?h.width=n:n<0&&(h.width-=n,h.x=e.x),r>h.height?h.height=r:r<0&&(h.height-=r,h.y=e.y),h},a.intersect=function(t,e){i.o.typeOf.object("left",t),i.o.typeOf.object("right",e);var h=t.x,n=t.y,o=e.x,a=e.y;return h>o+e.width||h+t.width<o||n+t.height<a||n>a+e.height?r.S.OUTSIDE:r.S.INTERSECTING},a.equals=function(t,e){return t===e||n.e(t)&&n.e(e)&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height},a.prototype.clone=function(t){return a.clone(this,t)},a.prototype.intersect=function(t){return a.intersect(this,t)},a.prototype.equals=function(t){return a.equals(this,t)},t.f=a}));