UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.27 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import o from"../../../core/Logger.js";import{releaseMaybe as t}from"../../../core/maybe.js";import{isAborted as i}from"../../../core/promiseUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationTileData as l}from"../../../layers/support/ElevationTileData.js";import{acquireDecoder as n}from"../../../layers/support/LercDecoder.js";import{LayerView3D as c}from"./LayerView3D.js";import{TiledLayerView3D as m}from"./TiledLayerView3D.js";import{elevationNoDataValue as p}from"../terrain/TerrainConst.js";import{useFetchTileForLayer as d}from"../terrain/terrainUtils.js";import y from"../../layers/LayerView.js";let h=class extends(m(c(y))){constructor(){super(...arguments),this.type="elevation-3d"}get tileInfo(){return this.layer.tileInfo}initialize(){const e=this.view,o=e.map?.allLayers,t=o&&o.includes(this.layer),i=e.map?.ground?.layers,s=i&&i.includes(this.layer);if(t&&!s){const e=new r("layerview:elevation-layer-only",`3D elevation layer '${this.layer.id}' can only be added to layers in map.ground`);this.addResolvingPromise(Promise.reject(e))}this._lercDecoder=n(e.resourceController),this._addTilingSchemeMatchPromise()}destroy(){this._lercDecoder=t(this._lercDecoder)}async fetchTile(e,r){const t=this.layer;if(d(t)){const s=await t.fetchTile(e[0],e[1],e[2],{noDataValue:p,signal:r.signal});return i(r)?void o.getLogger(this).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."):s}const s=this.getTileUrl(e),a=await r.requester.request(s,"binary",r),n=await this._lercDecoder.decode(a,{noDataValue:p},r.signal);if(n)return new l(n);throw new Error("LERC decoding failed")}};e([s()],h.prototype,"layer",void 0),e([s()],h.prototype,"tileInfo",null),h=e([a("esri.views.3d.layers.ElevationLayerView3D")],h);const f=h;export{f as default};