@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 3.07 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getTileMaxtrixSetFromActiveLayer as l}from"../../../layers/support/layerUtils.js";import{LayerView3D as a}from"./LayerView3D.js";import{TiledLayerView3D as n}from"./TiledLayerView3D.js";import{fetchTile as h}from"./support/fetchTile.js";import c from"../../layers/LayerView.js";import p from"../../layers/RefreshableLayerView.js";let d=class extends(p(n(a(c)))){constructor(){super(...arguments),this.type="wmts-3d"}initialize(){this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoSupportError(e.tileInfo,e.fullExtent)));const e=r((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoError(e.tileInfo,e.fullExtent)));null!=e&&(null!==e.id&&this.layer.activeLayer.tileMatrixSetId!==e.id&&(this.layer.activeLayer.tileMatrixSetId=e.id),e.tileInfo&&(this.tileInfo=e.tileInfo),this.layer.fullExtent=e.fullExtent)}));this.addResolvingPromise(e),this.when((()=>this._postInitialize()))}refresh(){this.emit("data-changed")}canResume(){if(!super.canResume())return!1;const e=this.layer.activeLayer.tileMatrixSet;return null!=e&&!this._getTileInfoError(e.tileInfo,e.fullExtent)}async fetchTile(e,t){return h(this,e,t)}async doRefresh(){this.suspended||this.emit("data-changed")}_postInitialize(){this._updatingHandles.add((()=>this.layer?.activeLayer?.styleId),(()=>this.refresh())),this._updatingHandles.add((()=>this.layer?.activeLayer),(e=>{const t=this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoError(e.tileInfo,e.fullExtent)),!0);t&&null!=t.id&&e.tileMatrixSetId!==t.id&&(this.layer.activeLayer.tileMatrixSetId=t.id),this.notifyChange("suspended"),this.canResume()&&this.refresh()}))}_getCompatibleTileInfoMatrixSet(e,r=!1){const s=l(this.layer);if(null!=s){if(t.isCollection(s)){const t=s.find((t=>{const s=e(t);return null!=s&&(r?i.getLogger(this).error("The selected tile matrix set is not compatible with the view",s):this.addResolvingPromise(Promise.reject(s))),null==s}));return t}const o=e(s);return null!=o&&(r?i.getLogger(this).error("The selected tile matrix set is not compatible with the view",o):this.addResolvingPromise(Promise.reject(o))),s}return null}_getTileInfoError(e,t){return this._getTileInfoSupportError(e,t)||this._getTileInfoCompatibilityError(e,this.view.basemapTerrain.tilingScheme)}};e([s()],d.prototype,"layer",void 0),e([s()],d.prototype,"suspended",void 0),e([s()],d.prototype,"tileInfo",void 0),d=e([o("esri.views.3d.layers.WMTSLayerView3D")],d);const m=d;export{m as default};