@arcgis/core 4.27.0-next.20230331 → 4.27.0-next.20230402
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{c90fff7e28ba5b443b11.js → 1cdc14124617923b5c61.js} +1 -1
- package/assets/esri/core/workers/chunks/2dc876bf9edccddbb835.js +1 -0
- package/assets/esri/core/workers/chunks/44ee28b5488d0d62055a.js +1 -0
- package/assets/esri/core/workers/chunks/4c175664eb97689d66b0.js +1 -0
- package/assets/esri/core/workers/chunks/5a25079cd79e90757cb1.js +1 -0
- package/assets/esri/core/workers/chunks/619c65dd6416bad5e290.js +1 -0
- package/assets/esri/core/workers/chunks/61a843d4b8382d763d23.js +1 -0
- package/assets/esri/core/workers/chunks/{6b63deb4dd0c49cac65f.js → 67a147feb12c01885f3f.js} +1 -1
- package/assets/esri/core/workers/chunks/7cfb6223fb4ca9f30623.js +1 -0
- package/assets/esri/core/workers/chunks/{a0ad8b7ae269757626d7.js → 8d0c3b36971b6b3bde00.js} +1 -1
- package/assets/esri/core/workers/chunks/bbde77128b7f175a3b88.js +1 -0
- package/assets/esri/core/workers/chunks/d72c0c97cc4e30f1e4f2.js +1 -0
- package/assets/esri/core/workers/chunks/f5b6d2b8c8a333bbebdc.js +1 -0
- package/assets/esri/core/workers/chunks/{8980c5dc389c27368b73.js → f9f1bbd7930100e84e50.js} +1 -1
- package/chunks/languageUtils.js +1 -1
- package/interfaces.d.ts +8 -2
- package/layers/BaseTileLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/imageBitmapUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/support/DictionaryLoader.js +1 -1
- package/support/revision.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/Popup.js +1 -1
- package/assets/esri/core/workers/chunks/096b05de593228ccca97.js +0 -1
- package/assets/esri/core/workers/chunks/2b2fd6e77c57a91f467e.js +0 -1
- package/assets/esri/core/workers/chunks/3f488f7a54f1713acd1d.js +0 -1
- package/assets/esri/core/workers/chunks/43df675c76723427f1bd.js +0 -1
- package/assets/esri/core/workers/chunks/4e08816d1614a14cd38a.js +0 -1
- package/assets/esri/core/workers/chunks/83c43913b440617dd06f.js +0 -1
- package/assets/esri/core/workers/chunks/91f939a322dafc0f9f77.js +0 -1
- package/assets/esri/core/workers/chunks/969bb94d5bdc9da114e2.js +0 -1
- package/assets/esri/core/workers/chunks/d0481c858627c7e79308.js +0 -1
- package/assets/esri/core/workers/chunks/f2b393c9490e48b9f1d6.js +0 -1
package/layers/BaseTileLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import i from"../geometry/Extent.js";import a from"../geometry/SpatialReference.js";import{create as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import i from"../geometry/Extent.js";import a from"../geometry/SpatialReference.js";import{create as p}from"../geometry/support/aaBoundingRect.js";import l from"./Layer.js";import{BlendLayer as n}from"./mixins/BlendLayer.js";import{RefreshableLayer as m}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as c}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as f}from"./support/imageBitmapUtils.js";import y from"./support/TileInfo.js";import{TileKey as u}from"./support/TileKey.js";var h;const d=new u("0/0/0",0,0,0,void 0);let g=h=class extends(n(c(m(l)))){constructor(){super(...arguments),this.tileInfo=y.create({spatialReference:a.WebMercator,size:256}),this.type="base-tile",this.fullExtent=new i(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,a.WebMercator),this.spatialReference=a.WebMercator}getTileBounds(e,t,r,o){const s=o||p();return d.level=e,d.row=t,d.col=r,d.extent=s,this.tileInfo.updateTileInfo(d),d.extent=void 0,s}fetchTile(e,r,o,s={}){const{signal:i}=s,a=this.getTileUrl(e,r,o),p={responseType:"image",signal:i,query:{...this.refreshParameters}};return t(a??"",p).then((e=>e.data))}async fetchImageBitmapTile(e,r,o,s={}){const{signal:i}=s;if(this.fetchTile!==h.prototype.fetchTile){const t=await this.fetchTile(e,r,o,s);return f(t,e,r,o,i)}const a=this.getTileUrl(e,r,o)??"",p={responseType:"blob",signal:i,query:{...this.refreshParameters}},{data:l}=await t(a,p);return f(l,e,r,o,i)}getTileUrl(){throw new r("basetilelayer:gettileurl-not-implemented","getTileUrl() is not implemented")}};e([o({type:y})],g.prototype,"tileInfo",void 0),e([o({type:["show","hide"]})],g.prototype,"listMode",void 0),e([o({readOnly:!0,value:"base-tile"})],g.prototype,"type",void 0),e([o({nonNullable:!0})],g.prototype,"fullExtent",void 0),e([o()],g.prototype,"spatialReference",void 0),g=h=e([s("esri.layers.BaseTileLayer")],g);const j=g;export{j as default};
|
package/layers/MapImageLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../TimeExtent.js";import i from"../core/Error.js";import{HandleOwnerMixin as o}from"../core/HandleOwner.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p,isAbortError as n}from"../core/promiseUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import{Integer as l}from"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{writer as y}from"../core/accessorSupport/decorators/writer.js";import{nameToId as d,OriginId as h}from"../core/accessorSupport/PropertyOrigin.js";import f from"../geometry/Extent.js";import{getScale as g}from"../geometry/support/scaleUtils.js";import b from"./Layer.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISMapService as v}from"./mixins/ArcGISMapService.js";import{ArcGISService as x}from"./mixins/ArcGISService.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as O}from"./mixins/PortalLayer.js";import{RefreshableLayer as T}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as L}from"./mixins/SublayersOwner.js";import{TemporalLayer as M}from"./mixins/TemporalLayer.js";import{url as P}from"./support/commonProperties.js";import{ExportImageParameters as R}from"./support/ExportImageParameters.js";import{createBitmap as U}from"./support/imageBitmapUtils.js";import N from"./support/Sublayer.js";import{shouldWriteSublayerStructure as A}from"./support/sublayerUtils.js";import{serviceSupportsSpatialReference as F}from"./support/versionUtils.js";import J from"../time/TimeReference.js";let q=class extends(S(M(E(L(v(x(I(O(a(T(j(w(o(b)))))))))))))){constructor(...e){super(...e),this.dateFieldsTimeReference=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeReference=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null}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:["Map Service"]},e).catch(p).then((()=>this._fetchService(r)))),Promise.resolve(this)}readImageFormat(e,r){const t=r.supportedImageFormatTypes;return t&&t.includes("PNG32")?"png32":"png24"}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const o=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray();let s=!1;if(this.capabilities&&this.capabilities.operations.supportsExportMap&&this.capabilities.exportMap?.supportsDynamicLayers){const e=d(i.origin);if(e===h.PORTAL_ITEM){const e=this.createSublayersForOrigin("service").sublayers;s=A(o,e,h.SERVICE)}else if(e>h.PORTAL_ITEM){const e=this.createSublayersForOrigin("portal-item");s=A(o,e.sublayers,d(e.origin))}}const a=[],p={writeSublayerStructure:s,...i};let n=s;o.forEach((e=>{const r=e.write({},p);a.push(r),n=n||"user"===e.originOf("visible")}));a.some((e=>Object.keys(e).length>1))&&(r.layers=a),n&&(r.visibleLayers=o.filter((e=>e.visible)).map((e=>e.id)))}createExportImageParameters(e,r,t,i){const o=i&&i.pixelRatio||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian());const s=new R({layer:this,floors:i?.floors,scale:g({extent:e,width:r})*o}),a=s.toJSON();s.destroy();const p=!i||!i.rotation||this.version<10.3?{}:{rotation:-i.rotation},n=e&&e.spatialReference,m=n.wkid||JSON.stringify(n.toJSON());a.dpi*=o;const l={};if(i?.timeExtent){const{start:e,end:r}=i.timeExtent.toJSON();l.time=e&&r&&e===r?""+e:`${e??"null"},${r??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(l.time="null,null");return{bbox:e&&e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:m,imageSR:m,size:r+","+t,...a,...p,...l}}async fetchImage(e,r,t,i){const{data:o}=await this._fetchImage("image",e,r,t,i);return o}async fetchImageBitmap(e,r,t,i){const{data:o,url:s}=await this._fetchImage("blob",e,r,t,i);return U(o,s)}async fetchRecomputedExtents(e={}){const i={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:o}=await r(this.url,i),{extent:s,fullExtent:a,timeExtent:p}=o,n=s||a;return{fullExtent:n&&f.fromJSON(n),timeExtent:p&&t.fromJSON({start:p[0],end:p[1]})}}loadAll(){return s(this,(e=>{e(this.allSublayers)}))}serviceSupportsSpatialReference(e){return F(this,e)}async _fetchImage(e,t,o,s,a){const p={responseType:e,signal:a?.signal??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(t,o,s,a),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},m=this.parsedUrl.path+"/export";if(null!=p.query?.dynamicLayers&&!this.capabilities?.exportMap?.supportsDynamicLayers)throw new i("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:p.query});try{const{data:e}=await r(m,p);return{data:e,url:m}}catch(l){if(n(l))throw l;throw new i("mapimagelayer:image-fetch-error",`Unable to load image: ${m}`,{error:l})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:i}=await r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});i&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})}};e([m({type:J})],q.prototype,"dateFieldsTimeReference",void 0),e([m({type:Boolean})],q.prototype,"datesInUnknownTimezone",void 0),e([m()],q.prototype,"dpi",void 0),e([m()],q.prototype,"gdbVersion",void 0),e([m()],q.prototype,"imageFormat",void 0),e([c("imageFormat",["supportedImageFormatTypes"])],q.prototype,"readImageFormat",null),e([m({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],q.prototype,"imageMaxHeight",void 0),e([m({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],q.prototype,"imageMaxWidth",void 0),e([m()],q.prototype,"imageTransparency",void 0),e([m({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],q.prototype,"isReference",void 0),e([m({json:{read:!1,write:!1}})],q.prototype,"labelsVisible",void 0),e([m({type:["ArcGISMapServiceLayer"]})],q.prototype,"operationalLayerType",void 0),e([m({json:{read:!1,write:!1}})],q.prototype,"popupEnabled",void 0),e([m({type:J})],q.prototype,"preferredTimeReference",void 0),e([m()],q.prototype,"sourceJSON",void 0),e([m({json:{write:{ignoreOrigin:!0}}})],q.prototype,"sublayers",void 0),e([y("sublayers",{layers:{type:[N]},visibleLayers:{type:[l]}})],q.prototype,"writeSublayers",null),e([m({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([m({json:{read:!1},readOnly:!0,value:"map-image"})],q.prototype,"type",void 0),e([m(P)],q.prototype,"url",void 0),q=e([u("esri.layers.MapImageLayer")],q);const k=q;export{k as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../TimeExtent.js";import i from"../core/Error.js";import{HandleOwnerMixin as o}from"../core/HandleOwner.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p,isAbortError as n}from"../core/promiseUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import{Integer as l}from"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{writer as y}from"../core/accessorSupport/decorators/writer.js";import{nameToId as d,OriginId as h}from"../core/accessorSupport/PropertyOrigin.js";import f from"../geometry/Extent.js";import{getScale as g}from"../geometry/support/scaleUtils.js";import b from"./Layer.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISMapService as v}from"./mixins/ArcGISMapService.js";import{ArcGISService as x}from"./mixins/ArcGISService.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{CustomParametersMixin as w}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as O}from"./mixins/PortalLayer.js";import{RefreshableLayer as T}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as L}from"./mixins/SublayersOwner.js";import{TemporalLayer as M}from"./mixins/TemporalLayer.js";import{url as P}from"./support/commonProperties.js";import{ExportImageParameters as R}from"./support/ExportImageParameters.js";import{createBitmap as U}from"./support/imageBitmapUtils.js";import N from"./support/Sublayer.js";import{shouldWriteSublayerStructure as A}from"./support/sublayerUtils.js";import{serviceSupportsSpatialReference as F}from"./support/versionUtils.js";import J from"../time/TimeReference.js";let q=class extends(S(M(E(L(v(x(I(O(a(T(j(w(o(b)))))))))))))){constructor(...e){super(...e),this.dateFieldsTimeReference=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeReference=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null}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:["Map Service"]},e).catch(p).then((()=>this._fetchService(r)))),Promise.resolve(this)}readImageFormat(e,r){const t=r.supportedImageFormatTypes;return t&&t.includes("PNG32")?"png32":"png24"}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const o=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray();let s=!1;if(this.capabilities&&this.capabilities.operations.supportsExportMap&&this.capabilities.exportMap?.supportsDynamicLayers){const e=d(i.origin);if(e===h.PORTAL_ITEM){const e=this.createSublayersForOrigin("service").sublayers;s=A(o,e,h.SERVICE)}else if(e>h.PORTAL_ITEM){const e=this.createSublayersForOrigin("portal-item");s=A(o,e.sublayers,d(e.origin))}}const a=[],p={writeSublayerStructure:s,...i};let n=s;o.forEach((e=>{const r=e.write({},p);a.push(r),n=n||"user"===e.originOf("visible")}));a.some((e=>Object.keys(e).length>1))&&(r.layers=a),n&&(r.visibleLayers=o.filter((e=>e.visible)).map((e=>e.id)))}createExportImageParameters(e,r,t,i){const o=i&&i.pixelRatio||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian());const s=new R({layer:this,floors:i?.floors,scale:g({extent:e,width:r})*o}),a=s.toJSON();s.destroy();const p=!i||!i.rotation||this.version<10.3?{}:{rotation:-i.rotation},n=e&&e.spatialReference,m=n.wkid||JSON.stringify(n.toJSON());a.dpi*=o;const l={};if(i?.timeExtent){const{start:e,end:r}=i.timeExtent.toJSON();l.time=e&&r&&e===r?""+e:`${e??"null"},${r??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(l.time="null,null");return{bbox:e&&e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:m,imageSR:m,size:r+","+t,...a,...p,...l}}async fetchImage(e,r,t,i){const{data:o}=await this._fetchImage("image",e,r,t,i);return o}async fetchImageBitmap(e,r,t,i){const{data:o,url:s}=await this._fetchImage("blob",e,r,t,i);return U(o,s,i?.signal)}async fetchRecomputedExtents(e={}){const i={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:o}=await r(this.url,i),{extent:s,fullExtent:a,timeExtent:p}=o,n=s||a;return{fullExtent:n&&f.fromJSON(n),timeExtent:p&&t.fromJSON({start:p[0],end:p[1]})}}loadAll(){return s(this,(e=>{e(this.allSublayers)}))}serviceSupportsSpatialReference(e){return F(this,e)}async _fetchImage(e,t,o,s,a){const p={responseType:e,signal:a?.signal??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(t,o,s,a),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},m=this.parsedUrl.path+"/export";if(null!=p.query?.dynamicLayers&&!this.capabilities?.exportMap?.supportsDynamicLayers)throw new i("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:p.query});try{const{data:e}=await r(m,p);return{data:e,url:m}}catch(l){if(n(l))throw l;throw new i("mapimagelayer:image-fetch-error",`Unable to load image: ${m}`,{error:l})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:i}=await r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});i&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})}};e([m({type:J})],q.prototype,"dateFieldsTimeReference",void 0),e([m({type:Boolean})],q.prototype,"datesInUnknownTimezone",void 0),e([m()],q.prototype,"dpi",void 0),e([m()],q.prototype,"gdbVersion",void 0),e([m()],q.prototype,"imageFormat",void 0),e([c("imageFormat",["supportedImageFormatTypes"])],q.prototype,"readImageFormat",null),e([m({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],q.prototype,"imageMaxHeight",void 0),e([m({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],q.prototype,"imageMaxWidth",void 0),e([m()],q.prototype,"imageTransparency",void 0),e([m({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],q.prototype,"isReference",void 0),e([m({json:{read:!1,write:!1}})],q.prototype,"labelsVisible",void 0),e([m({type:["ArcGISMapServiceLayer"]})],q.prototype,"operationalLayerType",void 0),e([m({json:{read:!1,write:!1}})],q.prototype,"popupEnabled",void 0),e([m({type:J})],q.prototype,"preferredTimeReference",void 0),e([m()],q.prototype,"sourceJSON",void 0),e([m({json:{write:{ignoreOrigin:!0}}})],q.prototype,"sublayers",void 0),e([y("sublayers",{layers:{type:[N]},visibleLayers:{type:[l]}})],q.prototype,"writeSublayers",null),e([m({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([m({json:{read:!1},readOnly:!0,value:"map-image"})],q.prototype,"type",void 0),e([m(P)],q.prototype,"url",void 0),q=e([u("esri.layers.MapImageLayer")],q);const k=q;export{k as default};
|
package/layers/TileLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{HandleOwnerMixin as s}from"../core/HandleOwner.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{urlToObject as l,objectToQuery as n,makeAbsolute as p}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as u}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../core/accessorSupport/decorators/writer.js";import y from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as v}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as g}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as S}from"./mixins/ArcGISMapService.js";import{ArcGISService as _}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{HandleOwnerMixin as s}from"../core/HandleOwner.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{urlToObject as l,objectToQuery as n,makeAbsolute as p}from"../core/urlUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as u}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../core/accessorSupport/decorators/writer.js";import y from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as v}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as g}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as S}from"./mixins/ArcGISMapService.js";import{ArcGISService as _}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as T}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RefreshableLayer as O}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as R}from"./mixins/SublayersOwner.js";import{parse as U,isHostedAgolService as P,isArcGISUrl as x}from"./support/arcgisLayerUrl.js";import{url as A}from"./support/commonProperties.js";import{createTileBitmap as I}from"./support/imageBitmapUtils.js";import M from"./support/Sublayer.js";var W;const B=["Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Elevation/World_Hillshade","Elevation/World_Hillshade_Dark","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Ocean_Basemap","Reference/World_Boundaries_and_Places","Reference/World_Boundaries_and_Places_Alternate","Reference/World_Transportation","World_Imagery","World_Street_Map","World_Topo_Map"];let C=W=class extends(j(R(L(b(w(g(S(_(o(s(O(v(T(f)))))))))))))){constructor(...e){super(...e),this.listMode="show",this.isReference=null,this.operationalLayerType="ArcGISTiledMapServiceLayer",this.resampling=!0,this.sourceJSON=null,this.spatialReference=null,this.path=null,this.sublayers=null,this.type="tile",this.url=null}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:["Map Service"]},e).catch(a).then((()=>this._fetchService(r)))),Promise.resolve(this)}get attributionDataUrl(){const e=this.parsedUrl?.path.toLowerCase();return e?this._getDefaultAttribution(this._getMapName(e)):null}readSpatialReference(e,r){return(e=e||r.tileInfo&&r.tileInfo.spatialReference)&&y.fromJSON(e)}writeSublayers(e,r,t,s){if(!this.loaded||!e)return;const i=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray(),o=[],a={writeSublayerStructure:!1,...s};i.forEach((e=>{const r=e.write({},a);o.push(r)}));o.some((e=>Object.keys(e).length>1))&&(r.layers=o)}get tileServers(){return this._getDefaultTileServers(this.parsedUrl?.path)}castTileServers(e){return Array.isArray(e)?e.map((e=>l(e).path)):null}fetchTile(e,t,s,i={}){const{signal:o}=i,a=this.getTileUrl(e,t,s),l={responseType:"image",signal:o,query:{...this.refreshParameters}};return r(a,l).then((e=>e.data))}async fetchImageBitmapTile(e,t,s,i={}){const{signal:o}=i;if(this.fetchTile!==W.prototype.fetchTile){const r=await this.fetchTile(e,t,s,i);return I(r,e,t,s,o)}const a=this.getTileUrl(e,t,s),l={responseType:"blob",signal:o,query:{...this.refreshParameters}},{data:n}=await r(a,l);return I(n,e,t,s,o)}getTileUrl(e,r,t){const s=!this.tilemapCache&&this.supportsBlankTile,i=n({...this.parsedUrl?.query,blankTile:!s&&null,...this.customParameters,token:this.apiKey}),o=this.tileServers;return`${o&&o.length?o[r%o.length]:this.parsedUrl?.path}/tile/${e}/${r}/${t}${i?"?"+i:""}`}loadAll(){return i(this,(e=>{e(this.allSublayers)}))}_fetchService(e){return new Promise(((s,i)=>{if(this.sourceJSON){if(null!=this.sourceJSON.bandCount&&null!=this.sourceJSON.pixelSizeX)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");return void s({data:this.sourceJSON})}if(!this.parsedUrl)throw new t("tile-layer:undefined-url","layer's url is not defined");const o=U(this.parsedUrl.path);if(null!=o&&"ImageServer"===o.serverType)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(s,i)})).then((r=>{let t=this.url;if(r.ssl&&(t=this.url=t.replace(/^http:/i,"https:")),this.sourceJSON=r.data,this.read(r.data,{origin:"service",url:this.parsedUrl}),10.1===this.version&&!P(t))return this._fetchServerVersion(t,e).then((e=>{this.read({currentVersion:e})})).catch((()=>{}))}))}_fetchServerVersion(e,s){if(!x(e))return Promise.reject();const i=e.replace(/(.*\/rest)\/.*/i,"$1")+"/info";return r(i,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:s}).then((e=>{if(e.data&&e.data.currentVersion)return e.data.currentVersion;throw new t("tile-layer:version-not-available")}))}_getMapName(e){const r=e.match(/^(?:https?:)?\/\/(server\.arcgisonline\.com|services\.arcgisonline\.com|ibasemaps-api\.arcgis\.com)\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/mapserver/i);return r?r[2]:void 0}_getDefaultAttribution(e){if(null==e)return null;let r;e=e.toLowerCase();for(let t=0,s=B.length;t<s;t++)if(r=B[t],r.toLowerCase().includes(e))return p("//static.arcgis.com/attribution/"+r);return null}_getDefaultTileServers(e){if(null==e)return[];const r=-1!==e.search(/^(?:https?:)?\/\/server\.arcgisonline\.com/i),t=-1!==e.search(/^(?:https?:)?\/\/services\.arcgisonline\.com/i);return r||t?[e,e.replace(r?/server\.arcgisonline/i:/services\.arcgisonline/i,r?"services.arcgisonline":"server.arcgisonline")]:[]}get hasOverriddenFetchTile(){return!this.fetchTile[N]}};e([c({readOnly:!0})],C.prototype,"attributionDataUrl",null),e([c({type:["show","hide","hide-children"]})],C.prototype,"listMode",void 0),e([c({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([c({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([c({readOnly:!0,type:["ArcGISTiledMapServiceLayer"]})],C.prototype,"operationalLayerType",void 0),e([c({type:Boolean})],C.prototype,"resampling",void 0),e([c()],C.prototype,"sourceJSON",void 0),e([c({type:y})],C.prototype,"spatialReference",void 0),e([m("spatialReference",["spatialReference","tileInfo"])],C.prototype,"readSpatialReference",null),e([c({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],C.prototype,"path",void 0),e([c({readOnly:!0})],C.prototype,"sublayers",void 0),e([d("sublayers",{layers:{type:[M]}})],C.prototype,"writeSublayers",null),e([c({json:{read:!1,write:!1}})],C.prototype,"popupEnabled",void 0),e([c()],C.prototype,"tileServers",null),e([u("tileServers")],C.prototype,"castTileServers",null),e([c({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([c(A)],C.prototype,"url",void 0),C=W=e([h("esri.layers.TileLayer")],C);const N=Symbol("default-fetch-tile");C.prototype.fetchTile[N]=!0;const k=C;export{k as default};
|
package/layers/WMSLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import s from"../request.js";import i from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{JSONMap as n}from"../core/jsonMap.js";import{clone as l}from"../core/lang.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as m}from"../core/promiseUtils.js";import{on as u,watch as c,sync as f}from"../core/reactiveUtils.js";import{addQueryParameters as y,addProxy as d,Url as h}from"../core/urlUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import{Integer as b}from"../core/accessorSupport/ensureType.js";import{reader as v}from"../core/accessorSupport/decorators/reader.js";import{subclass as w}from"../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";import{willPropertyWrite as j}from"../core/accessorSupport/write.js";import I from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import{getScale as F}from"../geometry/support/scaleUtils.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import R from"./Layer.js";import{BlendLayer as P}from"./mixins/BlendLayer.js";import{OperationalLayer as O}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{RefreshableLayer as U}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as T}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as _}from"./ogc/crsUtils.js";import{isWmsServer as C}from"./support/arcgisLayerUrl.js";import{legendEnabled as W,url as $}from"./support/commonProperties.js";import{ExportWMSImageParameters as q}from"./support/ExportWMSImageParameters.js";import{createBitmap as N}from"./support/imageBitmapUtils.js";import B from"./support/WMSSublayer.js";import{normalizeWKID as H,toISOString as k,getPopupLayers as G,parseCapabilities as A}from"./support/wmsUtils.js";const D=new n({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function J(e){return"text/html"===e}function V(e){return"text/plain"===e}let Q=class extends(P(T(U(M(O(L(p(R)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.url=null,this.version=null,this.addHandles([u((()=>this.sublayers),"after-add",(({item:e})=>{e.parent=e.layer=this}),f),u((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=e.parent=null}),f),c((()=>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=r.layer=this}),f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(m).then((()=>this._fetchService(t)))),Promise.resolve(this)}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new I({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(J)??this.featureInfoFormats.find(V)??null}set featureInfoFormat(e){null==e?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(J(e)||V(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new S(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter((e=>e!==r)),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return K(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return K(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const s=new Map,i=e.flatten((({sublayers:e})=>e??[]));for(const a of i)if("number"==typeof a.parent?.id){const e=s.get(a.parent.id);null!=e?e.push(a.id):s.set(a.parent.id,[a.id])}for(const a of i){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(s.has(a.id)&&(r.sublayerIds=s.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=i.filter((({visible:e,sublayers:t})=>e&&!t)).map((({name:e})=>e)).toArray()}createExportImageParameters(e,t,r,o){const s=o?.pixelRatio??1,i=F({extent:e,width:t})*s,a=new q({layer:this,scale:i}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=H(u,this.spatialReferences),f="1.3.0"===this.version&&_(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,y=a.toJSON();return{bbox:f,["1.3.0"===this.version?"crs":"srs"]:null==c||isNaN(c)?void 0:"EPSG:"+c,...y}}async fetchImage(e,t,r,o){const i=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?k(n):`${k(n)}/${k(l)}`:void 0,m={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal};return s(i??"",m).then((e=>e.data))}async fetchImageBitmap(e,t,r,o){const i=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?k(n):`${k(n)}/${k(l)}`:void 0,m={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal},{data:u}=await s(i,m);return N(u,i)}fetchFeatureInfo(e,t,r,o,s){const i=F({extent:e,width:t}),a=new q({layer:this,scale:i}),n=G(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:s}:{x:o,y:s},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(y(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find((t=>t.id===e))}findSublayerByName(e){return this.allSublayers.find((t=>t.name===e))}serviceSupportsSpatialReference(e){return C(this.url)||null!=this.spatialReferences&&this.spatialReferences.some((t=>{const r=900913===t?S.WebMercator:new S({wkid:t});return E(r,e)}))}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=d(e),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const s=new o({title:this.title,content:t}),i=new r({sourceLayer:this,popupTemplate:s});return Promise.resolve([i])}async _fetchService(e){if(!this.resourceInfo){const{path:t,query:r}=this.parsedUrl??{};r?.service&&(r.SERVICE=r.service,delete r.service),r?.request&&(r.REQUEST=r.request,delete r.request);const{data:o}=await s(t??"",{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=A(o)}if(this.parsedUrl){const e=new h(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function z(e,t){return e.some((e=>{for(const r in e)if(j(e,r,null,t))return!0;return!1}))}function K(e,t,r){e=e??[];const o=new Map;e.every((e=>null==e.id))&&(e=l(e)).forEach(((e,t)=>e.id=t));for(const i of e){const e=new B;e.read(i,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const s=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new i),t.sublayers.push(e)}else s.push(e)}return s}e([g({readOnly:!0})],Q.prototype,"allSublayers",void 0),e([g({json:{type:Object,write:!0}})],Q.prototype,"customParameters",void 0),e([g({json:{type:Object,write:!0}})],Q.prototype,"customLayerParameters",void 0),e([g({type:String,json:{write:!0}})],Q.prototype,"copyright",void 0),e([g()],Q.prototype,"description",void 0),e([g({readOnly:!0})],Q.prototype,"dimensions",void 0),e([g({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Q.prototype,"fullExtent",void 0),e([v(["web-document","portal-item"],"fullExtent",["extent"])],Q.prototype,"readFullExtentFromItemOrMap",null),e([x(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],Q.prototype,"writeFullExtent",null),e([g()],Q.prototype,"fullExtents",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoFormat",null),e([g({type:[String],readOnly:!0})],Q.prototype,"featureInfoFormats",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoUrl",void 0),e([g()],Q.prototype,"fetchFeatureInfoFunction",void 0),e([g({type:String,json:{origins:{"web-document":{default:"image/png",type:D.jsonValues,read:{reader:D.read,source:"format"},write:{writer:D.write,target:"format"}}}}})],Q.prototype,"imageFormat",void 0),e([v("imageFormat",["supportedImageFormatTypes"])],Q.prototype,"readImageFormat",null),e([g({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],Q.prototype,"imageMaxHeight",void 0),e([g({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],Q.prototype,"imageMaxWidth",void 0),e([g()],Q.prototype,"imageTransparency",void 0),e([g(W)],Q.prototype,"legendEnabled",void 0),e([g({type:["show","hide","hide-children"]})],Q.prototype,"listMode",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"mapUrl",void 0),e([g({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Q.prototype,"isReference",void 0),e([g({type:["WMS"]})],Q.prototype,"operationalLayerType",void 0),e([g()],Q.prototype,"resourceInfo",void 0),e([g({type:S,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],Q.prototype,"spatialReference",void 0),e([v(["web-document","portal-item"],"spatialReference",["spatialReferences"])],Q.prototype,"readSpatialReferenceFromItemOrDocument",null),e([g({type:[b],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Q.prototype,"spatialReferences",void 0),e([x(["web-document","portal-item"],"spatialReferences")],Q.prototype,"writeSpatialReferences",null),e([g({type:i.ofType(B),json:{write:{target:"layers",overridePolicy(e,t,r){if(z(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],Q.prototype,"sublayers",void 0),e([v(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],Q.prototype,"readSublayersFromItemOrMap",null),e([v("service","sublayers",["layers"])],Q.prototype,"readSublayers",null),e([x("sublayers",{layers:{type:[B]},visibleLayers:{type:[String]}})],Q.prototype,"writeSublayers",null),e([g({json:{read:!1},readOnly:!0,value:"wms"})],Q.prototype,"type",void 0),e([g($)],Q.prototype,"url",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"version",void 0),Q=e([w("esri.layers.WMSLayer")],Q);const X=Q;export{X as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import s from"../request.js";import i from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{JSONMap as n}from"../core/jsonMap.js";import{clone as l}from"../core/lang.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as m}from"../core/promiseUtils.js";import{on as u,watch as c,sync as f}from"../core/reactiveUtils.js";import{addQueryParameters as y,addProxy as d,Url as h}from"../core/urlUtils.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import{Integer as b}from"../core/accessorSupport/ensureType.js";import{reader as v}from"../core/accessorSupport/decorators/reader.js";import{subclass as w}from"../core/accessorSupport/decorators/subclass.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";import{willPropertyWrite as j}from"../core/accessorSupport/write.js";import I from"../geometry/Extent.js";import S from"../geometry/SpatialReference.js";import{getScale as F}from"../geometry/support/scaleUtils.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import R from"./Layer.js";import{BlendLayer as P}from"./mixins/BlendLayer.js";import{OperationalLayer as O}from"./mixins/OperationalLayer.js";import{PortalLayer as L}from"./mixins/PortalLayer.js";import{RefreshableLayer as U}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as M}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as T}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as _}from"./ogc/crsUtils.js";import{isWmsServer as C}from"./support/arcgisLayerUrl.js";import{legendEnabled as W,url as $}from"./support/commonProperties.js";import{ExportWMSImageParameters as q}from"./support/ExportWMSImageParameters.js";import{createBitmap as N}from"./support/imageBitmapUtils.js";import B from"./support/WMSSublayer.js";import{normalizeWKID as H,toISOString as k,getPopupLayers as G,parseCapabilities as A}from"./support/wmsUtils.js";const D=new n({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function J(e){return"text/html"===e}function V(e){return"text/plain"===e}let Q=class extends(P(T(U(M(O(L(p(R)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.url=null,this.version=null,this.addHandles([u((()=>this.sublayers),"after-add",(({item:e})=>{e.parent=e.layer=this}),f),u((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=e.parent=null}),f),c((()=>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=r.layer=this}),f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(m).then((()=>this._fetchService(t)))),Promise.resolve(this)}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new I({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(J)??this.featureInfoFormats.find(V)??null}set featureInfoFormat(e){null==e?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(J(e)||V(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new S(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter((e=>e!==r)),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return K(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return K(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const s=new Map,i=e.flatten((({sublayers:e})=>e??[]));for(const a of i)if("number"==typeof a.parent?.id){const e=s.get(a.parent.id);null!=e?e.push(a.id):s.set(a.parent.id,[a.id])}for(const a of i){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(s.has(a.id)&&(r.sublayerIds=s.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=i.filter((({visible:e,sublayers:t})=>e&&!t)).map((({name:e})=>e)).toArray()}createExportImageParameters(e,t,r,o){const s=o?.pixelRatio??1,i=F({extent:e,width:t})*s,a=new q({layer:this,scale:i}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=H(u,this.spatialReferences),f="1.3.0"===this.version&&_(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,y=a.toJSON();return{bbox:f,["1.3.0"===this.version?"crs":"srs"]:null==c||isNaN(c)?void 0:"EPSG:"+c,...y}}async fetchImage(e,t,r,o){const i=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?k(n):`${k(n)}/${k(l)}`:void 0,m={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal};return s(i??"",m).then((e=>e.data))}async fetchImageBitmap(e,t,r,o){const i=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=o?.timeExtent?.start,l=o?.timeExtent?.end,p=null!=n&&null!=l?n.getTime()===l.getTime()?k(n):`${k(n)}/${k(l)}`:void 0,m={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:p,...this.refreshParameters}),signal:o?.signal},{data:u}=await s(i,m);return N(u,i,o?.signal)}fetchFeatureInfo(e,t,r,o,s){const i=F({extent:e,width:t}),a=new q({layer:this,scale:i}),n=G(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:s}:{x:o,y:s},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(y(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find((t=>t.id===e))}findSublayerByName(e){return this.allSublayers.find((t=>t.name===e))}serviceSupportsSpatialReference(e){return C(this.url)||null!=this.spatialReferences&&this.spatialReferences.some((t=>{const r=900913===t?S.WebMercator:new S({wkid:t});return E(r,e)}))}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=d(e),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const s=new o({title:this.title,content:t}),i=new r({sourceLayer:this,popupTemplate:s});return Promise.resolve([i])}async _fetchService(e){if(!this.resourceInfo){const{path:t,query:r}=this.parsedUrl??{};r?.service&&(r.SERVICE=r.service,delete r.service),r?.request&&(r.REQUEST=r.request,delete r.request);const{data:o}=await s(t??"",{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=A(o)}if(this.parsedUrl){const e=new h(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function z(e,t){return e.some((e=>{for(const r in e)if(j(e,r,null,t))return!0;return!1}))}function K(e,t,r){e=e??[];const o=new Map;e.every((e=>null==e.id))&&(e=l(e)).forEach(((e,t)=>e.id=t));for(const i of e){const e=new B;e.read(i,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const s=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new i),t.sublayers.push(e)}else s.push(e)}return s}e([g({readOnly:!0})],Q.prototype,"allSublayers",void 0),e([g({json:{type:Object,write:!0}})],Q.prototype,"customParameters",void 0),e([g({json:{type:Object,write:!0}})],Q.prototype,"customLayerParameters",void 0),e([g({type:String,json:{write:!0}})],Q.prototype,"copyright",void 0),e([g()],Q.prototype,"description",void 0),e([g({readOnly:!0})],Q.prototype,"dimensions",void 0),e([g({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],Q.prototype,"fullExtent",void 0),e([v(["web-document","portal-item"],"fullExtent",["extent"])],Q.prototype,"readFullExtentFromItemOrMap",null),e([x(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],Q.prototype,"writeFullExtent",null),e([g()],Q.prototype,"fullExtents",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoFormat",null),e([g({type:[String],readOnly:!0})],Q.prototype,"featureInfoFormats",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"featureInfoUrl",void 0),e([g()],Q.prototype,"fetchFeatureInfoFunction",void 0),e([g({type:String,json:{origins:{"web-document":{default:"image/png",type:D.jsonValues,read:{reader:D.read,source:"format"},write:{writer:D.write,target:"format"}}}}})],Q.prototype,"imageFormat",void 0),e([v("imageFormat",["supportedImageFormatTypes"])],Q.prototype,"readImageFormat",null),e([g({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],Q.prototype,"imageMaxHeight",void 0),e([g({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],Q.prototype,"imageMaxWidth",void 0),e([g()],Q.prototype,"imageTransparency",void 0),e([g(W)],Q.prototype,"legendEnabled",void 0),e([g({type:["show","hide","hide-children"]})],Q.prototype,"listMode",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"mapUrl",void 0),e([g({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Q.prototype,"isReference",void 0),e([g({type:["WMS"]})],Q.prototype,"operationalLayerType",void 0),e([g()],Q.prototype,"resourceInfo",void 0),e([g({type:S,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],Q.prototype,"spatialReference",void 0),e([v(["web-document","portal-item"],"spatialReference",["spatialReferences"])],Q.prototype,"readSpatialReferenceFromItemOrDocument",null),e([g({type:[b],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],Q.prototype,"spatialReferences",void 0),e([x(["web-document","portal-item"],"spatialReferences")],Q.prototype,"writeSpatialReferences",null),e([g({type:i.ofType(B),json:{write:{target:"layers",overridePolicy(e,t,r){if(z(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],Q.prototype,"sublayers",void 0),e([v(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],Q.prototype,"readSublayersFromItemOrMap",null),e([v("service","sublayers",["layers"])],Q.prototype,"readSublayers",null),e([x("sublayers",{layers:{type:[B]},visibleLayers:{type:[String]}})],Q.prototype,"writeSublayers",null),e([g({json:{read:!1},readOnly:!0,value:"wms"})],Q.prototype,"type",void 0),e([g($)],Q.prototype,"url",void 0),e([g({type:String,json:{write:{ignoreOrigin:!0}}})],Q.prototype,"version",void 0),Q=e([w("esri.layers.WMSLayer")],Q);const X=Q;export{X as default};
|
package/layers/WMTSLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{isSome as r}from"../core/arrayUtils.js";import i from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{getDeepValue as l}from"../core/object.js";import{throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as m,on as p,sync as c}from"../core/reactiveUtils.js";import{urlToObject as u,objectToQuery as y}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../core/accessorSupport/decorators/writer.js";import g from"../geometry/Extent.js";import L from"./Layer.js";import w from"./WebTileLayer.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{RefreshableLayer as T}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as P}from"./mixins/ScaleRangeLayer.js";import{createBitmap as j}from"./support/imageBitmapUtils.js";import b from"./support/TileInfo.js";import x from"./support/TileInfoTilemapCache.js";import{WMTSLayerInfo as E}from"./support/WMTSLayerInfo.js";import _ from"./support/WMTSSublayer.js";import{getTileUrlFromResourceUrls as C,getTileUrlTemplateFromResourceUrls as U,validateCapabilities as R,parseCapabilities as O,parseResourceInfo as W}from"./support/wmtsUtils.js";const A={"image/png":".png","image/png8":".png","image/png24":".png","image/png32":".png","image/jpg":".jpg","image/jpeg":".jpeg","image/gif":".gif","image/bmp":".bmp","image/tiff":".tif","image/jpgpng":"","image/jpegpng":"","image/unknown":""},F=new Set(["version","service","request","layer","style","format","tilematrixset","tilematrix","tilerow","tilecol"]);let V=class extends(I(T(P(S(M(o(L))))))){constructor(...e){super(...e),this.copyright="",this.customParameters=null,this.customLayerParameters=null,this.fullExtent=null,this.operationalLayerType="WebTiledLayer",this.resourceInfo=null,this.serviceMode="RESTful",this.sublayers=null,this.type="wmts",this.version="1.0.0",this.addHandles([m((()=>this.activeLayer),((e,t)=>{t&&(t.layer=null),e&&(e.layer=this)}),c),p((()=>this.sublayers),"after-add",(({item:e})=>{e.layer=this}),c),p((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=null}),c),m((()=>this.sublayers),((e,t)=>{if(t)for(const r of t)r.layer=null;if(e)for(const r of e)r.layer=this}),c)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){if("KVP"===this.serviceMode||"RESTful"===this.serviceMode)return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMTS"]},e).catch(n).then((()=>this._fetchService(e))).catch((e=>{throw n(e),new s("wmtslayer:unsupported-service-data","Invalid response from the WMTS service.",{error:e})}))),Promise.resolve(this);console.error("WMTS mode could only be 'KVP' or 'RESTful'")}get activeLayer(){return this._get("activeLayer")}set activeLayer(e){this._set("activeLayer",e)}readActiveLayerFromService(e,t,r){this.activeLayer||(this.activeLayer=new _);let i=t.layers.find((e=>e.id===this.activeLayer.id));return i||(i=t.layers[0]),this.activeLayer.read(i,r),this.activeLayer}readActiveLayerFromItemOrWebDoc(e,t){const{templateUrl:r,wmtsInfo:i}=t,s=r?this._getLowerCasedUrlParams(r):null,a=i?.layerIdentifier;let o=null;const l=i?.tileMatrixSet;l&&(Array.isArray(l)?l.length&&(o=l[0]):o=l);const n=s?.format,m=s?.style;return new _({id:a,imageFormat:n,styleId:m,tileMatrixSetId:o})}writeActiveLayer(e,t,r,i){const s=this.activeLayer;t.templateUrl=this.getUrlTemplate(s.id,s.tileMatrixSetId,s.imageFormat,s.styleId);const a=l("tileMatrixSet.tileInfo",s);t.tileInfo=a?a.toJSON(i):null,t.wmtsInfo={...t.wmtsInfo,layerIdentifier:s.id,tileMatrixSet:s.tileMatrixSetId}}readCustomParameters(e,t){const r=t.wmtsInfo;return r?this._mergeParams(r.customParameters,r.url):null}get fullExtents(){return this.activeLayer.fullExtents}readServiceMode(e,t){return t.templateUrl.includes("?")?"KVP":"RESTful"}readSublayersFromService(e,t,r){return $(t.layers,r)}get supportedSpatialReferences(){return this.activeLayer.tileMatrixSets?.map((e=>e.tileInfo?.spatialReference)).toArray().filter(r)??[]}get tilemapCache(){const e=this.activeLayer?.tileMatrixSet?.tileInfo;return e?new x(e):void 0}get title(){return this.activeLayer?.title??"Layer"}set title(e){this._overrideIfSome("title",e)}get url(){return this._get("url")}set url(e){e&&"/"===e.substr(-1)?this._set("url",e.slice(0,-1)):this._set("url",e)}createWebTileLayer(e){const t=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId),r=this._getTileMatrixSetById(e.tileMatrixSetId),i=r?.tileInfo,s=e.fullExtent,a=new E({layerIdentifier:e.id,tileMatrixSet:e.tileMatrixSetId,url:this.url});return this.customLayerParameters&&(a.customLayerParameters=this.customLayerParameters),this.customParameters&&(a.customParameters=this.customParameters),new w({fullExtent:s,urlTemplate:t,tileInfo:i,wmtsInfo:a})}async fetchTile(e,r,i){const s=this.getTileUrl(e,r,i),{data:a}=await t(s,{responseType:"image"});return a}async fetchImageBitmapTile(e,r,i){const s=this.getTileUrl(e,r,i),{data:a}=await t(s,{responseType:"blob"});return j(a,s)}findSublayerById(e){return this.sublayers?.find((t=>t.id===e))}getTileUrl(e,t,r){const i=this._getTileMatrixSetById(this.activeLayer.tileMatrixSetId),s=i?.tileInfo?.lods[e],a=s?s.levelValue||`${s.level}`:`${e}`;let o=this.resourceInfo?"":C({dimensionMap:this.dimensionMap,layerMap:this.layerMap},this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId,a,t,r);if(!o){o=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId).replace(/\{level\}/gi,a).replace(/\{row\}/gi,`${t}`).replace(/\{col\}/gi,`${r}`)}return o=this._appendCustomLayerParameters(o),o}getUrlTemplate(e,t,r,i){if(!this.resourceInfo){const r=U({dimensionMap:this.dimensionMap,layerMap:this.layerMap},e,t,i);if(r)return r}if("KVP"===this.serviceMode)return this.url+"?SERVICE=WMTS&VERSION="+this.version+"&REQUEST=GetTile&LAYER="+e+"&STYLE="+i+"&FORMAT="+r+"&TILEMATRIXSET="+t+"&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}";if("RESTful"===this.serviceMode){let s="";return A[r.toLowerCase()]&&(s=A[r.toLowerCase()]),this.url+e+"/"+i+"/"+t+"/{level}/{row}/{col}"+s}return""}async _fetchService(e){let t;if(this.resourceInfo)"KVP"===this.resourceInfo.serviceMode&&(this.url+=this.url.includes("?")?"":"?"),t={ssl:!1,data:this.resourceInfo};else try{t=await this._getCapabilities(this.serviceMode,e),R(t.data)}catch{const i="KVP"===this.serviceMode?"RESTful":"KVP";try{t=await this._getCapabilities(i,e),R(t.data),this.serviceMode=i}catch(r){throw new s("wmtslayer:unsupported-service-data","Services does not support RESTful or KVP service modes.",{error:r})}}this.resourceInfo?t.data=W(t.data):t.data=O(t.data,{serviceMode:this.serviceMode,url:this.url}),t.data&&this.read(t.data,{origin:"service"})}async _getCapabilities(e,r){const i=this._getCapabilitiesUrl(e);return await t(i,{...r,responseType:"text"})}_getTileMatrixSetById(e){const t=this.findSublayerById(this.activeLayer.id),r=t?.tileMatrixSets?.find((t=>t.id===e));return r}_appendCustomParameters(e){return this._appendParameters(e,this.customParameters)}_appendCustomLayerParameters(e){return this._appendParameters(e,{...a(this.customParameters),...this.customLayerParameters})}_appendParameters(e,t){const r=u(e),i={...r.query,...t},s=y(i);return""===s?r.path:`${r.path}?${s}`}_getCapabilitiesUrl(e){this.url=this.url.split("?")[0];const t="KVP"===e?`${this.url}?request=GetCapabilities&service=WMTS&version=${this.version}`:`${this.url}/${this.version}/WMTSCapabilities.xml`;return this._appendCustomParameters(t)}_getLowerCasedUrlParams(e){if(!e)return null;const t=u(e).query;if(!t)return null;const r={};return Object.keys(t).forEach((e=>{r[e.toLowerCase()]=t[e]})),r}_mergeParams(e,t){const r=this._getLowerCasedUrlParams(t);if(r){const t=Object.keys(r);t.length&&(e=e?a(e):{},t.forEach((t=>{e.hasOwnProperty(t)||F.has(t)||(e[t]=r[t])})))}return e}};function $(e,t){return e.map((e=>{const r=new _;return r.read(e,t),r}))}e([d()],V.prototype,"dimensionMap",void 0),e([d()],V.prototype,"layerMap",void 0),e([d({type:_,json:{origins:{"web-document":{write:{ignoreOrigin:!0}}}}})],V.prototype,"activeLayer",null),e([h("service","activeLayer",["layers"])],V.prototype,"readActiveLayerFromService",null),e([h(["web-document","portal-item"],"activeLayer",["wmtsInfo"])],V.prototype,"readActiveLayerFromItemOrWebDoc",null),e([v(["web-document","portal-item"],"activeLayer",{templateUrl:{type:String},tileInfo:{type:b},"wmtsInfo.layerIdentifier":{type:String},"wmtsInfo.tileMatrixSet":{type:String}})],V.prototype,"writeActiveLayer",null),e([d({type:String,value:"",json:{write:!0}})],V.prototype,"copyright",void 0),e([d({type:["show","hide"]})],V.prototype,"listMode",void 0),e([d({json:{read:!0,write:!0}})],V.prototype,"blendMode",void 0),e([d({json:{origins:{"web-document":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}},"portal-item":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}}}}})],V.prototype,"customParameters",void 0),e([h(["portal-item","web-document"],"customParameters")],V.prototype,"readCustomParameters",null),e([d({json:{origins:{"web-document":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}},"portal-item":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}}}}})],V.prototype,"customLayerParameters",void 0),e([d({type:g,json:{write:{ignoreOrigin:!0},origins:{"web-document":{read:{source:"fullExtent"}},"portal-item":{read:{source:"fullExtent"}}}}})],V.prototype,"fullExtent",void 0),e([d({readOnly:!0})],V.prototype,"fullExtents",null),e([d({type:["WebTiledLayer"]})],V.prototype,"operationalLayerType",void 0),e([d()],V.prototype,"resourceInfo",void 0),e([d()],V.prototype,"serviceMode",void 0),e([h(["portal-item","web-document"],"serviceMode",["templateUrl"])],V.prototype,"readServiceMode",null),e([d({type:i.ofType(_)})],V.prototype,"sublayers",void 0),e([h("service","sublayers",["layers"])],V.prototype,"readSublayersFromService",null),e([d({readOnly:!0})],V.prototype,"supportedSpatialReferences",null),e([d({readOnly:!0})],V.prototype,"tilemapCache",null),e([d({json:{read:{source:"title"}}})],V.prototype,"title",null),e([d({json:{read:!1},readOnly:!0,value:"wmts"})],V.prototype,"type",void 0),e([d({json:{origins:{service:{read:{source:"tileUrl"}},"web-document":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}},"portal-item":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}}}}})],V.prototype,"url",null),e([d()],V.prototype,"version",void 0),V=e([f("esri.layers.WMTSLayer")],V);const K=V;export{K as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{isSome as r}from"../core/arrayUtils.js";import i from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{getDeepValue as l}from"../core/object.js";import{throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as m,on as p,sync as c}from"../core/reactiveUtils.js";import{urlToObject as u,objectToQuery as y}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../core/accessorSupport/decorators/writer.js";import g from"../geometry/Extent.js";import w from"./Layer.js";import L from"./WebTileLayer.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{RefreshableLayer as T}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as P}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as j}from"./support/imageBitmapUtils.js";import b from"./support/TileInfo.js";import x from"./support/TileInfoTilemapCache.js";import{WMTSLayerInfo as E}from"./support/WMTSLayerInfo.js";import _ from"./support/WMTSSublayer.js";import{getTileUrlFromResourceUrls as C,getTileUrlTemplateFromResourceUrls as U,validateCapabilities as R,parseCapabilities as O,parseResourceInfo as W}from"./support/wmtsUtils.js";var A;const F={"image/png":".png","image/png8":".png","image/png24":".png","image/png32":".png","image/jpg":".jpg","image/jpeg":".jpeg","image/gif":".gif","image/bmp":".bmp","image/tiff":".tif","image/jpgpng":"","image/jpegpng":"","image/unknown":""},V=new Set(["version","service","request","layer","style","format","tilematrixset","tilematrix","tilerow","tilecol"]);let $=A=class extends(I(T(P(S(M(o(w))))))){constructor(...e){super(...e),this.copyright="",this.customParameters=null,this.customLayerParameters=null,this.fullExtent=null,this.operationalLayerType="WebTiledLayer",this.resourceInfo=null,this.serviceMode="RESTful",this.sublayers=null,this.type="wmts",this.version="1.0.0",this.addHandles([m((()=>this.activeLayer),((e,t)=>{t&&(t.layer=null),e&&(e.layer=this)}),c),p((()=>this.sublayers),"after-add",(({item:e})=>{e.layer=this}),c),p((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=null}),c),m((()=>this.sublayers),((e,t)=>{if(t)for(const r of t)r.layer=null;if(e)for(const r of e)r.layer=this}),c)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){if("KVP"===this.serviceMode||"RESTful"===this.serviceMode)return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMTS"]},e).catch(n).then((()=>this._fetchService(e))).catch((e=>{throw n(e),new s("wmtslayer:unsupported-service-data","Invalid response from the WMTS service.",{error:e})}))),Promise.resolve(this);console.error("WMTS mode could only be 'KVP' or 'RESTful'")}get activeLayer(){return this._get("activeLayer")}set activeLayer(e){this._set("activeLayer",e)}readActiveLayerFromService(e,t,r){this.activeLayer||(this.activeLayer=new _);let i=t.layers.find((e=>e.id===this.activeLayer.id));return i||(i=t.layers[0]),this.activeLayer.read(i,r),this.activeLayer}readActiveLayerFromItemOrWebDoc(e,t){const{templateUrl:r,wmtsInfo:i}=t,s=r?this._getLowerCasedUrlParams(r):null,a=i?.layerIdentifier;let o=null;const l=i?.tileMatrixSet;l&&(Array.isArray(l)?l.length&&(o=l[0]):o=l);const n=s?.format,m=s?.style;return new _({id:a,imageFormat:n,styleId:m,tileMatrixSetId:o})}writeActiveLayer(e,t,r,i){const s=this.activeLayer;t.templateUrl=this.getUrlTemplate(s.id,s.tileMatrixSetId,s.imageFormat,s.styleId);const a=l("tileMatrixSet.tileInfo",s);t.tileInfo=a?a.toJSON(i):null,t.wmtsInfo={...t.wmtsInfo,layerIdentifier:s.id,tileMatrixSet:s.tileMatrixSetId}}readCustomParameters(e,t){const r=t.wmtsInfo;return r?this._mergeParams(r.customParameters,r.url):null}get fullExtents(){return this.activeLayer.fullExtents}readServiceMode(e,t){return t.templateUrl.includes("?")?"KVP":"RESTful"}readSublayersFromService(e,t,r){return K(t.layers,r)}get supportedSpatialReferences(){return this.activeLayer.tileMatrixSets?.map((e=>e.tileInfo?.spatialReference)).toArray().filter(r)??[]}get tilemapCache(){const e=this.activeLayer?.tileMatrixSet?.tileInfo;return e?new x(e):void 0}get title(){return this.activeLayer?.title??"Layer"}set title(e){this._overrideIfSome("title",e)}get url(){return this._get("url")}set url(e){e&&"/"===e.substr(-1)?this._set("url",e.slice(0,-1)):this._set("url",e)}createWebTileLayer(e){const t=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId),r=this._getTileMatrixSetById(e.tileMatrixSetId),i=r?.tileInfo,s=e.fullExtent,a=new E({layerIdentifier:e.id,tileMatrixSet:e.tileMatrixSetId,url:this.url});return this.customLayerParameters&&(a.customLayerParameters=this.customLayerParameters),this.customParameters&&(a.customParameters=this.customParameters),new L({fullExtent:s,urlTemplate:t,tileInfo:i,wmtsInfo:a})}async fetchTile(e,r,i,s={}){const{signal:a}=s,o=this.getTileUrl(e,r,i),{data:l}=await t(o,{responseType:"image",signal:a});return l}async fetchImageBitmapTile(e,r,i,s={}){const{signal:a}=s;if(this.fetchTile!==A.prototype.fetchTile){const t=await this.fetchTile(e,r,i,s);return j(t,e,r,i,a)}const o=this.getTileUrl(e,r,i),{data:l}=await t(o,{responseType:"blob",signal:a});return j(l,e,r,i,a)}findSublayerById(e){return this.sublayers?.find((t=>t.id===e))}getTileUrl(e,t,r){const i=this._getTileMatrixSetById(this.activeLayer.tileMatrixSetId),s=i?.tileInfo?.lods[e],a=s?s.levelValue||`${s.level}`:`${e}`;let o=this.resourceInfo?"":C({dimensionMap:this.dimensionMap,layerMap:this.layerMap},this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId,a,t,r);if(!o){o=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId).replace(/\{level\}/gi,a).replace(/\{row\}/gi,`${t}`).replace(/\{col\}/gi,`${r}`)}return o=this._appendCustomLayerParameters(o),o}getUrlTemplate(e,t,r,i){if(!this.resourceInfo){const r=U({dimensionMap:this.dimensionMap,layerMap:this.layerMap},e,t,i);if(r)return r}if("KVP"===this.serviceMode)return this.url+"?SERVICE=WMTS&VERSION="+this.version+"&REQUEST=GetTile&LAYER="+e+"&STYLE="+i+"&FORMAT="+r+"&TILEMATRIXSET="+t+"&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}";if("RESTful"===this.serviceMode){let s="";return F[r.toLowerCase()]&&(s=F[r.toLowerCase()]),this.url+e+"/"+i+"/"+t+"/{level}/{row}/{col}"+s}return""}async _fetchService(e){let t;if(this.resourceInfo)"KVP"===this.resourceInfo.serviceMode&&(this.url+=this.url.includes("?")?"":"?"),t={ssl:!1,data:this.resourceInfo};else try{t=await this._getCapabilities(this.serviceMode,e),R(t.data)}catch{const i="KVP"===this.serviceMode?"RESTful":"KVP";try{t=await this._getCapabilities(i,e),R(t.data),this.serviceMode=i}catch(r){throw new s("wmtslayer:unsupported-service-data","Services does not support RESTful or KVP service modes.",{error:r})}}this.resourceInfo?t.data=W(t.data):t.data=O(t.data,{serviceMode:this.serviceMode,url:this.url}),t.data&&this.read(t.data,{origin:"service"})}async _getCapabilities(e,r){const i=this._getCapabilitiesUrl(e);return await t(i,{...r,responseType:"text"})}_getTileMatrixSetById(e){const t=this.findSublayerById(this.activeLayer.id),r=t?.tileMatrixSets?.find((t=>t.id===e));return r}_appendCustomParameters(e){return this._appendParameters(e,this.customParameters)}_appendCustomLayerParameters(e){return this._appendParameters(e,{...a(this.customParameters),...this.customLayerParameters})}_appendParameters(e,t){const r=u(e),i={...r.query,...t},s=y(i);return""===s?r.path:`${r.path}?${s}`}_getCapabilitiesUrl(e){this.url=this.url.split("?")[0];const t="KVP"===e?`${this.url}?request=GetCapabilities&service=WMTS&version=${this.version}`:`${this.url}/${this.version}/WMTSCapabilities.xml`;return this._appendCustomParameters(t)}_getLowerCasedUrlParams(e){if(!e)return null;const t=u(e).query;if(!t)return null;const r={};return Object.keys(t).forEach((e=>{r[e.toLowerCase()]=t[e]})),r}_mergeParams(e,t){const r=this._getLowerCasedUrlParams(t);if(r){const t=Object.keys(r);t.length&&(e=e?a(e):{},t.forEach((t=>{e.hasOwnProperty(t)||V.has(t)||(e[t]=r[t])})))}return e}};function K(e,t){return e.map((e=>{const r=new _;return r.read(e,t),r}))}e([d()],$.prototype,"dimensionMap",void 0),e([d()],$.prototype,"layerMap",void 0),e([d({type:_,json:{origins:{"web-document":{write:{ignoreOrigin:!0}}}}})],$.prototype,"activeLayer",null),e([h("service","activeLayer",["layers"])],$.prototype,"readActiveLayerFromService",null),e([h(["web-document","portal-item"],"activeLayer",["wmtsInfo"])],$.prototype,"readActiveLayerFromItemOrWebDoc",null),e([v(["web-document","portal-item"],"activeLayer",{templateUrl:{type:String},tileInfo:{type:b},"wmtsInfo.layerIdentifier":{type:String},"wmtsInfo.tileMatrixSet":{type:String}})],$.prototype,"writeActiveLayer",null),e([d({type:String,value:"",json:{write:!0}})],$.prototype,"copyright",void 0),e([d({type:["show","hide"]})],$.prototype,"listMode",void 0),e([d({json:{read:!0,write:!0}})],$.prototype,"blendMode",void 0),e([d({json:{origins:{"web-document":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}},"portal-item":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}}}}})],$.prototype,"customParameters",void 0),e([h(["portal-item","web-document"],"customParameters")],$.prototype,"readCustomParameters",null),e([d({json:{origins:{"web-document":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}},"portal-item":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}}}}})],$.prototype,"customLayerParameters",void 0),e([d({type:g,json:{write:{ignoreOrigin:!0},origins:{"web-document":{read:{source:"fullExtent"}},"portal-item":{read:{source:"fullExtent"}}}}})],$.prototype,"fullExtent",void 0),e([d({readOnly:!0})],$.prototype,"fullExtents",null),e([d({type:["WebTiledLayer"]})],$.prototype,"operationalLayerType",void 0),e([d()],$.prototype,"resourceInfo",void 0),e([d()],$.prototype,"serviceMode",void 0),e([h(["portal-item","web-document"],"serviceMode",["templateUrl"])],$.prototype,"readServiceMode",null),e([d({type:i.ofType(_)})],$.prototype,"sublayers",void 0),e([h("service","sublayers",["layers"])],$.prototype,"readSublayersFromService",null),e([d({readOnly:!0})],$.prototype,"supportedSpatialReferences",null),e([d({readOnly:!0})],$.prototype,"tilemapCache",null),e([d({json:{read:{source:"title"}}})],$.prototype,"title",null),e([d({json:{read:!1},readOnly:!0,value:"wmts"})],$.prototype,"type",void 0),e([d({json:{origins:{service:{read:{source:"tileUrl"}},"web-document":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}},"portal-item":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}}}}})],$.prototype,"url",null),e([d()],$.prototype,"version",void 0),$=A=e([f("esri.layers.WMTSLayer")],$);const B=$;export{B as default};
|
package/layers/WebTileLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../request.js";import r from"../core/Error.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{replace as o}from"../core/string.js";import{Url as s,isProtocolRelative as i,normalize as n}from"../core/urlUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import m from"./Layer.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{RefreshableLayer as d}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../request.js";import r from"../core/Error.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{replace as o}from"../core/string.js";import{Url as s,isProtocolRelative as i,normalize as n}from"../core/urlUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import m from"./Layer.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{RefreshableLayer as d}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as w}from"./support/imageBitmapUtils.js";import g from"./support/LOD.js";import j from"./support/TileInfo.js";import{WMTSLayerInfo as T}from"./support/WMTSLayerInfo.js";import b from"../geometry/Extent.js";import R from"../geometry/SpatialReference.js";import S from"../geometry/Point.js";var x;let U=x=class extends(f(d(v(y(h(l(m))))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new b(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,R.WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=R.WebMercator,this.subDomains=null,this.tileInfo=new j({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new S({x:-20037508.342787,y:20037508.342787,spatialReference:R.WebMercator}),spatialReference:R.WebMercator,lods:[new g({level:0,scale:591657527.591555,resolution:156543.033928}),new g({level:1,scale:295828763.795777,resolution:78271.5169639999}),new g({level:2,scale:147914381.897889,resolution:39135.7584820001}),new g({level:3,scale:73957190.948944,resolution:19567.8792409999}),new g({level:4,scale:36978595.474472,resolution:9783.93962049996}),new g({level:5,scale:18489297.737236,resolution:4891.96981024998}),new g({level:6,scale:9244648.868618,resolution:2445.98490512499}),new g({level:7,scale:4622324.434309,resolution:1222.99245256249}),new g({level:8,scale:2311162.217155,resolution:611.49622628138}),new g({level:9,scale:1155581.108577,resolution:305.748113140558}),new g({level:10,scale:577790.554289,resolution:152.874056570411}),new g({level:11,scale:288895.277144,resolution:76.4370282850732}),new g({level:12,scale:144447.638572,resolution:38.2185141425366}),new g({level:13,scale:72223.819286,resolution:19.1092570712683}),new g({level:14,scale:36111.909643,resolution:9.55462853563415}),new g({level:15,scale:18055.954822,resolution:4.77731426794937}),new g({level:16,scale:9027.977411,resolution:2.38865713397468}),new g({level:17,scale:4513.988705,resolution:1.19432856685505}),new g({level:18,scale:2256.994353,resolution:.597164283559817}),new g({level:19,scale:1128.497176,resolution:.298582141647617}),new g({level:20,scale:564.248588,resolution:.14929107082380833}),new g({level:21,scale:282.124294,resolution:.07464553541190416}),new g({level:22,scale:141.062147,resolution:.03732276770595208}),new g({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return"string"==typeof e?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then((()=>{let e="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const t=new s(this.urlTemplate);!(!!this.subDomains&&this.subDomains.length>0)&&t.authority?.includes("{subDomain}")&&(e="is missing 'subDomains' property")}else e="spatialReference must match tileInfo.spatialReference";else e="is missing the required 'urlTemplate' property value";if(e)throw new r("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${e}`)}));return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}readSpatialReference(e,t){return e||t.fullExtent&&t.fullExtent.spatialReference&&R.fromJSON(t.fullExtent.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:r}=this,l=new s(t),o=l.scheme?l.scheme+"://":"//",i=o+l.authority+"/",n=l.authority;if(n?.includes("{subDomain}")){if(r&&r.length>0&&n.split(".").length>1)for(const s of r)e.push(o+n.replace(/\{subDomain\}/gi,s)+"/")}else e.push(i);return e.map((e=>("/"!==e.charAt(e.length-1)&&(e+="/"),e)))}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new s(e),r=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.substring(r.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){e&&i(e)&&(e="https:"+e),e&&(e=e.replace(/\{z\}/gi,"{level}").replace(/\{x\}/gi,"{col}").replace(/\{y\}/gi,"{row}"),e=n(e)),t.templateUrl=e}fetchTile(e,r,l,o={}){const{signal:s}=o,i=this.getTileUrl(e,r,l),n={responseType:"image",signal:s,query:{...this.refreshParameters}};return t(i,n).then((e=>e.data))}async fetchImageBitmapTile(e,r,l,o={}){const{signal:s}=o;if(this.fetchTile!==x.prototype.fetchTile){const t=await this.fetchTile(e,r,l,o);return w(t,e,r,l,s)}const i=this.getTileUrl(e,r,l),n={responseType:"blob",signal:s,query:{...this.refreshParameters}},{data:a}=await t(i,n);return w(a,e,r,l,s)}getTileUrl(e,t,r){const{levelValues:l,tileServers:s,urlPath:i}=this;if(!l||!s||!i)return"";const n=l[e];return s[t%s.length]+o(i,{level:n,z:n,col:r,x:r,row:t,y:t})}};e([a({type:String,value:"",json:{write:!0}})],U.prototype,"copyright",void 0),e([a({type:b,json:{write:!0},nonNullable:!0})],U.prototype,"fullExtent",void 0),e([a({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"legendEnabled",void 0),e([a({type:["show","hide"]})],U.prototype,"listMode",void 0),e([a({json:{read:!0,write:!0}})],U.prototype,"blendMode",void 0),e([a()],U.prototype,"levelValues",null),e([a({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],U.prototype,"isReference",void 0),e([a({type:["WebTiledLayer"],value:"WebTiledLayer"})],U.prototype,"operationalLayerType",void 0),e([a({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"popupEnabled",void 0),e([a({type:R})],U.prototype,"spatialReference",void 0),e([p("spatialReference",["spatialReference","fullExtent.spatialReference"])],U.prototype,"readSpatialReference",null),e([a({type:[String],json:{write:!0}})],U.prototype,"subDomains",void 0),e([a({type:j,json:{write:!0}})],U.prototype,"tileInfo",void 0),e([a({readOnly:!0})],U.prototype,"tileServers",null),e([a({json:{read:!1}})],U.prototype,"type",void 0),e([a()],U.prototype,"urlPath",null),e([a({type:String,json:{origins:{"portal-item":{read:{source:"url"}}}}})],U.prototype,"urlTemplate",void 0),e([p("urlTemplate",["urlTemplate","templateUrl"])],U.prototype,"readUrlTemplate",null),e([c("urlTemplate",{templateUrl:{type:String}})],U.prototype,"writeUrlTemplate",null),e([a({type:T,json:{write:!0}})],U.prototype,"wmtsInfo",void 0),U=x=e([u("esri.layers.WebTileLayer")],U);const L=U;export{L as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as i,websceneRasterRendererTypes as r,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{watch as p}from"../../core/reactiveUtils.js";import{urlToObject as c}from"../../core/urlUtils.js";import{property as m,ensureRange as d}from"../../core/accessorSupport/decorators/property.js";import{Integer as h,ensureClass as f,ensureNumber as g}from"../../core/accessorSupport/ensureType.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as R}from"../../core/accessorSupport/decorators/subclass.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";import{opacity as S,url as v}from"../support/commonProperties.js";import x from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as I}from"../support/ExportImageServiceParameters.js";import w from"../support/Field.js";import _ from"../support/FieldsIndex.js";import{createBitmap as F}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import j from"../support/MultidimensionalSubset.js";import T from"../support/PixelBlock.js";import{interpolationKebab as O,noDataInterpretationKebab as N}from"../support/rasterEnums.js";import C from"../support/RasterFunction.js";import M from"../support/RasterInfo.js";import A from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as J,getSubsetVariablesFromMdInfo as q,getDefaultMultidimensionalDefinition as E}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as V,getFormat as H}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as Q}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as L,createDefaultRenderer as z,normalizeRendererJSON as B}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as G,computePixelSpaceLocations as W,computeHistograms as $,computeStatisticsHistograms as K,measureHeight as X,measureAreaAndPerimeter as Y,measureDistanceAndAngle as Z,measurePointOrCentroid as ee,getImageSpatialReferenceQueryParameter as te,getSamples as ie,identify as re}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as se}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import ne from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import oe from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ae from"../../rest/support/FeatureSet.js";import le from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ue}from"../../rest/query/executeForCount.js";import{executeForIds as pe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as ce,generateRasterInfo as me}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as de}from"../../rest/imageService/getCatalogItemRasterInfo.js";import he from"../../rest/support/ImageAngleParameters.js";import fe from"../../rest/support/ImageAreaParameters.js";import ge from"../../rest/support/ImageDistanceParameters.js";import ye from"../../rest/support/ImageHeightParameters.js";import Re from"../../rest/support/ImageHistogramParameters.js";import be from"../../rest/support/ImageIdentifyParameters.js";import Se from"../../rest/support/ImagePixelLocationParameters.js";import ve from"../../rest/support/ImagePointParameters.js";import xe from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as Ie}from"../../views/2d/engine/flow/dataUtils.js";import we from"../../geometry/SpatialReference.js";const _e=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Fe=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),De=d(g,{min:0,max:255});function Pe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),i=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return i?i.join("/"):null}const je=a=>{let d=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new I({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new _(this.fields):null}set format(e){e&&Fe.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?P.fromJSON(i):this._isMosaicRuleSupported(t)?P.fromJSON(t):null}writeMosaicRule(e,t,i){let r=this.mosaicRule;const s=this.definitionExpression;r?s&&s!==r.where&&(r=r.clone(),r.where=s):s&&(r=new P({where:s})),this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=De(e))}readObjectIdField(e,t){if(!e){const i=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=i&&i[0]&&i[0].name}return e}get parsedUrl(){return c(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,n=s(r,i);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!r.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),D(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new w({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new w({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new w({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(i),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(r),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new w({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new w({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new w({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=n){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const i=l(t);return i.name=e+t.name,i}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=C.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i&&i.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?C.fromJSON({rasterFunctionDefinition:t.renderingRule}):C.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,i){const r=e.toJSON();r.rasterFunctionDefinition?t[i]=r.rasterFunctionDefinition:t[i]=r}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?we.fromJSON(i):null}readPixelType(e){return _e.fromJSON(e)||e}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=_e.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e;const{renderer:r,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&r&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(r.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=r.toJSON());const l=await a.symbolize({bandIds:o,...e},t);i={extent:e.extent,pixelBlock:l}}else i={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return i}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=f(he,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=f(Se,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=f(Re,e).clone(),this._applyMosaicAndRenderingRules(e),$(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=f(Re,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new o("imagery-layer:measure-height","this operation is not supported on the input image service");return e=f(ye,e).clone(),this._applyMosaicAndRenderingRules(e),X(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new o("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=f(fe,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new o("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=f(ge,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new o("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=f(ve,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async fetchImage(e,t,i,r={}){if(null==e||null==t||null==i)throw new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this.generateRasterInfo(this.renderingRule,{signal:r.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(null==s){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await F(e,`${g(this.parsedUrl)}/exportImage`)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*i,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(T.createEmptyBand(l,a));return{pixelData:{pixelBlock:new T({width:t,height:i,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!r.requestAsImageElement&&!this.pixelFilter,a=n&&!!r.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:n,returnImageBitmap:a,signal:r.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(g(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(g(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ae.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return de(g(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:i}=await n(g(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),r=i&&i.ics;if(!r)return;let s=null;try{s=(await n(g(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:r,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(g(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),R=await Promise.all([o,u,y]);let b=R[0].ipxf;if(null==b){const e=r.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(b={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=ne.fromJSON(R[1]&&R[1].geometries&&R[1].geometries[0]);S&&(S.spatialReference=new we({wkid:0,imageCoordinateSystem:r}));const v=R[2].geometries?R[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],x=v.length;if(x<3)return{ics:r,icsToPixelTransform:b,icsExtent:S,northDirection:null};let I=0,w=0,_=0,F=0;for(let n=0;n<x;n++)I+=v[n].x,w+=v[n].y,_+=v[n].x*v[n].x,F+=v[n].x*v[n].y;const D=(x*F-I*w)/(x*_-I*I);let P=0;const j=v[p-1].x>v[0].x,T=v[p-1].y>v[0].y;return D===1/0?P=T?90:270:0===D?P=j?0:180:D>0?P=j?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(P=T?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:r,icsToPixelTransform:b,icsExtent:S,northDirection:P}}async generateRasterInfo(e,t){if(e=f(C,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const i=Pe(e);if(!i)return null;if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const r=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=r;try{return await r}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,i,r){e=e.clone().shiftCentralMeridian();const s=te(e.spatialReference,g(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._processMultidimensionalIntersection(null,r,this.exportImageServiceParameters.mosaicRule);if(c.isOutSide)return null;n.mosaicRule=null!=c.mosaicRule?JSON.stringify(c.mosaicRule):null,r=c.timeExtent,n.renderingRule=this._getRenderingRuleString(C.fromJSON(l));const m={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+i,...n,...m}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=f(xe,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),ie(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new o("imagery-layer:identify","identify operation is not supported on the input image service");e=f(be,e).clone();const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new o("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),r&&null==e.raster&&(e.raster=r),re(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new le;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),se(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),pe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ue(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(a=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new C({functionName:e[0]}))),u=t.map((e=>e[1]));const{renderingRule:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some((e=>e.functionName===i.functionName))&&(l.push(i),u.push(i.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:i}=J(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new o("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");i&&null!=i.timeExtent&&(h=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h),g=this._getQueryParams({geometry:e.geometry,timeExtent:h,mosaicRule:f,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:i,returnCatalogItems:a,returnGeometry:m,raster:this.raster,maxItemCount:s?1:null});delete g.f;const y=new be(g);try{await this.generateRasterInfo(this.renderingRule);const i=await re(this.url,y,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=null!=i.value&&i.value.toLowerCase().includes("nodata");if(!(a&&!m&&i?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=i.catalogItems?.features??[],c=p.map((e=>e.attributes?.[l])),d=new le({objectIds:c,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((i=>{i.attributes[l]===t.attributes[l]&&(i.geometry=new oe(t.geometry),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const i=n(g(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),r=n(g(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([i,r]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):Ie(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return q(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):ce(g(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),r=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([p((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],c=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new x({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?f(le,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new A;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:i}=this;return"unique-value"===e.type&&this._hasRenderingRule(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&U(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:i,ssl:r}=await n(g(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=i,this.sourceJSON=t,r&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&i.bandCount>=3){const e=L(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=z(i,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=B(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=i):this.symbolizer=new k({rendererJSON:t,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){e&&null!=e.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):V(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const i=await n(g(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return i.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:i,returnImageBitmap:r,signal:s}=e;if(i&&this._canRequestImageElement(t.format)){const i=`${g(this.parsedUrl)}/exportImage`,{data:o}=await n(i,{responseType:r?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await F(o,i),params:t}}return{imageOrCanvasElement:o,params:t}}const a=this._initJobHandler(),l=n(g(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,a]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=H(u)),!c)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?V(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return me(g(this.parsedUrl),e,i)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=E(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.renderingRule&&"none"!==this.renderingRule.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=i,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,p=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof r&&r.toLowerCase().includes("nodata"),d=[];if(r&&!u&&!m){const e={};e[c]=0;p=[r],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,f,g;this._updateResponseFieldNames(u,a),m&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=r){if(f=p[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:r,"nodata"===f.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",i="Raster.ServicePixelValue";h.attributes[e]=f,h.attributes[i]=g,this._updateFeatureWithMagDirValues(h,f);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&null!=this.serviceRasterInfo.attributeTable?o?f:r:g;this.renderingRule||(a=o?f:r),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=J(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&null!=s.timeExtent&&(t=s.timeExtent)}if(null!=(i=this._combineMosaicRuleWithTimeExtent(i,t))&&i.multidimensionalDefinition){const{isOutside:e}=J(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=r.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const i=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[i]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map((e=>parseFloat(e))),r=i.map((e=>[e])),s=i.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new T({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ne(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Q([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find((e=>e.code===i));r&&(e.attributes[t.name]=r.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach((e=>{if(e&&e.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return null!=e&&null!=e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replace(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,renderingRule:r}=this;r&&null==e.renderingRule&&(e.renderingRule=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:i,advancedQueryCapabilities:r,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:i>=10.2&&n,supportsProject:i>=10.3&&n,supportsComputeStatisticsHistograms:i>=10.4&&n,supportsQueryBoundary:i>=10.6&&n,supportsCalculateVolume:i>=10.7&&o,supportsComputePixelLocation:i>=10.7&&t.includes("catalog"),supportsComputeAngles:i>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!r?.supportsStatistics,supportsOrderBy:!!r?.supportsOrderBy,supportsDistinct:!!r?.supportsDistinct,supportsPagination:!!r?.supportsPagination,supportsStandardizedQueriesOnly:!!r?.useStandardizedQueries,supportsPercentileStatistics:!!r?.supportsPercentileStatistics,supportsCentroid:!!r?.supportsReturningGeometryCentroid,supportsDistance:!!r?.supportsQueryWithDistance,supportsExtent:!!r?.supportsReturningQueryExtent,supportsGeometryProperties:!!r?.supportsReturningGeometryProperties,supportsHavingClause:!!r?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!r?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function g(e){return e?.path??""}return e([m()],d.prototype,"_functionRasterInfos",void 0),e([m()],d.prototype,"_rasterJobHandler",void 0),e([m()],d.prototype,"_cachedRendererJson",void 0),e([m({readOnly:!0})],d.prototype,"_serviceSupportsMosaicRule",void 0),e([y("_serviceSupportsMosaicRule",["currentVersion","fields"])],d.prototype,"readServiceSupportsMosaicRule",null),e([m()],d.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([m({readOnly:!0})],d.prototype,"_rasterFunctionNamesIndex",null),e([m()],d.prototype,"adjustAspectRatio",void 0),e([m({type:[h],json:{write:!0}})],d.prototype,"bandIds",void 0),e([y("bandIds")],d.prototype,"readBandIds",null),e([m({readOnly:!0,json:{read:!1}})],d.prototype,"capabilities",void 0),e([y("service","capabilities",["capabilities","currentVersion","serviceDataType"])],d.prototype,"readCapabilities",null),e([m({type:Number})],d.prototype,"compressionQuality",void 0),e([b("compressionQuality")],d.prototype,"writeCompressionQuality",null),e([m({type:Number})],d.prototype,"compressionTolerance",void 0),e([b("compressionTolerance")],d.prototype,"writeCompressionTolerance",null),e([m({json:{read:{source:"copyrightText"}}})],d.prototype,"copyright",void 0),e([m({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],d.prototype,"defaultMosaicRule",void 0),e([y("defaultMosaicRule",["defaultMosaicMethod"])],d.prototype,"readDefaultMosaicRule",null),e([m({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],d.prototype,"definitionExpression",void 0),e([m({readOnly:!0,constructOnly:!0})],d.prototype,"exportImageServiceParameters",void 0),e([m()],d.prototype,"rasterInfo",void 0),e([m({readOnly:!0,type:[w]})],d.prototype,"fields",void 0),e([m({readOnly:!0})],d.prototype,"fieldsIndex",null),e([m({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],d.prototype,"format",null),e([y("service","format",["serviceDataType"])],d.prototype,"readFormat",null),e([m({type:ne})],d.prototype,"fullExtent",void 0),e([m({readOnly:!0})],d.prototype,"hasMultidimensions",void 0),e([m({json:{read:{source:"maxImageHeight"}}})],d.prototype,"imageMaxHeight",void 0),e([m({json:{read:{source:"maxImageWidth"}}})],d.prototype,"imageMaxWidth",void 0),e([m({type:String,json:{type:O.jsonValues,read:O.read,write:O.write}})],d.prototype,"interpolation",void 0),e([m()],d.prototype,"minScale",void 0),e([y("service","minScale")],d.prototype,"readMinScale",null),e([m()],d.prototype,"maxScale",void 0),e([y("service","maxScale")],d.prototype,"readMaxScale",null),e([m({type:P})],d.prototype,"mosaicRule",null),e([y("mosaicRule",["mosaicRule","defaultMosaicMethod"])],d.prototype,"readMosaicRule",null),e([b("mosaicRule")],d.prototype,"writeMosaicRule",null),e([m()],d.prototype,"multidimensionalInfo",void 0),e([m({type:j,json:{write:!0}})],d.prototype,"multidimensionalSubset",void 0),e([m({json:{type:h}})],d.prototype,"noData",void 0),e([b("noData")],d.prototype,"writeNoData",null),e([m({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],d.prototype,"noDataInterpretation",void 0),e([m({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],d.prototype,"objectIdField",void 0),e([y("objectIdField")],d.prototype,"readObjectIdField",null),e([m({})],d.prototype,"geometryType",void 0),e([m({})],d.prototype,"typeIdField",void 0),e([m({})],d.prototype,"types",void 0),e([m({readOnly:!0})],d.prototype,"parsedUrl",null),e([m({type:Function})],d.prototype,"pixelFilter",void 0),e([m()],d.prototype,"raster",void 0),e([m({readOnly:!0})],d.prototype,"sourceType",void 0),e([y("sourceType",["serviceSourceType","fields"])],d.prototype,"readSourceType",null),e([m()],d.prototype,"viewId",void 0),e([m({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:r,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],d.prototype,"renderer",null),e([y("renderer")],d.prototype,"readRenderer",null),e([b("renderer")],d.prototype,"writeRenderer",null),e([m()],d.prototype,"symbolizer",void 0),e([m(S)],d.prototype,"opacity",void 0),e([m({readOnly:!0})],d.prototype,"rasterFields",null),e([m({constructOnly:!0})],d.prototype,"rasterFunctionInfos",void 0),e([m({type:C})],d.prototype,"renderingRule",null),e([y("renderingRule",["renderingRule","rasterFunctionInfos"])],d.prototype,"readRenderingRule",null),e([b("renderingRule")],d.prototype,"writeRenderingRule",null),e([m()],d.prototype,"serviceDataType",void 0),e([m({readOnly:!0,type:we})],d.prototype,"spatialReference",void 0),e([y("spatialReference",["spatialReference","extent"])],d.prototype,"readSpatialReference",null),e([m({json:{type:_e.jsonValues}})],d.prototype,"pixelType",void 0),e([y("pixelType")],d.prototype,"readPixelType",null),e([b("pixelType")],d.prototype,"writePixelType",null),e([m({constructOnly:!0,type:M})],d.prototype,"serviceRasterInfo",void 0),e([m()],d.prototype,"sourceJSON",void 0),e([m(v)],d.prototype,"url",void 0),e([m({readOnly:!0})],d.prototype,"version",void 0),e([y("version",["currentVersion","fields","timeInfo"])],d.prototype,"readVersion",null),d=e([R("esri.layers.mixins.ArcGISImageService")],d),d};export{je as ArcGISImageService};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{rasterRendererTypes as i,websceneRasterRendererTypes as r,read as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{watch as p}from"../../core/reactiveUtils.js";import{urlToObject as c}from"../../core/urlUtils.js";import{property as m,ensureRange as d}from"../../core/accessorSupport/decorators/property.js";import{Integer as h,ensureClass as f,ensureNumber as g}from"../../core/accessorSupport/ensureType.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as R}from"../../core/accessorSupport/decorators/subclass.js";import{writer as b}from"../../core/accessorSupport/decorators/writer.js";import{opacity as S,url as v}from"../support/commonProperties.js";import x from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as I}from"../support/ExportImageServiceParameters.js";import w from"../support/Field.js";import _ from"../support/FieldsIndex.js";import{createBitmap as F}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import P from"../support/MosaicRule.js";import j from"../support/MultidimensionalSubset.js";import T from"../support/PixelBlock.js";import{interpolationKebab as O,noDataInterpretationKebab as N}from"../support/rasterEnums.js";import C from"../support/RasterFunction.js";import M from"../support/RasterInfo.js";import A from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as J,getSubsetVariablesFromMdInfo as q,getDefaultMultidimensionalDefinition as E}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as V,getFormat as H}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as Q}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as L,createDefaultRenderer as z,normalizeRendererJSON as B}from"../../renderers/support/rasterRendererHelper.js";import k from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as G,computePixelSpaceLocations as W,computeHistograms as $,computeStatisticsHistograms as K,measureHeight as X,measureAreaAndPerimeter as Y,measureDistanceAndAngle as Z,measurePointOrCentroid as ee,getImageSpatialReferenceQueryParameter as te,getSamples as ie,identify as re}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as se}from"../../rest/query/executeQueryJSON.js";import"../../config.js";import"../../kernel.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import ne from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import oe from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ae from"../../rest/support/FeatureSet.js";import le from"../../rest/support/Query.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ue}from"../../rest/query/executeForCount.js";import{executeForIds as pe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as ce,generateRasterInfo as me}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as de}from"../../rest/imageService/getCatalogItemRasterInfo.js";import he from"../../rest/support/ImageAngleParameters.js";import fe from"../../rest/support/ImageAreaParameters.js";import ge from"../../rest/support/ImageDistanceParameters.js";import ye from"../../rest/support/ImageHeightParameters.js";import Re from"../../rest/support/ImageHistogramParameters.js";import be from"../../rest/support/ImageIdentifyParameters.js";import Se from"../../rest/support/ImagePixelLocationParameters.js";import ve from"../../rest/support/ImagePointParameters.js";import xe from"../../rest/support/ImageSampleParameters.js";import{createFlowMesh as Ie}from"../../views/2d/engine/flow/dataUtils.js";import we from"../../geometry/SpatialReference.js";const _e=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),Fe=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),De=d(g,{min:0,max:255});function Pe(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi),i=t?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return i?i.join("/"):null}const je=a=>{let d=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new I({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?P.fromJSON(t):null}get fieldsIndex(){return this.fields?new _(this.fields):null}set format(e){e&&Fe.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t&&t.mosaicMethod&&(t=P.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?P.fromJSON(i):this._isMosaicRuleSupported(t)?P.fromJSON(t):null}writeMosaicRule(e,t,i){let r=this.mosaicRule;const s=this.definitionExpression;r?s&&s!==r.where&&(r=r.clone(),r.where=s):s&&(r=new P({where:s})),this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=De(e))}readObjectIdField(e,t){if(!e){const i=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=i&&i[0]&&i[0].name}return e}get parsedUrl(){return c(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,n=s(r,i);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!r.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),D(n)||u.getLogger(this.declaredClass).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this._rasterAttributeTableFieldPrefix||"Raster.",t=new w({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new w({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new w({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(i),this.capabilities?.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(r),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new w({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),this._isVectorDataSet()&&(s.push(new w({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new w({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:n}=this.rasterInfo??{};if(null!=n){const t=n.fields.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const i=l(t);return i.name=e+t.name,i}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=C.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i&&i.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?C.fromJSON({rasterFunctionDefinition:t.renderingRule}):C.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,i){const r=e.toJSON();r.rasterFunctionDefinition?t[i]=r.rasterFunctionDefinition:t[i]=r}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?we.fromJSON(i):null}readPixelType(e){return _e.fromJSON(e)||e}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=_e.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e;const{renderer:r,symbolizer:s,pixelFilter:n,bandIds:o}=this;if(!this._isPicture()&&r&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(r.toJSON()),a=this._rasterJobHandler.instance;if(a){n&&(s.bind(),await a.updateSymbolizer(s,t),this._cachedRendererJson=r.toJSON());const l=await a.symbolize({bandIds:o,...e},t);i={extent:e.extent,pixelBlock:l}}else i={extent:e.extent,pixelBlock:s.symbolize({bandIds:o,...e})}}return i}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=f(he,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=f(Se,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=f(Re,e).clone(),this._applyMosaicAndRenderingRules(e),$(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=f(Re,e).clone(),this._applyMosaicAndRenderingRules(e),K(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new o("imagery-layer:measure-height","this operation is not supported on the input image service");return e=f(ye,e).clone(),this._applyMosaicAndRenderingRules(e),X(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new o("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=f(fe,e).clone(),this._applyMosaicAndRenderingRules(e),Y(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new o("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=f(ge,e).clone(),this._applyMosaicAndRenderingRules(e),Z(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new o("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=f(ve,e).clone(),this._applyMosaicAndRenderingRules(e),ee(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async fetchImage(e,t,i,r={}){if(null==e||null==t||null==i)throw new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this.generateRasterInfo(this.renderingRule,{signal:r.signal});e&&(this.rasterInfo=e)}const s=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(null==s){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await F(e,`${g(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,o=(s?.length||n.bandCount)??0,a=t*i,l=n.pixelType,u=[];for(let e=0;e<o;e++)u.push(T.createEmptyBand(l,a));return{pixelData:{pixelBlock:new T({width:t,height:i,pixels:u,mask:new Uint8Array(a),pixelType:l}),extent:e}}}const n=!!r.requestAsImageElement&&!this.pixelFilter,a=n&&!!r.returnImageBitmap,l={imageServiceParameters:s,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:n,returnImageBitmap:a,signal:r.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return n(g(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(g(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ae.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return de(g(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:i}=await n(g(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),r=i&&i.ics;if(!r)return;let s=null;try{s=(await n(g(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:r,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(g(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(g(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),R=await Promise.all([o,u,y]);let b=R[0].ipxf;if(null==b){const e=r.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(b={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const S=ne.fromJSON(R[1]&&R[1].geometries&&R[1].geometries[0]);S&&(S.spatialReference=new we({wkid:0,imageCoordinateSystem:r}));const v=R[2].geometries?R[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],x=v.length;if(x<3)return{ics:r,icsToPixelTransform:b,icsExtent:S,northDirection:null};let I=0,w=0,_=0,F=0;for(let n=0;n<x;n++)I+=v[n].x,w+=v[n].y,_+=v[n].x*v[n].x,F+=v[n].x*v[n].y;const D=(x*F-I*w)/(x*_-I*I);let P=0;const j=v[p-1].x>v[0].x,T=v[p-1].y>v[0].y;return D===1/0?P=T?90:270:0===D?P=j?0:180:D>0?P=j?180*Math.atan(D)/Math.PI:180*Math.atan(D)/Math.PI+180:D<0&&(P=T?180+180*Math.atan(D)/Math.PI:360+180*Math.atan(D)/Math.PI),{ics:r,icsToPixelTransform:b,icsExtent:S,northDirection:P}}async generateRasterInfo(e,t){if(e=f(C,e),this.serviceRasterInfo&&(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const i=Pe(e);if(!i)return null;if(this._functionRasterInfos[i])return this._functionRasterInfos[i];const r=this._generateRasterInfo(e,t);this._functionRasterInfos[i]=r;try{return await r}catch{return this._functionRasterInfos[i]=null,null}}getExportImageServiceParameters(e,t,i,r){e=e.clone().shiftCentralMeridian();const s=te(e.spatialReference,g(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,p=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&p){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const c=this._processMultidimensionalIntersection(null,r,this.exportImageServiceParameters.mosaicRule);if(c.isOutSide)return null;n.mosaicRule=null!=c.mosaicRule?JSON.stringify(c.mosaicRule):null,r=c.timeExtent,n.renderingRule=this._getRenderingRuleString(C.fromJSON(l));const m={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?m.time=""+e:null==e&&null==t||(m.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+i,...n,...m}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=f(xe,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),ie(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new o("imagery-layer:identify","identify operation is not supported on the input image service");e=f(be,e).clone();const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new o("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),r&&null==e.raster&&(e.raster=r),re(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new le;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),se(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),pe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ue(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const p="raster.servicepixelvalue",c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(a=e.outFields.some((e=>!e.toLowerCase().includes(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new C({functionName:e[0]}))),u=t.map((e=>e[1]));const{renderingRule:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some((e=>e.functionName===i.functionName))&&(l.push(i),u.push(i.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:i}=J(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new o("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");i&&null!=i.timeExtent&&(h=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h),g=this._getQueryParams({geometry:e.geometry,timeExtent:h,mosaicRule:f,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:i,returnCatalogItems:a,returnGeometry:m,raster:this.raster,maxItemCount:s?1:null});delete g.f;const y=new be(g);try{await this.generateRasterInfo(this.renderingRule);const i=await re(this.url,y,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=null!=i.value&&i.value.toLowerCase().includes("nodata");if(!(a&&!m&&i?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",p=i.catalogItems?.features??[],c=p.map((e=>e.attributes?.[l])),d=new le({objectIds:c,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),h=await this.queryRasters(d);return h?.features?.length&&h.features.forEach((t=>{p.forEach((i=>{i.attributes[l]===t.attributes[l]&&(i.geometry=new oe(t.geometry),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const i=n(g(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),r=n(g(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([i,r]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):Ie(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return q(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):ce(g(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),e))),r=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),u.getLogger(this.declaredClass).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([p((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const o=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),a=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==a||null==l||a===l,p=u?[a||l]:[[a,l]],c=this.version>=10.8;if(o.length)o.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new x({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?f(le,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new A;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:i}=this;return"unique-value"===e.type&&this._hasRenderingRule(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&U(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:i,ssl:r}=await n(g(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=i,this.sourceJSON=t,r&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&i.bandCount>=3){const e=L(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=z(i,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=B(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=i):this.symbolizer=new k({rendererJSON:t,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){e&&null!=e.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):V(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const i=await n(g(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return i.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:i,returnImageBitmap:r,signal:s}=e;if(i&&this._canRequestImageElement(t.format)){const i=`${g(this.parsedUrl)}/exportImage`,{data:o}=await n(i,{responseType:r?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:s});if(o instanceof Blob){return{imageBitmap:await F(o,i,s),params:t}}return{imageOrCanvasElement:o,params:t}}const a=this._initJobHandler(),l=n(g(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:s}),u=(await Promise.all([l,a]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=H(u)),!c)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:s},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?V(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return me(g(this.parsedUrl),e,i)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=E(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new P;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.renderingRule&&"none"!==this.renderingRule.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=i,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,p=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof r&&r.toLowerCase().includes("nodata"),d=[];if(r&&!u&&!m){const e={};e[c]=0;p=[r],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let h,f,g;this._updateResponseFieldNames(u,a),m&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(h=u[t],null!=r){if(f=p[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:r,"nodata"===f.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",i="Raster.ServicePixelValue";h.attributes[e]=f,h.attributes[i]=g,this._updateFeatureWithMagDirValues(h,f);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&null!=this.serviceRasterInfo.attributeTable?o?f:r:g;this.renderingRule||(a=o?f:r),this._updateFeatureWithRasterAttributeTableValues(h,a)}if(h.sourceLayer=h.layer=this,o&&this._updateFeatureWithDomainValues(h),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];h.attributes[t]=l[e]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=J(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};s&&null!=s.timeExtent&&(t=s.timeExtent)}if(null!=(i=this._combineMosaicRuleWithTimeExtent(i,t))&&i.multidimensionalDefinition){const{isOutside:e}=J(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=r.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const i=this._rasterAttributeTableFieldPrefix+t.name;e.attributes[i]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map((e=>parseFloat(e))),r=i.map((e=>[e])),s=i.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new T({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new ne(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Q([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find((e=>e.code===i));r&&(e.attributes[t.name]=r.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach((e=>{if(e&&e.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return null!=e&&null!=e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replace(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,renderingRule:r}=this;r&&null==e.renderingRule&&(e.renderingRule=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:i,advancedQueryCapabilities:r,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&a,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:u,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:i>=10.2&&n,supportsProject:i>=10.3&&n,supportsComputeStatisticsHistograms:i>=10.4&&n,supportsQueryBoundary:i>=10.6&&n,supportsCalculateVolume:i>=10.7&&o,supportsComputePixelLocation:i>=10.7&&t.includes("catalog"),supportsComputeAngles:i>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!r?.supportsStatistics,supportsOrderBy:!!r?.supportsOrderBy,supportsDistinct:!!r?.supportsDistinct,supportsPagination:!!r?.supportsPagination,supportsStandardizedQueriesOnly:!!r?.useStandardizedQueries,supportsPercentileStatistics:!!r?.supportsPercentileStatistics,supportsCentroid:!!r?.supportsReturningGeometryCentroid,supportsDistance:!!r?.supportsQueryWithDistance,supportsExtent:!!r?.supportsReturningQueryExtent,supportsGeometryProperties:!!r?.supportsReturningGeometryProperties,supportsHavingClause:!!r?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!r?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function g(e){return e?.path??""}return e([m()],d.prototype,"_functionRasterInfos",void 0),e([m()],d.prototype,"_rasterJobHandler",void 0),e([m()],d.prototype,"_cachedRendererJson",void 0),e([m({readOnly:!0})],d.prototype,"_serviceSupportsMosaicRule",void 0),e([y("_serviceSupportsMosaicRule",["currentVersion","fields"])],d.prototype,"readServiceSupportsMosaicRule",null),e([m()],d.prototype,"_rasterAttributeTableFieldPrefix",void 0),e([m({readOnly:!0})],d.prototype,"_rasterFunctionNamesIndex",null),e([m()],d.prototype,"adjustAspectRatio",void 0),e([m({type:[h],json:{write:!0}})],d.prototype,"bandIds",void 0),e([y("bandIds")],d.prototype,"readBandIds",null),e([m({readOnly:!0,json:{read:!1}})],d.prototype,"capabilities",void 0),e([y("service","capabilities",["capabilities","currentVersion","serviceDataType"])],d.prototype,"readCapabilities",null),e([m({type:Number})],d.prototype,"compressionQuality",void 0),e([b("compressionQuality")],d.prototype,"writeCompressionQuality",null),e([m({type:Number})],d.prototype,"compressionTolerance",void 0),e([b("compressionTolerance")],d.prototype,"writeCompressionTolerance",null),e([m({json:{read:{source:"copyrightText"}}})],d.prototype,"copyright",void 0),e([m({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],d.prototype,"defaultMosaicRule",void 0),e([y("defaultMosaicRule",["defaultMosaicMethod"])],d.prototype,"readDefaultMosaicRule",null),e([m({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],d.prototype,"definitionExpression",void 0),e([m({readOnly:!0,constructOnly:!0})],d.prototype,"exportImageServiceParameters",void 0),e([m()],d.prototype,"rasterInfo",void 0),e([m({readOnly:!0,type:[w]})],d.prototype,"fields",void 0),e([m({readOnly:!0})],d.prototype,"fieldsIndex",null),e([m({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],d.prototype,"format",null),e([y("service","format",["serviceDataType"])],d.prototype,"readFormat",null),e([m({type:ne})],d.prototype,"fullExtent",void 0),e([m({readOnly:!0})],d.prototype,"hasMultidimensions",void 0),e([m({json:{read:{source:"maxImageHeight"}}})],d.prototype,"imageMaxHeight",void 0),e([m({json:{read:{source:"maxImageWidth"}}})],d.prototype,"imageMaxWidth",void 0),e([m({type:String,json:{type:O.jsonValues,read:O.read,write:O.write}})],d.prototype,"interpolation",void 0),e([m()],d.prototype,"minScale",void 0),e([y("service","minScale")],d.prototype,"readMinScale",null),e([m()],d.prototype,"maxScale",void 0),e([y("service","maxScale")],d.prototype,"readMaxScale",null),e([m({type:P})],d.prototype,"mosaicRule",null),e([y("mosaicRule",["mosaicRule","defaultMosaicMethod"])],d.prototype,"readMosaicRule",null),e([b("mosaicRule")],d.prototype,"writeMosaicRule",null),e([m()],d.prototype,"multidimensionalInfo",void 0),e([m({type:j,json:{write:!0}})],d.prototype,"multidimensionalSubset",void 0),e([m({json:{type:h}})],d.prototype,"noData",void 0),e([b("noData")],d.prototype,"writeNoData",null),e([m({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],d.prototype,"noDataInterpretation",void 0),e([m({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],d.prototype,"objectIdField",void 0),e([y("objectIdField")],d.prototype,"readObjectIdField",null),e([m({})],d.prototype,"geometryType",void 0),e([m({})],d.prototype,"typeIdField",void 0),e([m({})],d.prototype,"types",void 0),e([m({readOnly:!0})],d.prototype,"parsedUrl",null),e([m({type:Function})],d.prototype,"pixelFilter",void 0),e([m()],d.prototype,"raster",void 0),e([m({readOnly:!0})],d.prototype,"sourceType",void 0),e([y("sourceType",["serviceSourceType","fields"])],d.prototype,"readSourceType",null),e([m()],d.prototype,"viewId",void 0),e([m({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:r,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],d.prototype,"renderer",null),e([y("renderer")],d.prototype,"readRenderer",null),e([b("renderer")],d.prototype,"writeRenderer",null),e([m()],d.prototype,"symbolizer",void 0),e([m(S)],d.prototype,"opacity",void 0),e([m({readOnly:!0})],d.prototype,"rasterFields",null),e([m({constructOnly:!0})],d.prototype,"rasterFunctionInfos",void 0),e([m({type:C})],d.prototype,"renderingRule",null),e([y("renderingRule",["renderingRule","rasterFunctionInfos"])],d.prototype,"readRenderingRule",null),e([b("renderingRule")],d.prototype,"writeRenderingRule",null),e([m()],d.prototype,"serviceDataType",void 0),e([m({readOnly:!0,type:we})],d.prototype,"spatialReference",void 0),e([y("spatialReference",["spatialReference","extent"])],d.prototype,"readSpatialReference",null),e([m({json:{type:_e.jsonValues}})],d.prototype,"pixelType",void 0),e([y("pixelType")],d.prototype,"readPixelType",null),e([b("pixelType")],d.prototype,"writePixelType",null),e([m({constructOnly:!0,type:M})],d.prototype,"serviceRasterInfo",void 0),e([m()],d.prototype,"sourceJSON",void 0),e([m(v)],d.prototype,"url",void 0),e([m({readOnly:!0})],d.prototype,"version",void 0),e([y("version",["currentVersion","fields","timeInfo"])],d.prototype,"readVersion",null),d=e([R("esri.layers.mixins.ArcGISImageService")],d),d};export{je as ArcGISImageService};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"../../core/Error.js";async function
|
|
5
|
+
import r from"../../core/Error.js";import{throwIfAborted as e}from"../../core/promiseUtils.js";async function t(t,o,a){let c;try{c=await createImageBitmap(t)}catch(l){throw new r("request:server",`Unable to load ${o}`,{url:o,error:l})}return e(a),c}async function o(t,o,a,c,l){let n;try{n=await createImageBitmap(t)}catch(i){throw new r("request:server",`Unable to load tile ${o}/${a}/${c}`,{error:i,level:o,row:a,col:c})}return e(l),n}export{t as createBitmap,o as createTileBitmap};
|
package/package.json
CHANGED