UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 2.54 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as t}from"../../chunks/tslib.es6.js";import{getProjectiveTransform as o,transformProjective as e}from"../../core/perspectiveUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{create as l}from"../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as n}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import c from"../../geometry/Point.js";import m from"../../geometry/Polygon.js";import{projectOrLoad as a}from"../../geometry/projectionUtils.js";import f from"./GeoreferenceBase.js";const u=p();let y=class extends f{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:o,bottomLeft:e,bottomRight:r}=this;if(null==t||null==o||null==e||null==r)return null;const s=t.spatialReference;return o=this.projectOrWarn(o,s),e=this.projectOrWarn(e,s),r=this.projectOrWarn(r,s),null==o||null==e||null==r?null:new m({rings:[[[e.x,e.y],[t.x,t.y],[o.x,o.y],[r.x,r.y],[e.x,e.y]]],spatialReference:s})}set coords(t){const{topLeft:o}=this;if(null==o)return;const e=o.spatialReference;if(null==(t=this.projectOrWarn(t,e)))return;const{rings:[[r,s,i,l]]}=t;this.bottomLeft=new c({x:r[0],y:r[1],spatialReference:e}),this.topLeft=new c({x:s[0],y:s[1],spatialReference:e}),this.topRight=new c({x:i[0],y:i[1],spatialReference:e}),this.bottomRight=new c({x:l[0],y:l[1],spatialReference:e})}toSourceNormalized(t){const{topLeft:s,topRight:i,bottomRight:p,bottomLeft:c}=this;if(null==t||null==s||null==i||null==p||null==c)return null;const m=s.spatialReference;t=t.normalize();const f=a(t,m).geometry;if(null==f)return null;n(u,f.x,f.y);const y=o(l(),[s.x,s.y,c.x,c.y,i.x,i.y,p.x,p.y],[0,0,0,1,1,0,1,1]);return e(u,u,y),r(u[0],u[1])}};t([s({clonable:!1})],y.prototype,"coords",null),t([s({type:c})],y.prototype,"bottomLeft",void 0),t([s({type:c})],y.prototype,"bottomRight",void 0),t([s({type:c})],y.prototype,"topLeft",void 0),t([s({type:c})],y.prototype,"topRight",void 0),y=t([i("esri.layers.support.CornersGeoreference")],y);const h=y;export{h as default};