@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.83 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../../core/accessorSupport/decorators.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 d from"../../layers/LayerView.js";import{RefreshableLayerView as f}from"../../layers/RefreshableLayerView.js";let p=class extends(f(n(a(d)))){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()],p.prototype,"layer",void 0),e([s()],p.prototype,"suspended",void 0),e([s()],p.prototype,"tileInfo",void 0),p=e([o("esri.views.3d.layers.WMTSLayerView3D")],p);const c=p;export{c as default};