import ViewshedAnalysisView3D from "@arcgis/core/views/3d/analysis/ViewshedAnalysisView3D.js";
const ViewshedAnalysisView3D = await $arcgis.import("@arcgis/core/views/3d/analysis/ViewshedAnalysisView3D.js");
@arcgis/core/views/3d/analysis/ViewshedAnalysisView3D
Represents the analysis view of a ViewshedAnalysis after it has been added to SceneView.analyses.
The ViewshedAnalysisView3D is responsible for rendering a ViewshedAnalysis using custom visualizations.
It allows to create new viewsheds interactively using the place() method, or to make existing viewsheds selectable and editable by enabling the interactive property. To select a viewshed, hover and click on its field-of-view manipulators.
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 viewshedAnalysis = new ViewshedAnalysis();
sceneView.analyses.add(viewshedAnalysis);
// retrieve analysis view
const viewshedAnalysisView = await view.whenAnalysisView(viewshedAnalysis);
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The viewshed analysis object associated with the analysis view. | ViewshedAnalysisView3D | ||
Enables interactivity for the analysis. | ViewshedAnalysisView3D | ||
The selected viewshed. | ViewshedAnalysisView3D | ||
The analysis view type. | ViewshedAnalysisView3D | ||
When | ViewshedAnalysisView3D |
Property Details
-
analysis
analysis ViewshedAnalysisreadonly
-
The viewshed analysis object associated with the analysis view.
-
The selected viewshed. If interactive is
true
, any viewshed in the analysis can be selected by clicking on it in the view. As long as interactive remainstrue
, the properties of the selected viewshed can be edited by interacting with manipulators in the view.
-
type
type Stringreadonly
-
The analysis view type.
For ViewshedAnalysisView3D the type is always "viewshed-view-3d".
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Promise<void> | Starts the interactive creation of new viewsheds and adds them to the analysis. | ViewshedAnalysisView3D | |
Promise<ViewshedPlacementResult> | Starts the interactive placement of a single viewshed, adding it to the analysis. | ViewshedAnalysisView3D |
Method Details
-
Starts the interactive creation of new viewsheds and adds them to the analysis.
The first click in the scene places the observer point and the second sets the viewshed's orientation and distance.
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 viewsheds in a row.
Calling this method sets interactive to
true
.Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene. This behavior is subject to change in a future release.
Parametersoptional An 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 viewshedAnalysisView.createViewsheds({ signal: abortController.signal }); } catch (error) { if (error.name === "AbortError") { console.log("Creation operation was cancelled."); } } // cancel the placement operation at some later point abortController.abort();
-
place
place(options){Promise<ViewshedPlacementResult>}
Since: ArcGIS Maps SDK for JavaScript 4.33ViewshedAnalysisView3D since 4.30, place added at 4.33. -
Starts the interactive placement of a single viewshed, adding it to the analysis.
The first click in the scene places the observer point and the second sets the viewshed's orientation.
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
.Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene. This behavior is subject to change in a future release.
ParametersReturnsType Description Promise<ViewshedPlacementResult> 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();