@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.16 kB
JavaScript
/*
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 t from"../../core/Evented.js";import o from"../../core/Logger.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/SpatialReference.js";import{toExtent as s}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{updateGeometryElevation as l}from"../../layers/support/ElevationSampler.js";import{elevationNoDataValue as p}from"../3d/terrain/TerrainConst.js";let m=class extends t.EventedAccessor{constructor(e){super(e),this.demResolution={min:-1,max:-1},this.noDataValue=p}initialize(){this.view.basemapTerrain.on("elevation-change",(()=>this.emit("changed",{})))}get extent(){const e=this.view.basemapTerrain;if(null==e?.extent||null==e.spatialReference)return null;const t=s(e.extent,e.spatialReference);return t.zmin=e.visibleElevationBounds.min,t.zmax=e.visibleElevationBounds.max,t}get spatialReference(){return this.view.basemapTerrain?.spatialReference??i.WGS84}elevationAt(e,t){if(null==this.extent||!a(this.extent,e,t)){const r=null!=this.extent?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return o.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler extent (${r})`),this.noDataValue}return this.view.elevationProvider?.getElevation(e,t,0,this.spatialReference,"ground")??this.noDataValue}queryElevation(e){return l(e.clone(),this)}};e([r({readOnly:!0})],m.prototype,"demResolution",void 0),e([r({readOnly:!0})],m.prototype,"extent",null),e([r({readOnly:!0})],m.prototype,"noDataValue",void 0),e([r()],m.prototype,"spatialReference",null),e([r({constructOnly:!0})],m.prototype,"view",void 0),m=e([n("esri.views.support.GroundViewElevationSampler")],m);const u=m;export{u as default};