@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.27 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 t}from"../../../chunks/tslib.es6.js";import e from"../../../Color.js";import o from"../../../core/Accessor.js";import{watch as s,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{throttle as i}from"../../../core/throttle.js";import{property as l}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{fromArray as n}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{OutlineVisualElement as c}from"../../../views/3d/interactive/visualElements/OutlineVisualElement.js";import{getConfig as p}from"./constants.js";import{createLineGeometry as m}from"./visualizationUtils.js";let h=class extends o{constructor(t){super(t),this._chartData=null,this._visualElements=[],this._update=t=>{const{chartData:o}=t;if(null==o)return this.remove();if(!o.refined)return;const s=this._visualElements,r=o.lines.filter((t=>t.viewVisualizationEnabled)),i=r.length;for(;s.length>i;)s.pop().destroy();const l=p().profileLinesStyle3D;for(;s.length<i;){const t=new c({view:this.view,elevationInfo:{mode:"absolute-height",offset:0},innerWidth:l.innerWidth,innerColor:l.innerColor,width:l.width,falloff:l.falloff,renderOccluded:l.renderOccluded,isDecoration:!0});s.push(t)}const a=t.spatialReference;for(let c=0;c<i;++c){const t=s[c],o=r[i-1-c];t.geometry=m(o,a),t.color=n(e.toUnitRGBA(o.color))}}}initialize(){const t=p().profileLinesUpdateThrottleMillis;let e=this._update;if(t>0){const o=i(this._update,t);this.addHandles(o),e=o}this.addHandles([s((()=>({spatialReference:this.view.spatialReference,chartData:this._chartData})),e,r)])}destroy(){this._destroyVisualElements()}remove(){this._destroyVisualElements()}update(t){this._chartData=t}_destroyVisualElements(){this._visualElements.forEach((t=>t.destroy())),this._visualElements.length=0}};t([l()],h.prototype,"view",void 0),t([l()],h.prototype,"_chartData",void 0),h=t([a("esri.widgets.ElevationProfile.support.ProfileLines3D")],h);export{h as ProfileLines3D};