import DirectLineMeasurementAnalysisView3D from "@arcgis/core/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js";
const DirectLineMeasurementAnalysisView3D = await $arcgis.import("@arcgis/core/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js");
@arcgis/core/views/3d/analysis/DirectLineMeasurementAnalysisView3D
Represents the analysis view of a DirectLineMeasurementAnalysis after it has been added to SceneView.analyses.
The DirectLineMeasurementAnalysisView3D is responsible for rendering a DirectLineMeasurementAnalysis using custom visualizations.
It allows to create a new analysis interactively using the place() method, query the measured result, or make an existing analysis editable by enabling the interactive property.
The view for an analysis can be retrieved using SceneView.whenAnalysisView similar to how layer views are retrieved for layers using SceneView.whenLayerView.
// retrieve analysis view for analysis
const analysis = new DirectLineMeasurementAnalysis();
sceneView.analyses.add(analysis); // add to the scene view
const analysisView = await view.whenAnalysisView(analysis);
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 direct line measurement analysis object associated with the analysis view. | DirectLineMeasurementAnalysisView3D | ||
Enables interactivity for the associated analysis. | DirectLineMeasurementAnalysisView3D | ||
Result of the direct line measurement. | DirectLineMeasurementAnalysisView3D | ||
The analysis view type. | DirectLineMeasurementAnalysisView3D | ||
When | DirectLineMeasurementAnalysisView3D |
Property Details
-
analysis
analysis DirectLineMeasurementAnalysisreadonly
-
The direct line measurement analysis object associated with the analysis view.
-
interactive
interactive Boolean
-
Enables interactivity for the associated analysis. When set to
true
, manipulators will be displayed, allowing users to click and drag to edit the analysis if it has a valid startPoint and endPoint.This property is automatically set to
true
when the analysis is assigned to a Direct Line Measurement 3D component.- Default Value:false
-
result
result DirectLineMeasurementAnalysisResult |null |undefined
-
Result of the direct line measurement. Results are calculated asynchronously and should be watched for changes.
-
type
type Stringreadonly
-
The analysis view type.
For DirectLineMeasurementAnalysisView3D the type is always "direct-line-measurement-view-3d".
-
visible
visible Boolean
-
When
true
, the analysis is visualized in the view.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Promise<DirectLineMeasurementPlacementResult> | Starts the interactive placement of a direct line measurement. | DirectLineMeasurementAnalysisView3D |
Method Details
-
place
place(options){Promise<DirectLineMeasurementPlacementResult>}
-
Starts the interactive placement of a direct line measurement.
If the analysis does not have a startPoint and endPoint yet, the method allows placing the start and end points interactively in the view. If the analysis already has a measurement, clicking in the view will remove it and start the placement of new start and end points.
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<DirectLineMeasurementPlacementResult> 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();
Type Definitions
-
Result obtained from a DirectLineMeasurementAnalysis.
- Properties
-
mode String
Describes how the
horizontalDistance
is computed.- In
euclidean
mode, the horizontal distance is the 2D distance between the two points, computed in a Euclidean manner. This mode is used in scenes with projected coordinate systems (PCS), apart from Web Mercator. - In
geodesic
mode, the horizontal distance is computed geodetically. This mode is used in scenes with geographic coordinate systems (GCS) or in Web Mercator.
Possible Values:"euclidean"|"geodesic"
directDistance LengthThe 3D distance between the two points that is computed in a Euclidean manner.
horizontalDistance LengthThe 2D distance between the two points.
verticalDistance LengthThe elevation difference between the two points.
- In