UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 2.27 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{_ as t}from"../../../../chunks/tslib.es6.js";import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import s from"../../../../core/Accessor.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import r from"../../../../core/Logger.js";import{mapCollection as i,watch as n,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{convertUnit as l}from"../../../../core/unitUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{getDefaultUnitForView as c}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 s{constructor(t){super(t)}initialize(){const t=i((()=>this.analysisViewData.computations),(({computation:t})=>this._watchComputation(t)));this.addHandles(o(t))}get analysis(){return this.analysisViewData.analysis}get _defaultUnit(){return c(this.view)}_watchComputation(t){return n((()=>h(t)),(s=>{const{measureType:o}=s;if(u(s)&&o!==e.Direct){const e=Math.round(l(f,"meters","kilometers"));return r.getLogger(this).warnOnce(`A ${o} 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 i=d(s,this.view.renderCoordsHelper,t.geometry);t.geometry=i,t.result.length=y(i,o,this._defaultUnit)}),a)}};t([m({constructOnly:!0})],g.prototype,"analysisViewData",void 0),t([m({constructOnly:!0})],g.prototype,"view",void 0),t([m()],g.prototype,"analysis",null),t([m()],g.prototype,"_defaultUnit",null),g=t([p("esri.views.3d.analysis.Dimension.DimensionController")],g);export{g as DimensionController};