UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 3.51 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 e from"../../core/Collection.js";import r from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as i}from"../../core/accessorSupport/decorators/reader.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../geometry/Extent.js";import a from"./TileMatrixSet.js";import n from"./WMTSStyle.js";var p;let m=p=class extends r{constructor(t){super(t),this.description=null,this.fullExtent=null,this.fullExtents=null,this.id=null,this.imageFormats=null,this.layer=null,this.parent=null,this.styles=null,this.title=null,this.tileMatrixSetId=null,this.tileMatrixSets=null}readFullExtent(t,e){return(t=e.fullExtent)?l.fromJSON(t):null}readFullExtents(t,e){return e.fullExtents?.length?e.fullExtents.map((t=>l.fromJSON(t))):e.tileMatrixSets?.map((t=>l.fromJSON(t.fullExtent))).filter((t=>t))??[]}get imageFormat(){let t=this._get("imageFormat");return t||(t=this.imageFormats?.length?this.imageFormats[0]:""),t}set imageFormat(t){const e=this.imageFormats;t&&(t.includes("image/")||e&&!e.includes(t))&&(t.includes("image/")||(t="image/"+t),e&&!e.includes(t))?console.error("The layer doesn't support the format of "+t):this._set("imageFormat",t)}get styleId(){let t=this._get("styleId");return t||(t=this.styles?.at(0)?.id??""),t}set styleId(t){this._set("styleId",t)}get tileMatrixSet(){return this.tileMatrixSets?.find((({id:t})=>t===this.tileMatrixSetId))??null}clone(){const t=new p;return this.hasOwnProperty("description")&&(t.description=this.description),this.hasOwnProperty("imageFormats")&&(t.imageFormats=this.imageFormats?.slice()??null),this.hasOwnProperty("imageFormat")&&(t.imageFormat=this.imageFormat),this.hasOwnProperty("fullExtent")&&(t.fullExtent=this.fullExtent?.clone()),this.hasOwnProperty("id")&&(t.id=this.id),this.hasOwnProperty("layer")&&(t.layer=this.layer),this.hasOwnProperty("styleId")&&(t.styleId=this.styleId),this.hasOwnProperty("styles")&&(t.styles=this.styles?.clone()),this.hasOwnProperty("tileMatrixSetId")&&(t.tileMatrixSetId=this.tileMatrixSetId),this.hasOwnProperty("tileMatrixSets")&&(t.tileMatrixSets=this.tileMatrixSets?.clone()),this.hasOwnProperty("title")&&(t.title=this.title),t}};t([s()],m.prototype,"description",void 0),t([s({type:l})],m.prototype,"fullExtent",void 0),t([i("fullExtent",["fullExtent"])],m.prototype,"readFullExtent",null),t([s({readOnly:!0})],m.prototype,"fullExtents",void 0),t([i("fullExtents",["fullExtents","tileMatrixSets"])],m.prototype,"readFullExtents",null),t([s()],m.prototype,"id",void 0),t([s()],m.prototype,"imageFormat",null),t([s({json:{read:{source:"formats"}}})],m.prototype,"imageFormats",void 0),t([s()],m.prototype,"layer",void 0),t([s()],m.prototype,"parent",void 0),t([s()],m.prototype,"styleId",null),t([s({type:e.ofType(n),json:{read:{source:"styles"}}})],m.prototype,"styles",void 0),t([s({json:{write:{ignoreOrigin:!0}}})],m.prototype,"title",void 0),t([s()],m.prototype,"tileMatrixSetId",void 0),t([s({readOnly:!0})],m.prototype,"tileMatrixSet",null),t([s({type:e.ofType(a),json:{read:{source:"tileMatrixSets"}}})],m.prototype,"tileMatrixSets",void 0),m=p=t([o("esri.layers.support.WMTSSublayer")],m);export{m as default};