UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.43 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 t}from"../../../../chunks/tslib.es6.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import o from"../../../../core/Accessor.js";import{destroyHandle as s}from"../../../../core/handleUtils.js";import i from"../../../../core/Logger.js";import{mapCollection as r}from"../../../../core/mapCollectionUtils.js";import{watch as n,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{convertUnit as m}from"../../../../core/unitUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{getDefaultUnitForView as p}from"../../../../support/getDefaultUnitForView.js";import{isGeodesicDimension as u,computeGeometryFromDimension as d,computeLength as y,computationToGeometryDependencies as h}from"./lengthDimensionUtils.js";import{geodesicDistanceThreshold as f}from"../../../support/geodesicMeasurementUtils.js";let g=class extends o{constructor(t){super(t)}initialize(){const t=r((()=>this.analysisViewData.computations),(({computation:t})=>this._watchComputation(t)));this.addHandles(s(t))}get analysis(){return this.analysisViewData.analysis}get _defaultUnit(){return p(this.view)}_watchComputation(t){return n((()=>h(t)),(o=>{const{measureType:s}=o;if(u(o)&&s!==e.Direct){const e=Math.round(m(f,"meters","kilometers"));return i.getLogger(this).warnOnce(`A ${s} dimension in the analysis (id: '${this.analysis.id}') will not display, because only direct dimensions can measure lengths greater than ${e} km. Update the measureType of the affected dimension to "direct" to display it.`),void(t.geometry=null)}const r=d(o,this.view.renderCoordsHelper,t.geometry);t.geometry=r,t.result.length=y(r,s,this._defaultUnit,this.automaticLengthMeasurementUtils)}),a)}};t([l({constructOnly:!0})],g.prototype,"analysisViewData",void 0),t([l({constructOnly:!0})],g.prototype,"view",void 0),t([l({constructOnly:!0})],g.prototype,"automaticLengthMeasurementUtils",void 0),t([l()],g.prototype,"analysis",null),t([l()],g.prototype,"_defaultUnit",null),g=t([c("esri.views.3d.analysis.Dimension.DimensionController")],g);export{g as DimensionController};