@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 5.29 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../PopupTemplate.js";import{ClonableMixin as t}from"../core/Clonable.js";import i from"../core/Logger.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as s,throwIfAbortError as a}from"../core/promiseUtils.js";import{property as n,subclass as p}from"../core/accessorSupport/decorators.js";import l from"../graphic/ImageryGraphicOrigin.js";import m from"./Layer.js";import{ArcGISImageService as u}from"./mixins/ArcGISImageService.js";import{ArcGISService as d}from"./mixins/ArcGISService.js";import{BlendLayer as c}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as v}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as g}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as j}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as L}from"./mixins/TemporalLayer.js";import{legendEnabled as I,popupEnabled as b,screenSizePerspectiveEnabled as P}from"./support/commonProperties.js";import{setDefaultRasterFieldFormats as S,commonRasterFieldNames as x,rasterDimensionFieldPrefix as _}from"./support/rasterFieldUtils.js";import{serviceSupportsSpatialReference as O}from"./support/versionUtils.js";import{logInvalidElevationInfoWarning as E,elevationModeUnsupportedMessage as T,featureExpressionUnsupportedMessage as R}from"../support/elevationInfoUtils.js";import{createPopupTemplate as C}from"../support/popupUtils.js";import M from"../symbols/support/ElevationInfo.js";import{addLayerUnsupportedError as A}from"../webdoc/support/unsupportedErrors.js";let F=class extends(c(L(w(f(h(g(u(v(j(y(d(o(t(m)))))))))))))){constructor(...e){super(...e),this.graphicOrigin=new l(this),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.type="imagery",this._debouncedSaveOperations=s(async(e,r,t)=>{const{save:i,saveAs:o}=await import("./save/imageryUtils.js");switch(e){case 0:return i(this,r);case 1:return o(this,t,r)}})}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(a).then(()=>this._fetchService(r))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(e){this._set("legendEnabled",e)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(e){this._set("listMode",e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){return!(!this.raster||!this.url?.toLowerCase().includes("/rasterrendering/imageserver"))}createPopupTemplate(e){const{rasterFields:r}=this,t=new Set,i=x.itemPixelValue.toLowerCase(),o="raster-dataset"===this.sourceType,s=_.toLowerCase(),a=`${x.servicePixelValue.toLowerCase()}.`;for(const l of r){const e=l.name.toLowerCase();e===i||e.startsWith(a)||o&&e.startsWith(s)||t.add(l.name)}const n=C({fields:r,title:this.title},{...e,visibleFieldNames:t}),{rasterInfo:p}=this;return n?.fieldInfos&&p&&S(n.fieldInfos,p),n}queryFeatures(e,r){return this.queryRasters(e,r).then(e=>{if(e?.features)for(const r of e.features)r.layer=r.sourceLayer=this,r.origin=this.graphicOrigin;return e})}queryFeatureCount(e,r){return this.queryRasterCount(e,r)}redraw(){this.emit("redraw")}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,r){return this._debouncedSaveOperations(1,r,e)}serviceSupportsSpatialReference(e){return O(this,e)}write(e,r){return this._isPreviewLayer?(A(r,this,"preview layer cannot be saved"),null):super.write(e,r)}_validateElevationInfo(e){E(i.getLogger(this),T("Imagery layers","relative-to-scene",e)),E(i.getLogger(this),R("Imagery layers",e))}};e([n({type:M,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],F.prototype,"elevationInfo",null),e([n({readOnly:!0,clonable:!1})],F.prototype,"graphicOrigin",void 0),e([n(I)],F.prototype,"legendEnabled",null),e([n({type:["show","hide"]})],F.prototype,"listMode",null),e([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],F.prototype,"isReference",void 0),e([n({type:["ArcGISImageServiceLayer"]})],F.prototype,"operationalLayerType",void 0),e([n(b)],F.prototype,"popupEnabled",void 0),e([n({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],F.prototype,"popupTemplate",void 0),e([n({readOnly:!0})],F.prototype,"defaultPopupTemplate",null),e([n(P)],F.prototype,"screenSizePerspectiveEnabled",void 0),e([n({readOnly:!0,json:{read:!1}})],F.prototype,"type",void 0),e([n({readOnly:!0})],F.prototype,"_isPreviewLayer",null),F=e([p("esri.layers.ImageryLayer")],F);const U=F;export{U as default};