require(["esri/views/3d/analysis/ViewshedAnalysisView3D"], (ViewshedAnalysisView3D) => { /* code goes here */ });
import ViewshedAnalysisView3D from "@arcgis/core/views/3d/analysis/ViewshedAnalysisView3D.js";
esri/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.
The view for an analysis can be retrieved using SceneView.whenAnalysisView similar to how layer views are retrieved for layers using SceneView.whenLayerView.
The viewshed analysis view controls whether the viewsheds in their associated analysis can be created or edited interactively.
// create new analysis and add it to the scene view
const viewshedAnalysis = new ViewshedAnalysis();
sceneView.analyses.add(viewshedAnalysis);
// retrieve analysis view
view.whenAnalysisView(viewshedAnalysis).then(viewshedAnalysisView => {
// allow existing viewsheds in the analysis to be edited by selecting them
viewshedAnalysisView.interactive = true;
// start adding new viewsheds interactively
viewshedAnalysisView.createViewsheds();
});
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The viewshed analysis object associated with the analysis view. | ViewshedAnalysisView3D | ||
Set to | 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.
-
interactive
interactive Boolean
-
Set to
true
to enable interactivity for the associated ViewshedAnalysis. If the analysis has a valid shape defined, then manipulators will be shown which the user can click and drag in order to edit the analysis.- Default Value:false
-
selectedViewshed
selectedViewshed Viewshed
-
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".
-
visible
visible Boolean
-
When
true
, the analysis is visualized in the view.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Promise | Starts the interactive creation of new viewsheds and adds them 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.
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(viewshedAnalysis).then(viewshedAnalysisView => { // create a new controller abortController = new AbortController(); // pass the controller as an argument to the interactive creation method viewshedAnalysisView.createViewsheds(abortController); // abort the controller to stop the creation process abortController.abort(); });
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.
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.