@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.38 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as t}from"tslib";import{Clonable as e}from"../../core/Clonable.js";import{getProjectiveTransform as o,transformProjective as r}from"../../core/perspectiveUtils.js";import{createScreenPoint as l}from"../../core/screenUtils.js";import{property as s,subclass as i}from"../../core/accessorSupport/decorators.js";import{create as n}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as p}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import m from"../../geometry/Point.js";import f from"../../geometry/Polygon.js";import{projectOrLoad as a}from"../../geometry/projectionUtils.js";import{GeoreferenceBaseMixin as u}from"./GeoreferenceBaseMixin.js";const y=c();let h=class extends(u(e)){constructor(t){super(t),this.bottomLeft=null,this.bottomRight=null,this.topLeft=null,this.topRight=null,this.type="corners"}get coords(){let{topLeft:t,topRight:e,bottomLeft:o,bottomRight:r}=this;if(null==t||null==e||null==o||null==r)return null;const l=t.spatialReference;return e=this.projectOrWarn(e,l),o=this.projectOrWarn(o,l),r=this.projectOrWarn(r,l),null==e||null==o||null==r?null:new f({rings:[[[o.x,o.y],[t.x,t.y],[e.x,e.y],[r.x,r.y],[o.x,o.y]]],spatialReference:l})}set coords(t){const{topLeft:e}=this;if(null==e)return;const o=e.spatialReference;if(null==(t=this.projectOrWarn(t,o)))return;const{rings:[[r,l,s,i]]}=t;this.bottomLeft=new m({x:r[0],y:r[1],spatialReference:o}),this.topLeft=new m({x:l[0],y:l[1],spatialReference:o}),this.topRight=new m({x:s[0],y:s[1],spatialReference:o}),this.bottomRight=new m({x:i[0],y:i[1],spatialReference:o})}toSourceNormalized(t){const{topLeft:e,topRight:s,bottomRight:i,bottomLeft:c}=this;if(null==t||null==e||null==s||null==i||null==c)return null;const m=e.spatialReference;t=t.normalize();const f=a(t,m).geometry;if(null==f)return null;p(y,f.x,f.y);const u=o(n(),[e.x,e.y,c.x,c.y,s.x,s.y,i.x,i.y],[0,0,0,1,1,0,1,1]);return r(y,y,u),l(y[0],y[1])}};t([s({clonable:!1})],h.prototype,"coords",null),t([s({type:m})],h.prototype,"bottomLeft",void 0),t([s({type:m})],h.prototype,"bottomRight",void 0),t([s({type:m})],h.prototype,"topLeft",void 0),t([s({type:m})],h.prototype,"topRight",void 0),h=t([i("esri.layers.support.CornersGeoreference")],h);const g=h;export{g as default};