@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.74 kB
JavaScript
/*
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 t from"../../Color.js";import{handlesGroup as o}from"../../core/handleUtils.js";import{memoize as r}from"../../core/memoize.js";import{watch as i,on as n}from"../../core/reactiveUtils.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 a}from"../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as l}from"../../layers/support/ElevationQuery.js";import{getGraphicEffectiveElevationInfo as p}from"../../support/elevationInfoUtils.js";import c from"./ElevationProfileLine.js";let u=class extends c{constructor(e){super(e),this.type="input",this.color=new t("#00c8c8"),this.viewVisualizationEnabled=!1,this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this.chartFillEnabled=!1,this.chartStrokeOffsetY=-1,this._getQueryElevationDependencies=r(((e,t,o,r,i)=>e?{elevationInfo:e,visibleLayers:t,view:o,stationary:r,spatialReference:i}:null))}get queryElevationDependencies(){const e=this._viewModel?.view;return null==e?null:this._getQueryElevationDependencies(this._elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get available(){return!this._viewModel?.inputIsSketched}get _elevationInfo(){const e=this._viewModel?.input;return e?p(e):null}get _visibleLayers(){return this._viewModel?.view?.map?.allLayers?.filter((e=>e.visible)).toArray()??[]}async queryElevation(e,{noDataValue:t,signal:o}){const r=this.queryElevationDependencies;if(null==r)throw new Error("ElevationProfileLineInput: no dependencies");const{view:i,elevationInfo:n,spatialReference:s}=r;if("on-the-ground"===n.mode&&"3d"===i.type&&s){const r=await l.fromGeometry(e).project(s,o);if(!r)return{geometry:e,noDataValue:t};const n=i.elevationProvider;return r.coordinates.forEach((e=>{e.z=n.getElevation(e.x,e.y,0,s,"ground")??0})),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}attach(e){const t=()=>this._onChange();return o([super.attach(e),i((()=>this.queryElevationDependencies),t),n((()=>e.elevationProvider),"elevation-change",t,{onListenerAdd:t,onListenerRemove:t})])}};e([s({type:t,nonNullable:!0})],u.prototype,"color",void 0),e([s()],u.prototype,"viewVisualizationEnabled",void 0),e([s()],u.prototype,"queryElevationDependencies",null),e([s()],u.prototype,"available",null),e([s()],u.prototype,"_elevationInfo",null),e([s()],u.prototype,"_visibleLayers",null),u=e([a("esri.widgets.ElevationProfile.ElevationProfileLineInput")],u);const v=u;export{v as default};