UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 1.66 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../core/Logger.js";import{property as n,subclass as i}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/SpatialReference.js";import{toExtent as r}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{GroundViewElevationSampler as s}from"./GroundViewElevationSampler.js";let l=class extends s{initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get demResolution(){return this.view.basemapTerrain.demResolution}get extent(){const{groundView:e}=this.view;if(null==e?.groundExtent||null==e.spatialReference)return null;const t=r(e.groundExtent,e.spatialReference);return t.zmin=e.visibleElevationRange.minElevation,t.zmax=e.visibleElevationRange.maxElevation,t}get spatialReference(){return this.view.basemapTerrain?.spatialReference??o.WGS84}elevationAt(e,n){if(null==this.extent||!a(this.extent,e,n)){const i=null!=this.extent?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return t.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${n}) is outside of the sampler extent (${i})`),this.noDataValue}return this.view.elevationProvider?.getElevation(e,n,0,this.spatialReference,"ground")??this.noDataValue}};e([n({readOnly:!0})],l.prototype,"demResolution",null),e([n({readOnly:!0})],l.prototype,"extent",null),e([n()],l.prototype,"spatialReference",null),l=e([i("esri.views.support.GroundElevationSampler")],l);export{l as GroundElevationSampler};