UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 4.13 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{abortMaybe as s,destroyMaybe as r}from"../../../core/maybe.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{getDefaultUnitForView as o}from"../../../support/getDefaultUnitForView.js";import{AnalysisView3D as n}from"./AnalysisView3D.js";import{MeasurementMode as l}from"./interfaces.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{toPreferredLengthUnit as y,toPreferredAreaUnit as d}from"./AreaMeasurement/support/utils.js";import h from"../interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js";import{connectAnalysisViewToTool as c,removeAnalysisViewTool as g,startPlaceOperation as v}from"../../analysis/analysisViewUtils.js";import{loadGeodesicAreaMeasurementUtils as f}from"../../support/geodesicAreaMeasurementUtils.js";import{loadGeodesicLengthMeasurementUtils as M}from"../../support/geodesicLengthMeasurementUtils.js";let j=class extends(n(t)){constructor(e){super(e),this.type="area-measurement-view-3d",this.analysis=null,this.measurementData=null,this.lastDraggedVertex=null,this.stagedPoint=null,this.mode=l.Auto,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.addResolvingPromise(Promise.all([f(),M()]).then((([s,r])=>{this.destroyed||(this._analysisController=new p({view:t,analysis:e,analysisViewData:this,geodesicAreaMeasurementUtils:s,geodesicLengthMeasurementUtils:r}))}))),this.addHandles(c(this,h))}destroy(){g(this),this.userOperation=s(this.userOperation),this._analysisController=r(this._analysisController),this._analysisVisualization=r(this._analysisVisualization),this.path.destroy()}get updating(){return!!this._analysisVisualization?.loadingMessages}get result(){const{measurementData:e}=this;if(null==e)return{area:null,mode:null,perimeter:null};const{unit:t}=this;if("euclidean"===e.actualMeasurementMode){const{area:s,perimeterLength:r}=e;return{area:null!=s?d(s,t):null,perimeter:null!=r?y(r,t):null,mode:"euclidean"}}const{geodesicArea:s,pathLength:r}=e;return{area:null!=s?d(s,t):null,perimeter:null!=r?y(r,t):null,mode:"geodesic"}}get viewData(){return this._analysisVisualization.viewData}get areaLabel(){return this._analysisVisualization.areaLabel}get perimeterLengthLabel(){return this._analysisVisualization.perimeterLengthLabel}get validMeasurement(){return this.path.isValidPolygon}get unit(){return this.analysis.unit??o(this.view)}get testData(){}place(e){return v(this,{placementOptions:e})}};e([a()],j.prototype,"_analysisVisualization",void 0),e([a()],j.prototype,"_analysisController",void 0),e([a({readOnly:!0})],j.prototype,"type",void 0),e([a({constructOnly:!0,nonNullable:!0})],j.prototype,"analysis",void 0),e([a()],j.prototype,"updating",null),e([a()],j.prototype,"result",null),e([a()],j.prototype,"measurementData",void 0),e([a()],j.prototype,"viewData",null),e([a()],j.prototype,"areaLabel",null),e([a()],j.prototype,"perimeterLengthLabel",null),e([a()],j.prototype,"validMeasurement",null),e([a()],j.prototype,"path",void 0),e([a()],j.prototype,"lastDraggedVertex",void 0),e([a()],j.prototype,"stagedPoint",void 0),e([a()],j.prototype,"mode",void 0),e([a()],j.prototype,"unit",null),e([a()],j.prototype,"tool",void 0),e([a()],j.prototype,"userOperation",void 0),j=e([i("esri.views.3d.analysis.AreaMeasurementAnalysisView3D")],j);const w=j;export{w as default};