DimensionAnalysisView

AMD: require(["esri/views/analysis/DimensionAnalysisView"], (DimensionAnalysisView) => { /* code goes here */ });
ESM: import DimensionAnalysisView from "@arcgis/core/views/analysis/DimensionAnalysisView.js";
Class: esri/views/analysis/DimensionAnalysisView
Inheritance: DimensionAnalysisViewAccessor
Since: ArcGIS Maps SDK for JavaScript 4.25

Represents the analysis view of a DimensionAnalysis after it has been added to SceneView.analyses.

The view for an analysis can be retrieved using SceneView.whenAnalysisView similar to how layer views are retrieved for layers using SceneView.whenLayerView.

The dimension analysis view controls whether the dimensions in its associated analysis can be created or edited interactively.

// create new analysis and add it to the scene view
const dimensionAnalysis = new DimensionAnalysis();
view.analyses.add(dimensionAnalysis);
// retrieve analysis view for the analysis
view.whenAnalysisView(dimensionAnalysis).then(dimensionAnalysisView => {
   // allow existing dimensions in the analysis to be edited by selecting them
   dimensionAnalysisView.interactive = true;
   // start adding new dimensions interactively
   dimensionAnalysisView.createLengthDimensions();
});

The analysis view also allows the length measured by each dimension to be retrieved.

// retrieve measured results from the analysis view
view.whenAnalysisView(dimensionAnalysis).then(dimensionAnalysisView => {
   const results = dimensionAnalysisView.results;
});

Things to consider:

See also

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

The dimension analysis object associated with the analysis view.

DimensionAnalysisView

The name of the class.

Accessor

Set to true to enable interactivity for the analysis.

DimensionAnalysisView

Results for each dimension in the analysis.

DimensionAnalysisView

The selected dimension.

DimensionAnalysisView

When true, the analysis is visualized in the view.

DimensionAnalysisView

Property Details

analysis

Property
analysis DimensionAnalysisreadonly

The dimension analysis object associated with the analysis view.

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

interactive

Property
interactive Boolean

Set to true to enable interactivity for the analysis. If the analysis includes any dimensions, they become selectable and editable.

Default Value:false

results

Property
results Collection<LengthDimensionResult>readonly

Results for each dimension in the analysis.

The order of results matches the order of dimensions, so if the index of the dimension is known the collection can be indexed directly:

const dimensionAnalysisView = await view.whenAnalysisView(dimensionAnalysis);
const result = dimensionAnalysisView.results.at(dimensionIdx);

Given a dimension object, the results collection can also be searched:

const result = dimensionAnalysisView.results.find((result) => result.dimension === dimensionObject);

selectedDimension

Property
selectedDimension LengthDimension

The selected dimension. If interactive is true, any dimension in the analysis can be selected by clicking on it in the view. As long as interactive remains true, the properties of the selected dimension can be edited by interacting with manipulators in the view.

visible

Property
visible Boolean

When true, the analysis is visualized in the view.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor
Promise

Starts the interactive creation of new dimensions and adds them to the analysis.

DimensionAnalysisView

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

createLengthDimensions

Method
createLengthDimensions(options){Promise}

Starts the interactive creation of new dimensions and adds them to the analysis.

The creation process will finish when the user double-clicks the mouse or presses the escape key. In order to otherwise stop the creation process, pass an abort signal as an argument when calling the method.

let abortController;
view.whenAnalysisView(dimensionAnalysis).then(dimensionAnalysisView => {
   // create a new controller
   abortController = new AbortController();
   // pass the controller as an argument to the interactive creation method
   dimensionAnalysisView.createLengthDimensions(abortController);
   // abort the controller to stop the creation process
   abortController.abort();
});

Calling this method sets interactive to true.

Parameters
options Object
optional

An object specifying additional options.

Specification
signal AbortSignal
optional

Abort signal which can be used to cancel creation.

Returns
Type Description
Promise A promise which resolves when creation is completed, or rejects if creation is cancelled.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.