UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 2.48 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../Color.js";import{handlesGroup as o}from"../../core/handleUtils.js";import{memoize as i}from"../../core/memoize.js";import{watch as r,on as n}from"../../core/reactiveUtils.js";import{property as l,subclass as a}from"../../core/accessorSupport/decorators.js";import{GeometryDescriptor as s}from"../../layers/support/GeometryDescriptor.js";import{getGraphicEffectiveElevationInfo as p}from"../../support/elevationInfoUtils.js";import u from"./ElevationProfileLine.js";let v=class extends u{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=i((e,t,o,i,r)=>e?{elevationInfo:e,visibleLayers:t,view:o,stationary:i,spatialReference:r}: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 i=this.queryElevationDependencies;if(null==i)throw new Error("ElevationProfileLineInput: no dependencies");const{view:r,elevationInfo:n,spatialReference:l}=i;if("on-the-ground"===n.mode&&"3d"===r.type&&l){const i=await s.fromGeometry(e).project(l,o);if(!i)return{geometry:e,noDataValue:t};const n=r.elevationProvider;return i.coordinates.forEach(e=>{e.z=n.getElevation(e.x,e.y,0,l,"ground")??0}),{geometry:i.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}attach(e){const t=()=>this._onChange();return o([super.attach(e),r(()=>this.queryElevationDependencies,t),n(()=>e.elevationProvider,"elevation-change",t,{onListenerAdd:t,onListenerRemove:t})])}};e([l({type:t,nonNullable:!0})],v.prototype,"color",void 0),e([l()],v.prototype,"viewVisualizationEnabled",void 0),e([l()],v.prototype,"queryElevationDependencies",null),e([l()],v.prototype,"available",null),e([l()],v.prototype,"_elevationInfo",null),e([l()],v.prototype,"_visibleLayers",null),v=e([a("esri.widgets.ElevationProfile.ElevationProfileLineInput")],v);const c=v;export{c as default};