@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 4.67 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import r from"../../core/Identifiable.js";import{MultiOriginJSONSupport as s}from"../../core/MultiOriginJSONSupport.js";import{on as o,watch as i,sync as l}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{ensureType as d}from"../../core/accessorSupport/ensureType.js";import u from"../../geometry/Extent.js";var h;let c=0,m=h=class extends(r.IdentifiableMixin(s)){constructor(e){super(e),this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.legendUrl=null,this.legendEnabled=!0,this.layer=null,this.maxScale=0,this.minScale=0,this.name=null,this.parent=null,this.popupEnabled=!1,this.queryable=!1,this.sublayers=null,this.spatialReferences=null,this.title=null,this.addHandles([o((()=>this.sublayers),"after-add",(({item:e})=>{e.parent=this,e.layer=this.layer}),l),o((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=e.parent=null}),l),i((()=>this.sublayers),((e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=this,r.layer=this.layer}),l),i((()=>this.layer),(e=>{if(this.sublayers)for(const t of this.sublayers)t.layer=e}),l)])}get id(){const e=this._get("id");return e??c++}set id(e){this._set("id",e)}readLegendUrl(e,t){return t.legendUrl??t.legendURL??null}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}castSublayers(e){return d(t.ofType(h),e)}set visible(e){this._setAndNotifyLayer("visible",e)}clone(){const e=new h;return this.hasOwnProperty("description")&&(e.description=this.description),this.hasOwnProperty("fullExtent")&&(e.fullExtent=this.fullExtent.clone()),this.hasOwnProperty("fullExtents")&&(e.fullExtents=this.fullExtents?.map((e=>e.clone()))??null),this.hasOwnProperty("legendUrl")&&(e.legendUrl=this.legendUrl),this.hasOwnProperty("legendEnabled")&&(e.legendEnabled=this.legendEnabled),this.hasOwnProperty("layer")&&(e.layer=this.layer),this.hasOwnProperty("name")&&(e.name=this.name),this.hasOwnProperty("parent")&&(e.parent=this.parent),this.hasOwnProperty("queryable")&&(e.queryable=this.queryable),this.hasOwnProperty("sublayers")&&(e.sublayers=this.sublayers?.map((e=>e.clone()))),this.hasOwnProperty("spatialReferences")&&(e.spatialReferences=this.spatialReferences?.map((e=>e))),this.hasOwnProperty("visible")&&(e.visible=this.visible),this.hasOwnProperty("title")&&(e.title=this.title),e}_setAndNotifyLayer(e,t){const r=this.layer;this._get(e)!==t&&(this._set(e,t),r&&r.emit("wms-sublayer-update",{propertyName:e,id:this.id}))}};e([n()],m.prototype,"description",void 0),e([n({readOnly:!0})],m.prototype,"dimensions",void 0),e([n({type:u,json:{name:"extent"}})],m.prototype,"fullExtent",void 0),e([n()],m.prototype,"fullExtents",void 0),e([n({type:Number,json:{write:{enabled:!1,overridePolicy:()=>({ignoreOrigin:!0,enabled:!0})}}})],m.prototype,"id",null),e([n({type:String,json:{name:"legendUrl",write:{ignoreOrigin:!0}}})],m.prototype,"legendUrl",void 0),e([p("legendUrl",["legendUrl","legendURL"])],m.prototype,"readLegendUrl",null),e([n({type:Boolean,json:{name:"showLegend",origins:{"web-map":{read:!1,write:!1},"web-scene":{read:!1,write:!1}}}})],m.prototype,"legendEnabled",void 0),e([n()],m.prototype,"layer",void 0),e([n()],m.prototype,"maxScale",void 0),e([n()],m.prototype,"minScale",void 0),e([n({readOnly:!0})],m.prototype,"effectiveScaleRange",null),e([n({type:String,json:{write:{ignoreOrigin:!0}}})],m.prototype,"name",void 0),e([n()],m.prototype,"parent",void 0),e([n({type:Boolean,json:{read:{source:"showPopup"},write:{ignoreOrigin:!0,target:"showPopup"}}})],m.prototype,"popupEnabled",void 0),e([n({type:Boolean,json:{write:{ignoreOrigin:!0}}})],m.prototype,"queryable",void 0),e([n()],m.prototype,"sublayers",void 0),e([a("sublayers")],m.prototype,"castSublayers",null),e([n({type:[Number],json:{read:{source:"spatialReferences"}}})],m.prototype,"spatialReferences",void 0),e([n({type:String,json:{write:{ignoreOrigin:!0}}})],m.prototype,"title",void 0),e([n({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"}}})],m.prototype,"visible",null),m=h=e([y("esri.layers.support.WMSSublayer")],m);export{m as default};