/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{toAdaptiveLengthUnit as i}from"../../../core/quantity.js";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import r from"./AnalysisView2D.js";import{DistanceMeasurementController as n}from"./DistanceMeasurement/DistanceMeasurementController.js";import{DistanceMeasurementLineVisualization as o}from"./DistanceMeasurement/DistanceMeasurementLineVisualization.js";import{DistanceMeasurementManipulatorVisualization as l}from"./DistanceMeasurement/DistanceMeasurementManipulatorVisualization.js";import{DistanceMeasurementSketchVisualization as p}from"./DistanceMeasurement/DistanceMeasurementSketchVisualization.js";import{DistanceMeasurementTool as u}from"./DistanceMeasurement/DistanceMeasurementTool.js";import c from"../../interactive/snapping/SnappingOptions.js";let m=class extends r{constructor(t){super(t),this.analysis=null,this.snappingOptions=new c,this.type="distance-measurement-view-2d"}initialize(){const{view:t}=this;this._lineVisualization=new o({view:t,measurementViewData:this}),this._controller=new n({view:t,measurementViewData:this}),this._manipulatorVisualization=new l({view:t,measurementViewData:this}),this._sketchVisualization=new p({view:t,measurementViewData:this}),this._tool=new u({view:t,measurementViewData:this})}destroy(){this._lineVisualization?.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;return t?{...t,length:i(t.length,this.unit)}:t}get unit(){return this.analysis.unit??a(this.view)}get updating(){return(this._controller?.updating??!0)||(this._lineVisualization?.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([e()],m.prototype,"_lineVisualization",void 0),t([e()],m.prototype,"_controller",void 0),t([e()],m.prototype,"_manipulatorVisualization",void 0),t([e()],m.prototype,"_sketchVisualization",void 0),t([e()],m.prototype,"_tool",void 0),t([e({constructOnly:!0})],m.prototype,"analysis",void 0),t([e()],m.prototype,"manipulatorGraphic",null),t([e()],m.prototype,"manipulatorGraphicsLayer",null),t([e()],m.prototype,"sketchGraphicsLayer",null),t([e({readOnly:!0})],m.prototype,"result",null),t([e({type:c,nonNullable:!0})],m.prototype,"snappingOptions",void 0),t([e({readOnly:!0})],m.prototype,"type",void 0),t([e({readOnly:!0})],m.prototype,"unit",null),t([e({readOnly:!0})],m.prototype,"updating",null),m=t([s("esri.views.2d.analysis.DistanceMeasurementAnalysisView2D")],m);const h=m;export{h as default};
