UNPKG

@arcgis/core

Version:

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

1 lines • 9.71 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[561],{5359(e,t,r){r.d(t,{H:()=>s,Z:()=>i});const s=Symbol("isImageryTileGraphicOrigin");function i(e){return!!e&&s in e}},90561(e,t,r){r.r(t),r.d(t,{default:()=>B});var s,i=r(5482),a=r(37838),o=r(69540),n=r(49186),l=r(53966),p=r(25728),c=r(74887),h=r(36708),u=r(91429),d=r(56507),y=r(89808),g=r(99959),m=r(5359);class f extends g.A{get[(s=m.H,y.Q)](){return this.layer}constructor(e){super(),this[s]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var v=r(4146),w=r(18768),R=r(63074),S=r(69208),_=r(16131),O=r(8303),I=r(72545),F=r(56551),C=r(54310),b=r(25036),M=r(82935),A=r(82806),P=r(7548),N=r(23636),J=r(1003),T=r(99235),Z=r(10873),L=r(20437),x=r(74797),E=r(22796),j=r(87045),D=r(24212),W=r(30291),k=r(88625),U=r(59923);let z=class extends((0,R.dM)((0,b.j)((0,_.q)((0,O.A)((0,F.H)((0,S.d)((0,A.b)((0,I.G)((0,M.e)((0,w.b)((0,C.J)((0,p.M)((0,o.OU)(v.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.graphicOrigin=new f(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,c.sg)(async(e,t,s)=>{const{save:i,saveAs:a}=await r.e(9838).then(r.bind(r,59838));switch(e){case 0:return i(this,t);case 1:return a(this,s,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[(0,x.rZ)("Pixel Value"),(0,x.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=(0,x.jC)(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=(0,x.DV)(t),s=(0,x.y6)();e.push(r,s)}if(i){const t=(0,x.AL)(i);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==x.F_.rawServicePixelValue)),s=(0,W.tn)({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&(0,x.h4)(s.fieldInfos,i),s}async generateRasterInfo(e,t){const r=(0,d.PZ)(E.A,e);if(await this.load(),!r||"none"===r.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:e}=await this._openFunctionRaster(r,t);return e}catch(e){if(e instanceof n.A)throw e;throw new n.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsWrite(){const e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,U.U4)(t,this),null)}async hasDataChanged(){try{const e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:r}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),r&&this.read(r,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,P.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:s}=this;if(!t&&!s)throw new n.A("imagery-tile-layer:open","missing url or source parameter");s?await this._openFromSource(s,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new n.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,h.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,P.pb)(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const s=[e];t&&(0,T.UD)(t.toJSON(),s);const i=await Promise.all(s.map(e=>J.default.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r}))),a=i.findIndex(e=>null==e);if(a>-1)throw new n.A("imagery-tile-layer:open",`cannot open raster: ${s[a]}`);return this._primaryRasters=i,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await J.default.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new n.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",s="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!s)throw new n.A("imagery-tile-layer:open",r);"MEMORY"===s&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const i=await J.default.open({url:"",source:e,datasetFormat:s,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==i)throw new n.A("imagery-tile-layer:open",r);this._primaryRasters=[i],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=i}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>r[e.url]=e);const s=(0,T.vt)(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new N.A({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof n.A&&l.A.getLogger(this).error("imagery-tile-layer:open",e.message),l.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,D.XF)(l.A.getLogger(this),(0,D.$7)("ImageryTile layers","relative-to-scene",e)),(0,D.XF)(l.A.getLogger(this),(0,D.tW)("ImageryTile layers",e))}};(0,i.Cg)([(0,u.MZ)({clonable:!1})],z.prototype,"_primaryRasters",void 0),(0,i.Cg)([(0,u.MZ)({type:k.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],z.prototype,"elevationInfo",null),(0,i.Cg)([(0,u.MZ)({type:j.A})],z.prototype,"tileInfo",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,clonable:!1})],z.prototype,"graphicOrigin",void 0),(0,i.Cg)([(0,u.MZ)(Z.fV)],z.prototype,"legendEnabled",void 0),(0,i.Cg)([(0,u.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],z.prototype,"isReference",void 0),(0,i.Cg)([(0,u.MZ)({type:["show","hide"]})],z.prototype,"listMode",void 0),(0,i.Cg)([(0,u.MZ)({json:{read:!0,write:!0}})],z.prototype,"blendMode",void 0),(0,i.Cg)([(0,u.MZ)({type:E.A,json:{name:"renderingRule",write:!0}})],z.prototype,"rasterFunction",void 0),(0,i.Cg)([(0,u.MZ)()],z.prototype,"sourceJSON",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],z.prototype,"version",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),(0,i.Cg)([(0,u.MZ)({type:["ArcGISTiledImageServiceLayer"]})],z.prototype,"operationalLayerType",void 0),(0,i.Cg)([(0,u.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],z.prototype,"popupEnabled",void 0),(0,i.Cg)([(0,u.MZ)({type:a.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],z.prototype,"popupTemplate",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),(0,i.Cg)([(0,u.MZ)(Z.PY)],z.prototype,"screenSizePerspectiveEnabled",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,type:[L.A]})],z.prototype,"fields",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,type:[L.A]})],z.prototype,"rasterFields",null),(0,i.Cg)([(0,u.MZ)({constructOnly:!0})],z.prototype,"source",void 0),z=(0,i.Cg)([(0,u.$K)("esri.layers.ImageryTileLayer")],z);const B=z}}]);