import DimensionAnalysisView3D from "@arcgis/core/views/3d/analysis/DimensionAnalysisView3D.js";
const DimensionAnalysisView3D = await $arcgis.import("@arcgis/core/views/3d/analysis/DimensionAnalysisView3D.js");
@arcgis/core/views/3d/analysis/DimensionAnalysisView3D
Represents the analysis view of a DimensionAnalysis after it has been added to SceneView.analyses.
The DimensionAnalysisView3D is responsible for rendering a DimensionAnalysis using custom visualizations.
It allows to create new dimensions interactively using the place() method, query measured results, or to make existing dimensions selectable and editable by enabling the interactive property. To select a dimension, hover and click on its offset manipulator.
The view for an analysis can be retrieved using SceneView.whenAnalysisView similar to how layer views are retrieved for layers using SceneView.whenLayerView.
// create new analysis and add it to the view
const dimensionAnalysis = new DimensionAnalysis();
view.analyses.add(dimensionAnalysis);
// retrieve analysis view for the analysis
const dimensionAnalysisView = await view.whenAnalysisView(dimensionAnalysis);
Things to consider:
- Snapping is enabled by default. This can be temporarily disabled by holding the
CTRL
key. - Layer types currently supported for snapping are: FeatureLayer, GraphicsLayer (except Mesh geometries), GeoJSONLayer, WFSLayer, CSVLayer, 3D Object SceneLayer, and BuildingSceneLayer.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The dimension analysis object associated with the analysis view. | DimensionAnalysisView3D | ||
The name of the class. | Accessor | ||
Enables interactivity for the analysis. | DimensionAnalysisView3D | ||
Results for each dimension in the analysis. | DimensionAnalysisView3D | ||
The selected dimension. | DimensionAnalysisView3D | ||
The analysis view type. | DimensionAnalysisView3D | ||
When | DimensionAnalysisView3D |
Property Details
-
analysis
analysis DimensionAnalysisreadonly
-
The dimension analysis object associated with the analysis view.
-
interactive
interactive Boolean
-
Enables interactivity for the analysis. When set to
true
and the analysis includes any valid dimensions, they become selectable and editable.- Default Value:false
-
results
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
selectedDimension LengthDimension |null |undefined
-
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 remainstrue
, the properties of the selected dimension can be edited by interacting with manipulators in the view.
-
type
type Stringreadonly
-
The analysis view type.
For DimensionAnalysisView3D the type is always "dimension-view-3d".
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Promise<void> | Starts the interactive creation of new dimensions and adds them to the analysis. | DimensionAnalysisView3D | |
Returns true if a named group of handles exist. | Accessor | ||
Promise<DimensionPlacementResult> | Starts the interactive placement of a single dimension, adding it to the analysis. | DimensionAnalysisView3D | |
Removes a group of handles owned by the object. | Accessor |
Method Details
-
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();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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.
-
Starts the interactive creation of new dimensions and adds them to the analysis.
The first click places start point and the second sets end point.
The creation process will finish when the user double-clicks the mouse or presses the escape key. To stop the creation programmatically, pass an abort signal as an argument when calling the method.
This method is similar to the place() method, but it allows to create multiple dimensions in a row.
Calling this method sets interactive to
true
.Parametersoptions ObjectoptionalAn object specifying additional options.
Specificationsignal AbortSignal|null|undefinedoptionalAbort signal which can be used to cancel creation.
ReturnsType Description Promise<void> A promise which resolves when creation is completed successfully or rejected if it is canceled. Exampleconst abortController = new AbortController(); try { await analysisView.createLengthDimensions({ signal: abortController.signal }); } catch (error) { if (error.name === "AbortError") { console.log("Placement operation was cancelled."); } } // cancel the placement operation at some later point abortController.abort();
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from Accessor -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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"); }
-
place
place(options){Promise<DimensionPlacementResult>}
-
Starts the interactive placement of a single dimension, adding it to the analysis.
The first click places start point and the second sets end point.
The placement operation will finish when the user presses the escape key. To stop the placing programmatically, pass an abort signal as an argument when calling the method.
Calling this method sets interactive to
true
.ParametersReturnsType Description Promise<DimensionPlacementResult> A promise which resolves when the operation is completed successfully or rejected if it is canceled. Exampleconst abortController = new AbortController(); try { await analysisView.place({ signal: abortController.signal }); } catch (error) { if (error.name === "AbortError") { console.log("Placement operation was cancelled."); } } // cancel the placement operation at some later point abortController.abort();
-
Inherited from Accessor
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");