qa-prevention-gwj-vue/static/map/cesium91/CesiumUnminified/Workers/BoundingRectangle-0e36efc3.js

2 lines
2.3 KiB
JavaScript
Raw Normal View History

2023-12-17 15:30:40 +08:00
define(["exports","./Cartesian2-bd414876","./Check-741c5f3c","./defaultValue-81eec7ed","./GeographicProjection-c931c7fb","./BoundingSphere-9a3b5656","./Rectangle-cf3e0e3e"],(function(t,e,n,i,h,r,c){"use strict";function d(t,e,n,h){this.x=i.defaultValue(t,0),this.y=i.defaultValue(e,0),this.width=i.defaultValue(n,0),this.height=i.defaultValue(h,0)}d.packedLength=4,d.pack=function(t,e,n){return n=i.defaultValue(n,0),e[n++]=t.x,e[n++]=t.y,e[n++]=t.width,e[n]=t.height,e},d.unpack=function(t,e,n){return e=i.defaultValue(e,0),i.defined(n)||(n=new d),n.x=t[e++],n.y=t[e++],n.width=t[e++],n.height=t[e],n},d.fromPoints=function(t,e){if(i.defined(e)||(e=new d),!i.defined(t)||0===t.length)return e.x=0,e.y=0,e.width=0,e.height=0,e;const n=t.length;let h=t[0].x,r=t[0].y,c=t[0].x,u=t[0].y;for(let e=1;e<n;e++){const n=t[e],i=n.x,d=n.y;h=Math.min(i,h),c=Math.max(i,c),r=Math.min(d,r),u=Math.max(d,u)}return e.x=h,e.y=r,e.width=c-h,e.height=u-r,e};const u=new h.GeographicProjection,a=new e.Cartographic,o=new e.Cartographic;d.fromRectangle=function(t,n,h){if(i.defined(h)||(h=new d),!i.defined(t))return h.x=0,h.y=0,h.width=0,h.height=0,h;const r=(n=i.defaultValue(n,u)).project(c.Rectangle.southwest(t,a)),f=n.project(c.Rectangle.northeast(t,o));return e.Cartesian2.subtract(f,r,f),h.x=r.x,h.y=r.y,h.width=f.x,h.height=f.y,h},d.clone=function(t,e){if(i.defined(t))return i.defined(e)?(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e):new d(t.x,t.y,t.width,t.height)},d.union=function(t,e,n){i.defined(n)||(n=new d);const h=Math.min(t.x,e.x),r=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 n.x=h,n.y=r,n.width=c-h,n.height=u-r,n},d.expand=function(t,e,n){n=d.clone(t,n);const i=e.x-n.x,h=e.y-n.y;return i>n.width?n.width=i:i<0&&(n.width-=i,n.x=e.x),h>n.height?n.height=h:h<0&&(n.height-=h,n.y=e.y),n},d.intersect=function(t,e){const n=t.x,i=t.y,h=e.x,c=e.y;return n>h+e.width||n+t.width<h||i+t.height<c||i>c+e.height?r.Intersect.OUTSIDE:r.Intersect.INTERSECTING},d.equals=function(t,e){return t===e||i.defined(t)&&i.defined(e)&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height},d.prototype.clone=function(t){return d.clone(this,t)},d.prototype.intersect=function(t){return d.intersect(this,t)},d.prototype.equals=function(t){return d.equals(this,t)},t.BoundingRectangle=d}));