Agriculture-front-end/public/Cesium/Workers/BoundingRectangle-01b3e970.js

2 lines
2.2 KiB
JavaScript
Raw Normal View History

2023-04-16 22:33:44 +08:00
define(["exports","./Cartesian2-47311507","./Cartographic-3309dd0d","./Check-7b2a090c","./when-b60132fc","./BoundingSphere-561b54d0"],(function(t,e,n,i,h,r){"use strict";function a(t,e,n,i){this.x=h.defaultValue(t,0),this.y=h.defaultValue(e,0),this.width=h.defaultValue(n,0),this.height=h.defaultValue(i,0)}a.packedLength=4,a.pack=function(t,e,n){return n=h.defaultValue(n,0),e[n++]=t.x,e[n++]=t.y,e[n++]=t.width,e[n]=t.height,e},a.unpack=function(t,e,n){return e=h.defaultValue(e,0),h.defined(n)||(n=new a),n.x=t[e++],n.y=t[e++],n.width=t[e++],n.height=t[e],n},a.fromPoints=function(t,e){if(h.defined(e)||(e=new a),!h.defined(t)||0===t.length)return e.x=0,e.y=0,e.width=0,e.height=0,e;for(var n=t.length,i=t[0].x,r=t[0].y,d=t[0].x,u=t[0].y,c=1;c<n;c++){var o=t[c],f=o.x,x=o.y;i=Math.min(f,i),d=Math.max(f,d),r=Math.min(x,r),u=Math.max(x,u)}return e.x=i,e.y=r,e.width=d-i,e.height=u-r,e};var d=new r.GeographicProjection,u=new n.Cartographic,c=new n.Cartographic;a.fromRectangle=function(t,n,i){if(h.defined(i)||(i=new a),!h.defined(t))return i.x=0,i.y=0,i.width=0,i.height=0,i;var r=(n=h.defaultValue(n,d)).project(e.Rectangle.southwest(t,u)),o=n.project(e.Rectangle.northeast(t,c));return e.Cartesian2.subtract(o,r,o),i.x=r.x,i.y=r.y,i.width=o.x,i.height=o.y,i},a.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 a(t.x,t.y,t.width,t.height)},a.union=function(t,e,n){h.defined(n)||(n=new a);var i=Math.min(t.x,e.x),r=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 n.x=i,n.y=r,n.width=d-i,n.height=u-r,n},a.expand=function(t,e,n){n=a.clone(t,n);var 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},a.intersect=function(t,e){var n=t.x,i=t.y,h=e.x,a=e.y;return n>h+e.width||n+t.width<h||i+t.height<a||i>a+e.height?r.Intersect.OUTSIDE:r.Intersect.INTERSECTING},a.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},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.BoundingRectangle=a}));