UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.12 kB
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import r from"../../core/Logger.js";import{isNone as o,unwrapOr as s,isSome as i}from"../../core/maybe.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/SpatialReference.js";import{toExtent as l}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as m}from"../../geometry/support/contains.js";import{updateGeometryElevation as c}from"../../layers/support/ElevationSampler.js";import{ELEVATION_NODATA_VALUE as u}from"../3d/terrain/TerrainConst.js";let d=class extends t.EventedAccessor{constructor(e){super(e),this.demResolution={min:-1,max:-1},this.noDataValue=u}initialize(){this.view.basemapTerrain.on("elevation-change",(()=>this.emit("changed",{})))}get extent(){const e=this.view.basemapTerrain;if(null==e||o(e.extent)||o(e.spatialReference))return null;const t=l(e.extent,e.spatialReference);return t.zmin=e.visibleElevationBounds.min,t.zmax=e.visibleElevationBounds.max,t}get spatialReference(){return s(this.view.basemapTerrain?.spatialReference,p.WGS84)}elevationAt(e,t){if(o(this.extent)||!m(this.extent,e,t)){const o=i(this.extent)?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return r.getLogger(this.declaredClass).warn("#elevationAt()",`Point used to sample elevation (${e}, ${t}) is outside of the sampler extent (${o})`),this.noDataValue}return s(this.view.elevationProvider?.getElevation(e,t,0,this.spatialReference,"ground"),this.noDataValue)}queryElevation(e){return c(e.clone(),this)}};e([n({readOnly:!0})],d.prototype,"demResolution",void 0),e([n({readOnly:!0})],d.prototype,"extent",null),e([n({readOnly:!0})],d.prototype,"noDataValue",void 0),e([n()],d.prototype,"spatialReference",null),e([n({constructOnly:!0})],d.prototype,"view",void 0),d=e([a("esri.views.support.GroundViewElevationSampler")],d);const v=d;export{v as default};