UNPKG

@dp_unity/dpu-gis-viewer

Version:

DPU GIS Viewer version Beta

2 lines 2.42 kB
/*! For license information please see chunk-PJUDOIE3.js.LICENSE.txt */ import{a as L,b as x}from"./chunk-K2M3OJ7Z.js";import{h as R}from"./chunk-M3A6SPGI.js";import{b as d,c as O,d as g}from"./chunk-S4VBGY2U.js";import{a as w}from"./chunk-N3A5CZ2S.js";import{b as m}from"./chunk-G75U3WZT.js";import{e as f}from"./chunk-3THTQ4QB.js";function t(t,e,h,i){this.x=w(t,0),this.y=w(e,0),this.width=w(h,0),this.height=w(i,0)}t.packedLength=4,t.pack=function(t,e,h){return m.typeOf.object("value",t),m.defined("array",e),h=w(h,0),e[h++]=t.x,e[h++]=t.y,e[h++]=t.width,e[h]=t.height,e},t.unpack=function(e,h,i){return m.defined("array",e),h=w(h,0),f(i)||(i=new t),i.x=e[h++],i.y=e[h++],i.width=e[h++],i.height=e[h],i},t.fromPoints=function(e,h){if(f(h)||(h=new t),!f(e)||0===e.length)return h.x=0,h.y=0,h.width=0,h.height=0,h;let i=e.length,n=e[0].x,r=e[0].y,o=e[0].x,a=e[0].y;for(let t=1;t<i;t++){let h=e[t],i=h.x,f=h.y;n=Math.min(i,n),o=Math.max(i,o),r=Math.min(f,r),a=Math.max(f,a)}return h.x=n,h.y=r,h.width=o-n,h.height=a-r,h};var X=new L,Y=new d,k=new d;t.fromRectangle=function(e,h,i){if(f(i)||(i=new t),!f(e))return i.x=0,i.y=0,i.width=0,i.height=0,i;X._ellipsoid=g.default;let n=(h=w(h,X)).project(R.southwest(e,Y)),r=h.project(R.northeast(e,k));return O.subtract(r,n,r),i.x=n.x,i.y=n.y,i.width=r.x,i.height=r.y,i},t.clone=function(e,h){if(f(e))return f(h)?(h.x=e.x,h.y=e.y,h.width=e.width,h.height=e.height,h):new t(e.x,e.y,e.width,e.height)},t.union=function(e,h,i){m.typeOf.object("left",e),m.typeOf.object("right",h),f(i)||(i=new t);let n=Math.min(e.x,h.x),r=Math.min(e.y,h.y),o=Math.max(e.x+e.width,h.x+h.width),a=Math.max(e.y+e.height,h.y+h.height);return i.x=n,i.y=r,i.width=o-n,i.height=a-r,i},t.expand=function(e,h,i){m.typeOf.object("rectangle",e),m.typeOf.object("point",h),i=t.clone(e,i);let n=h.x-i.x,r=h.y-i.y;return n>i.width?i.width=n:n<0&&(i.width-=n,i.x=h.x),r>i.height?i.height=r:r<0&&(i.height-=r,i.y=h.y),i},t.intersect=function(t,e){m.typeOf.object("left",t),m.typeOf.object("right",e);let h=t.x,i=t.y,n=e.x,r=e.y;return h>n+e.width||h+t.width<n||i+t.height<r||i>r+e.height?x.OUTSIDE:x.INTERSECTING},t.equals=function(t,e){return t===e||f(t)&&f(e)&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height},t.prototype.clone=function(e){return t.clone(this,e)},t.prototype.intersect=function(e){return t.intersect(this,e)},t.prototype.equals=function(e){return t.equals(this,e)};var a=t;export{a};