/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t}from"tslib";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{abortMaybe as e,destroyMaybe as o}from"../../../core/maybe.js";import{property as r,subclass as n}from"../../../core/accessorSupport/decorators.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"./AnalysisView3D.js";import{LineOfSightController as p}from"./LineOfSight/LineOfSightController.js";import{LineOfSightTool as u}from"./LineOfSight/LineOfSightTool.js";import{LineOfSightTool2 as h}from"./LineOfSight/LineOfSightTool2.js";import{LineOfSightVisualization as y}from"./LineOfSight/LineOfSightVisualization.js";import{connectAnalysisViewToTool as c,removeAnalysisViewTool as g,startPlaceOperation as f}from"../../analysis/analysisViewUtils.js";function m(){return has("enable-feature:analysis-drawtool-line-of-sight")??!1}function d(){return m()?h:u}let v=class extends l{constructor(t){super(t),this.type="line-of-sight-view-3d",this.analysis=null,this.tool=null,this.computations=new i,this.cursorTarget=null,this.editable=!0,this.elevationAlignedObserver=null,this.observerEngineLocation=a(),this.userOperation=null}initialize(){const t=this.view,i=this.analysis;this._analysisController=new p({analysis:i,analysisViewData:this,view:t}),this._analysisVisualization=new y({analysis:i,analysisViewData:this,view:t,isDecoration:!this.parent}),this.addHandles([this._analysisController.on("result-changed",t=>{t.target!==this.cursorTarget&&this.emit("result-changed",t)}),c(this,d())])}destroy(){g(this),this.userOperation=e(this.userOperation),this._analysisController=o(this._analysisController),this._analysisVisualization=o(this._analysisVisualization)}get visible(){return super.visible}set visible(t){super.visible=t}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get results(){return this.computations.map(t=>t.result)}get priority(){return this._analysisController.priority}set priority(t){this._analysisController.priority=t}get updating(){return null!=this._analysisController&&this._analysisController.updating||null!=this._analysisVisualization&&this._analysisVisualization.updating}place(t){if(m()){if(this.interactive=!0,null==this.tool||null==this.tool.place)throw new s("LineOfSightAnalysisView3D:place","LineOfSightTool with placement support is not available");return this.tool.place(t)}return f(this,{placementOptions:t})}getResultForTarget(t){return this.computations.find(i=>i.target===t)?.result}get testInfo(){}};t([r({readOnly:!0})],v.prototype,"type",void 0),t([r({constructOnly:!0,nonNullable:!0})],v.prototype,"analysis",void 0),t([r()],v.prototype,"tool",void 0),t([r({readOnly:!0})],v.prototype,"results",null),t([r()],v.prototype,"priority",null),t([r()],v.prototype,"computations",void 0),t([r()],v.prototype,"cursorTarget",void 0),t([r()],v.prototype,"editable",void 0),t([r()],v.prototype,"elevationAlignedObserver",void 0),t([r()],v.prototype,"observerEngineLocation",void 0),t([r()],v.prototype,"updating",null),t([r()],v.prototype,"userOperation",void 0),t([r()],v.prototype,"_analysisController",void 0),t([r()],v.prototype,"_analysisVisualization",void 0),v=t([n("esri.views.3d.analysis.LineOfSightAnalysisView3D")],v);const O=v;export{O as default};
