UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.41 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{memoize as t}from"../../core/memoize.js";import{watch as n}from"../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as i}from"../../core/unitUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import a from"./ElevationProfileLine.js";import{getGroundMinDemResolution as u}from"./support/elevationQuerySourceUtils.js";let p=class extends a{constructor(e){super(e),this.type="ground",this.color=new o("#ff7f00"),this.viewVisualizationEnabled=!0,this.numSamplesForPreview=50,this.numSamplesPerChunk=1e3,this._getQueryElevationDependencies=t(((e,o)=>({ground:e,groundLayers:o})))}get available(){const e=this._ground;return null!=e&&e.layers.some((e=>e.visible))}get minDemResolution(){return u(this._ground)}get _queryElevationDependencies(){return this._getQueryElevationDependencies(this._ground,this._groundLayers)}get _ground(){return this._viewModel?.view?.map?.ground}get _groundLayers(){return this._ground?.layers?.toArray()??[]}async queryElevation(e,o){const r=this._queryElevationDependencies;if(null==r)throw new Error("ElevationProfileLineGround: no dependencies");const{ground:t}=r;if(null==t)throw new Error("No ground configured in the view");const n=await t.queryElevation(e,o),s=i(e.spatialReference),l=i(t.layers.at(0).spatialReference);if(s!==l){const e=n.geometry;e.points=e.points.map((([e,r,t])=>[e,r,t===o.noDataValue?t:t*l/s]))}return n}attach(e){return r([super.attach(e),n((()=>this._queryElevationDependencies),(()=>this._onChange()))])}};e([s({type:o,nonNullable:!0})],p.prototype,"color",void 0),e([s()],p.prototype,"viewVisualizationEnabled",void 0),e([s()],p.prototype,"available",null),e([s({readOnly:!0})],p.prototype,"minDemResolution",null),e([s()],p.prototype,"_queryElevationDependencies",null),e([s()],p.prototype,"_ground",null),e([s()],p.prototype,"_groundLayers",null),p=e([l("esri.widgets.ElevationProfile.ElevationProfileLineGround")],p);const c=p;export{c as default};