/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as t}from"tslib";import{toAdaptiveLengthUnitForArea as e,toAdaptiveAreaUnit as i}from"../../../core/quantity.js";import{property as r,subclass as a}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as s}from"../../../support/getDefaultUnitForView.js";import o from"./AnalysisView2D.js";import{AreaMeasurementAreaVisualization as n}from"./AreaMeasurement/AreaMeasurementAreaVisualization.js";import{AreaMeasurementController as l}from"./AreaMeasurement/AreaMeasurementController.js";import{AreaMeasurementManipulatorVisualization as p}from"./AreaMeasurement/AreaMeasurementManipulatorVisualization.js";import{AreaMeasurementSketchVisualization as u}from"./AreaMeasurement/AreaMeasurementSketchVisualization.js";import{AreaMeasurementTool as m}from"./AreaMeasurement/AreaMeasurementTool.js";import h from"../../interactive/snapping/SnappingOptions.js";let c=class extends o{constructor(t){super(t),this.analysis=null,this.snappingOptions=new h,this.type="area-measurement-view-2d"}initialize(){const{view:t}=this;this._areaVisualization=new n({view:t,measurementViewData:this}),this._controller=new l({view:t,measurementViewData:this}),this._manipulatorVisualization=new p({view:t,measurementViewData:this}),this._sketchVisualization=new u({view:t,measurementViewData:this}),this._tool=new m({view:t,measurementViewData:this})}destroy(){this._areaVisualization?.destroy(),this._controller?.destroy(),this._manipulatorVisualization?.destroy(),this._sketchVisualization?.destroy(),this._tool?.destroy()}get manipulatorGraphic(){return this._manipulatorVisualization?.graphic}get manipulatorGraphicsLayer(){return this._manipulatorVisualization?.graphicsLayer}get sketchGraphicsLayer(){return this._sketchVisualization?.graphicsLayer}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get result(){const t=this._controller?.result;if(!t)return t;const{unit:r}=this,{area:a,display:s,mode:o,perimeter:n}=t;return{area:a?i(a,r):null,display:s,mode:o,perimeter:n?e(n,r):null}}get unit(){return this.analysis.unit??s(this.view)}get updating(){return(this._areaVisualization?.updating??!0)||(this._controller?.updating??!0)||(this._sketchVisualization?.updating??!0)||(this._tool?.updating??!0)}get visible(){return super.visible}set visible(t){super.visible=t}async place(t){return this._tool.place(t)}};t([r()],c.prototype,"_areaVisualization",void 0),t([r()],c.prototype,"_controller",void 0),t([r()],c.prototype,"_manipulatorVisualization",void 0),t([r()],c.prototype,"_sketchVisualization",void 0),t([r()],c.prototype,"_tool",void 0),t([r({constructOnly:!0})],c.prototype,"analysis",void 0),t([r()],c.prototype,"manipulatorGraphic",null),t([r()],c.prototype,"manipulatorGraphicsLayer",null),t([r()],c.prototype,"sketchGraphicsLayer",null),t([r({readOnly:!0})],c.prototype,"result",null),t([r({type:h,nonNullable:!0})],c.prototype,"snappingOptions",void 0),t([r({readOnly:!0})],c.prototype,"type",void 0),t([r({readOnly:!0})],c.prototype,"unit",null),t([r({readOnly:!0})],c.prototype,"updating",null),c=t([a("esri.views.2d.analysis.AreaMeasurementAnalysisView2D")],c);const y=c;export{y as default};
