SpatialReference.js 3.5 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.25/esri/copyright.txt for details.
  4. */
  5. import{_ as e}from"../chunks/tslib.es6.js";import{JSONSupport as t}from"../core/JSONSupport.js";import{clone as r}from"../core/lang.js";import{Integer as i}from"../core/accessorSupport/ensureType.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../core/accessorSupport/decorators/writer.js";import{WGS84 as a,WebMercator as l,PlateCarree as c,isWGS84 as d,isWebMercator as p,isGeographic as u,isWrappable as m,equals as w}from"./support/spatialReferenceUtils.js";var y;let S=y=class extends t{constructor(e){super(e),this.latestWkid=null,this.wkid=null,this.wkt=null,this.vcsWkid=null,this.latestVcsWkid=null,this.imageCoordinateSystem=null}static fromJSON(e){if(!e)return null;if(e.wkid){if(102100===e.wkid)return y.WebMercator;if(4326===e.wkid)return y.WGS84}const t=new y;return t.read(e),t}normalizeCtorArgs(e){if(e&&"object"==typeof e)return e;return{["string"==typeof e?"wkt":"wkid"]:e}}get isWGS84(){return d(this)}get isWebMercator(){return p(this)}get isGeographic(){return u(this)}get isWrappable(){return m(this)}writeWkt(e,t){this.wkid||(t.wkt=e)}clone(){if(this===y.WGS84)return y.WGS84;if(this===y.WebMercator)return y.WebMercator;const e=new y;return null!=this.wkid?(e.wkid=this.wkid,null!=this.latestWkid&&(e.latestWkid=this.latestWkid),null!=this.vcsWkid&&(e.vcsWkid=this.vcsWkid),null!=this.latestVcsWkid&&(e.latestVcsWkid=this.latestVcsWkid)):null!=this.wkt&&(e.wkt=this.wkt),this.imageCoordinateSystem&&(e.imageCoordinateSystem=r(this.imageCoordinateSystem)),e}equals(e){if(null==e)return!1;if(this.imageCoordinateSystem||e.imageCoordinateSystem){if(null==this.imageCoordinateSystem||null==e.imageCoordinateSystem)return!1;const{id:t,referenceServiceName:r}=e.imageCoordinateSystem,{geodataXform:i}=e.imageCoordinateSystem,o=this.imageCoordinateSystem;return null==t||i?JSON.stringify(o)===JSON.stringify(e.imageCoordinateSystem):r?o.id===t&&o.referenceServiceName===r:o.id===t}return w(this,e)}toJSON(e){return this.write(void 0,e)}};S.GCS_NAD_1927=null,S.WGS84=null,S.WebMercator=null,S.PlateCarree=null,e([o({readOnly:!0})],S.prototype,"isWGS84",null),e([o({readOnly:!0})],S.prototype,"isWebMercator",null),e([o({readOnly:!0})],S.prototype,"isGeographic",null),e([o({readOnly:!0})],S.prototype,"isWrappable",null),e([o({type:i,json:{write:!0}})],S.prototype,"latestWkid",void 0),e([o({type:i,json:{write:!0,origins:{"web-scene":{write:{overridePolicy(){return{isRequired:null===this.wkt}}}}}}})],S.prototype,"wkid",void 0),e([o({type:String,json:{origins:{"web-scene":{write:{overridePolicy(){return{isRequired:null===this.wkid}}}}}}})],S.prototype,"wkt",void 0),e([n("wkt"),n("web-scene","wkt")],S.prototype,"writeWkt",null),e([o({type:i,json:{write:!0}})],S.prototype,"vcsWkid",void 0),e([o({type:i,json:{write:!0}})],S.prototype,"latestVcsWkid",void 0),e([o()],S.prototype,"imageCoordinateSystem",void 0),S=y=e([s("esri.geometry.SpatialReference")],S),S.prototype.toJSON.isDefaultToJSON=!0,S.GCS_NAD_1927=new S({wkid:4267,wkt:'GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'}),S.WGS84=new S(a),S.WebMercator=new S(l),S.PlateCarree=new S(c),Object.freeze&&(Object.freeze(S.GCS_NAD_1927),Object.freeze(S.WGS84),Object.freeze(S.WebMercator));const k=S;export{k as default};