@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 2.99 kB
JavaScript
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import i from"../../../core/Logger.js";import{isSome as r,isNone as s}from"../../../core/maybe.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{getTileMaxtrixSetFromActiveLayer as n}from"../../../layers/support/layerUtils.js";import{LayerView3D as h}from"./LayerView3D.js";import{TiledLayerView3D as d}from"./TiledLayerView3D.js";import c from"../../layers/LayerView.js";import m from"../../layers/RefreshableLayerView.js";let p=class extends(m(d(h(c)))){constructor(){super(...arguments),this.type="wmts-3d"}get hasMixedImageFormats(){return!0}_getCompatibleTileInfoMatrixSet(e,s=!1){const o=n(this.layer);if(r(o)){if(t.isCollection(o)){const t=o.find((t=>{const o=e(t);return r(o)&&(s?i.getLogger(this.declaredClass).error("The selected tile matrix set is not compatible with the view",o):this.addResolvingPromise(Promise.reject(o))),null==o}));return t}const a=e(o);return r(a)&&(s?i.getLogger(this.declaredClass).error("The selected tile matrix set is not compatible with the view",a):this.addResolvingPromise(Promise.reject(a))),o}return null}initialize(){this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoSupportError(e.tileInfo,e.fullExtent)));const e=o((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this._getCompatibleTileInfoMatrixSet((e=>this._getTileInfoError(e.tileInfo,e.fullExtent)));s(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 r(e)&&!this._getTileInfoError(e.tileInfo,e.fullExtent)}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);r(t)&&null!==t.id&&e.tileMatrixSetId!==t.id&&(this.layer.activeLayer.tileMatrixSetId=t.id),this.notifyChange("suspended"),this.canResume()&&this.refresh()}))}_getTileInfoError(e,t){return this._getTileInfoSupportError(e,t)||this._getTileInfoCompatibilityError(e,this.view.basemapTerrain.tilingScheme)}};e([a({readOnly:!0})],p.prototype,"hasMixedImageFormats",null),e([a()],p.prototype,"layer",void 0),e([a()],p.prototype,"suspended",void 0),p=e([l("esri.views.3d.layers.WMTSLayerView3d")],p);const f=p;export{f as default};