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:
- Snapping is enabled by default. This can be temporarily disabled by holding the
CTRL
key. - Layer types currently supported for snapping are: FeatureLayer, GraphicsLayer, GeoJSONLayer, WFSLayer, CSVLayer, 3D Object SceneLayer, and BuildingSceneLayer.
- See also
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
DimensionAnalysis | The dimension analysis object associated with the analysis view. more details | DimensionAnalysisView | |
String | The name of the class. more details | Accessor | |
Boolean | Set to | DimensionAnalysisView | |
Collection<LengthDimensionResult> | Results for each dimension in the analysis. more details | DimensionAnalysisView | |
LengthDimension | The selected dimension. more details | DimensionAnalysisView | |
Boolean | When | DimensionAnalysisView |
Property Details
-
analysis DimensionAnalysisreadonly
-
The dimension analysis object associated with the analysis view.
-
The name of the class. The declared class name is formatted as
esri.folder.className
.
-
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 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 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 remainstrue
, the properties of the selected dimension can be edited by interacting with manipulators in the view.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. more details | Accessor | ||
Promise | Starts the interactive creation of new dimensions and adds them to the analysis. more details | DimensionAnalysisView | |
Boolean | Returns true if a named group of handles exist. more details | Accessor | |
Removes a group of handles owned by the object. more details | Accessor |
Method Details
-
addHandles(handleOrHandles, groupKey)inherited
-
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.
-
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
.Parametersoptions ObjectoptionalAn object specifying additional options.
Specificationsignal AbortSignaloptionalAbort signal which can be used to cancel creation.
ReturnsType Description Promise A promise which resolves when creation is completed, or rejects if creation is cancelled.
-
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"); }
-
removeHandles(groupKey)inherited
-
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");