/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{watch as t,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{throttle as o}from"../../../../core/throttle.js";import{property as r,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{fromValues as a,fromArray as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{absoluteHeightElevationInfo as p}from"../../../../support/elevationInfoUtils.js";import{OutlineVisualElement as c}from"../../interactive/visualElements/OutlineVisualElement.js";import{getConfig as m}from"../../../analysis/ElevationProfile/constants.js";import{ElevationProfileIndicatorPointVisualization as f}from"../../../analysis/ElevationProfile/ElevationProfileIndicatorPointVisualization.js";import{createLineGeometry as u}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let h=class extends i{constructor(e){super(e),this._hasGeometry=!1,this._updateGeometryThrottled=o(e=>{e&&this._setGeometry(u(e.samples,e.spatialReference))},m().profileLinesUpdateThrottleMillis)}initialize(){this._indicatorVisualization=new f({analysisViewData:this.analysisViewData,line:this.line,view:this.view}),this._visualElement=new c({view:this.view,elevationInfo:p,innerWidth:0,innerColor:a(0,0,0,0),width:3,falloff:0,renderOccluded:16,isDecoration:!0}),this.addHandles([t(()=>this._effectiveLineVisible,e=>{this._visualElement.visible=e},s),t(()=>this._effectiveIndicatorVisible,e=>{this._indicatorVisualization.visible=e},s),t(()=>this._result?.computation.profile.color,e=>{e&&(this._visualElement.color=n(e.toUnitRGBA()))},s),t(()=>this.analysisViewData.analysis.geometry,()=>this._setGeometry(null),s),t(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),s),this._updateGeometryThrottled])}destroy(){this._visualElement.destroy(),this._indicatorVisualization.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){return this.analysisViewData.results.find(e=>e.computation.profile===this.line)}get _effectiveLineVisible(){return this.getEffectiveVisible("lineVisible")}get _effectiveIndicatorVisible(){const e=this.getEffectiveVisible("indicatorPointVisible");return this._effectiveLineVisible?e&&this._hasGeometry:e}getEffectiveVisible(e){const{analysisViewData:i,_result:t}=this;return i.visible&&!!t?.available&&t.computation.profile.viewOptions[e]}get _geometryUpdateParameters(){const e={samples:this._result?.samples,spatialReference:this.view.spatialReference};return e.samples&&this._effectiveLineVisible&&1!==this.analysisViewData.progress?null:e}_setGeometry(e){this._hasGeometry=null!=e,this._visualElement.geometry=e}};e([r({constructOnly:!0})],h.prototype,"view",void 0),e([r({constructOnly:!0})],h.prototype,"analysisViewData",void 0),e([r({constructOnly:!0})],h.prototype,"line",void 0),e([r()],h.prototype,"_hasGeometry",void 0),e([r()],h.prototype,"updating",null),e([r()],h.prototype,"_result",null),e([r()],h.prototype,"_effectiveLineVisible",null),e([r()],h.prototype,"_effectiveIndicatorVisible",null),e([r()],h.prototype,"_geometryUpdateParameters",null),h=e([l("esri.views.3d.analysis.ElevationProfile.ElevationProfileLineVisualization3D")],h);export{h as ElevationProfileLineVisualization3D};
