import SliceAnalysisView3D from "@arcgis/core/views/3d/analysis/SliceAnalysisView3D.js";
const SliceAnalysisView3D = await $arcgis.import("@arcgis/core/views/3d/analysis/SliceAnalysisView3D.js");
@arcgis/core/views/3d/analysis/SliceAnalysisView3D
Represents the analysis view of a SliceAnalysis after it has been added to SceneView.analyses.
The SliceAnalysisView3D is responsible for rendering a SliceAnalysis using custom visualizations.
It allows to create a new slice interactively using the place() method, exclude layers from slicing using the pickLayerToExclude() method, or make an existing analysis editable by enabling the interactive property.
While multiple SliceAnalysis can be added to
SceneView.analyses, only one SliceAnalysis can be
actively slicing the scene. The SliceAnalysis which
is currently actively slicing the scene can be controlled by setting the active property on its analysis view to true
.
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 sliceAnalysis = new SliceAnalysis();
view.analyses.add(sliceAnalysis); // add to the scene view
const sliceAnalysisView = await view.whenAnalysisView(sliceAnalysis);
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
Only one SliceAnalysis at a time can be active in a SceneView. | SliceAnalysisView3D | ||
The slice analysis object associated with the analysis view. | SliceAnalysisView3D | ||
Enables interactivity for the associated analysis. | SliceAnalysisView3D | ||
For SliceAnalysisView3D the type is always "slice-view-3d". | SliceAnalysisView3D | ||
When | SliceAnalysisView3D |
Property Details
-
active
active Boolean
-
Only one SliceAnalysis at a time can be active in a SceneView. When a slice analysis view is activated by setting this property to
true
, all other slice analysis views are automatically deactivated.- Default Value:true
-
analysis
analysis SliceAnalysisreadonly
-
The slice 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 shape.This property is automatically set to
true
when the analysis is assigned to a Slice component.- Default Value:false
-
type
type Stringreadonly
-
For SliceAnalysisView3D the type is always "slice-view-3d".
-
visible
visible Boolean
-
When
true
, the analysis is visualized in the view.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Promise<void> | Starts an interactive operation to pick a layer to exclude from the slice analysis. | SliceAnalysisView3D | |
Promise<SlicePlacementResult> | Starts the interactive placement of a slice plane. | SliceAnalysisView3D |
Method Details
-
Starts an interactive operation to pick a layer to exclude from the slice analysis.
If the user clicks on the ground, the excludeGroundSurface property is set to
true
. Otherwise, the clicked layer is added to the excludedLayers.This method can only be called when the analysis has a valid shape. Otherwise, an error is thrown. Calling this method sets interactive and active to
true
.ParametersReturnsType Description Promise<void> A promise which resolves when the operation is completed successfully or rejected if it is canceled.
-
place
place(options){Promise<SlicePlacementResult>}
-
Starts the interactive placement of a slice plane.
If the analysis does not have a shape yet, the method allows placing the slice plane interactively in the view. If the analysis already has a shape, clicking in the view will replace the existing shape with a new one.
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 and active to
true
.ParametersReturnsType Description Promise<SlicePlacementResult> 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();