/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import"../../../core/has.js";import{abortMaybe as t,destroyMaybe as i}from"../../../core/maybe.js";import{toAdaptiveLengthUnitForArea as s,toAdaptiveAreaUnit as a}from"../../../core/quantity.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as n}from"../../../support/getDefaultUnitForView.js";import l from"./AnalysisView3D.js";import{AreaMeasurementController as p}from"./AreaMeasurement/support/AreaMeasurementController.js";import{AreaMeasurement3DPathHelper as u}from"./AreaMeasurement/support/AreaMeasurementPathHelper.js";import{AreaMeasurementVisualization as m}from"./AreaMeasurement/support/AreaMeasurementVisualization.js";import y from"../interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js";import{connectAnalysisViewToTool as h,removeAnalysisViewTool as d,startPlaceOperation as v}from"../../analysis/analysisViewUtils.js";let c=class extends l{constructor(e){super(e),this.type="area-measurement-view-3d",this.analysis=null,this.measurementData=null,this.lastDraggedVertex=null,this.stagedPoint=null,this.mode=0,this.tool=null,this.userOperation=null}initialize(){const{analysis:e,view:t}=this;this.path=new u({view:t,areaMeasurement:e}),this._analysisVisualization=new m({view:t,analysis:e,analysisViewData:this}),this._analysisController=new p({view:t,analysis:e,analysisViewData:this}),this.addHandles(h(this,y))}destroy(){d(this),this.userOperation=t(this.userOperation),this._analysisController=i(this._analysisController),this._analysisVisualization=i(this._analysisVisualization),this.path.destroy()}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return!!this._analysisVisualization?.loadingMessages||!!this._analysisController?.updating}get result(){const e=this.measurementData?.measurements;if(!e)return null;const{unit:t}=this,{mode:i}=e,r="geodesic"===i,o=r?e.geodesicArea:e.area,n=r?e.geodesicPerimeter:e.perimeter;return{mode:i,area:o?a(o,t):null,perimeter:n?s(n,t):null}}get viewData(){return this._analysisVisualization.viewData}get areaLabel(){return this._analysisVisualization.areaLabel}get perimeterLabel(){return this._analysisVisualization.perimeterLabel}get validMeasurement(){return this.path.isValidPolygon}get unit(){return this.analysis.unit??n(this.view)}get testData(){}place(e){return v(this,{placementOptions:e})}};e([r()],c.prototype,"_analysisVisualization",void 0),e([r()],c.prototype,"_analysisController",void 0),e([r({readOnly:!0})],c.prototype,"type",void 0),e([r({constructOnly:!0,nonNullable:!0})],c.prototype,"analysis",void 0),e([r()],c.prototype,"updating",null),e([r()],c.prototype,"result",null),e([r()],c.prototype,"measurementData",void 0),e([r()],c.prototype,"viewData",null),e([r()],c.prototype,"areaLabel",null),e([r()],c.prototype,"perimeterLabel",null),e([r()],c.prototype,"validMeasurement",null),e([r()],c.prototype,"path",void 0),e([r()],c.prototype,"lastDraggedVertex",void 0),e([r()],c.prototype,"stagedPoint",void 0),e([r()],c.prototype,"mode",void 0),e([r()],c.prototype,"unit",null),e([r()],c.prototype,"tool",void 0),e([r()],c.prototype,"userOperation",void 0),c=e([o("esri.views.3d.analysis.AreaMeasurementAnalysisView3D")],c);const g=c;export{g as default};
