UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 3.56 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 t}from"../../chunks/tslib.es6.js";import e from"../../Color.js";import o from"../../core/Evented.js";import{handlesGroup as i}from"../../core/handleUtils.js";import{memoize as r}from"../../core/memoize.js";import{watch as s,syncAndInitial as l,sync as n}from"../../core/reactiveUtils.js";import{generateUUID as p}from"../../core/uuid.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../geometry/Point.js";import{getConfig as m}from"./support/constants.js";import{binaryFindClosest as c}from"./support/profileUtils.js";import{convertSamples as d,convertStatistics as v}from"./support/unitUtils.js";let f=class extends o.EventedAccessor{constructor(t){super(t),this.type=null,this.id=p(),this.title=null,this.color=new e("#000000"),this.visible=!0,this._getSamplesMemoized=r(((t,e)=>d(t,e))),this._getStatisticsMemoized=r(((t,e)=>v(t,e))),this.viewVisualizationEnabled=!0,this.result=null,this.effectiveUnits=null,this.numSamplesForPreview=30,this.numSamplesPerChunk=200,this.chartFillEnabled=!0,this.chartStrokeWidth=1.5,this.chartStrokeOffsetY=0,this._viewModel=null}get progress(){return null!=this.result&&this.visible?this.result.progress:0}get samples(){return this._getSamplesMemoized(this.result,this.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.result,this.effectiveUnits)}get hoveredPoint(){const t=this._viewModel?.hoveredChartPosition;return null!=t?this._getPoint(t):null}get available(){return!0}get hasZ(){const t=this.result;return null!=t&&t.hasZ}get minDemResolution(){return m().defaultDemResolution}queryElevation(){throw new Error("not implemented")}attach(t){return this._viewModel=t,i([s((()=>t.effectiveUnits),(t=>{this.effectiveUnits=t}),l),s((()=>[t.input]),(()=>this._onChange()),n)])}toggleVisibility(t){this.visible=void 0===t?!this.visible:t}_onChange(){this.emit("change")}_getPoint(t){const{samples:e,result:o}=this;if(null==e||null==o)return null;const i=e.length;if(0===i)return null;const r=e[i-1].distance,s=c(e,t*r,(t=>t.distance));if(null==s)return null;const{x:l,y:n,z:p}=s;return null==p?null:new h({x:l,y:n,z:p,spatialReference:o.spatialReference})}};t([a({nonNullable:!0})],f.prototype,"id",void 0),t([a({nonNullable:!0})],f.prototype,"title",void 0),t([a({type:e,nonNullable:!0})],f.prototype,"color",void 0),t([a({nonNullable:!0})],f.prototype,"visible",void 0),t([a({readOnly:!0})],f.prototype,"progress",null),t([a({readOnly:!0})],f.prototype,"samples",null),t([a({readOnly:!0})],f.prototype,"statistics",null),t([a()],f.prototype,"hoveredPoint",null),t([a()],f.prototype,"viewVisualizationEnabled",void 0),t([a()],f.prototype,"available",null),t([a()],f.prototype,"result",void 0),t([a()],f.prototype,"effectiveUnits",void 0),t([a()],f.prototype,"numSamplesForPreview",void 0),t([a()],f.prototype,"numSamplesPerChunk",void 0),t([a()],f.prototype,"chartFillEnabled",void 0),t([a()],f.prototype,"chartStrokeWidth",void 0),t([a()],f.prototype,"chartStrokeOffsetY",void 0),t([a({readOnly:!0})],f.prototype,"hasZ",null),t([a({readOnly:!0})],f.prototype,"minDemResolution",null),t([a()],f.prototype,"_viewModel",void 0),f=t([u("esri.widgets.ElevationProfile.ElevationProfileLine")],f);const y=f;export{y as default};