Provides the logic for the Slice widget. SliceViewModel provides access to the slice plane and the layers that can be excluded from the slice widget.
Constructors
-
new SliceViewModel(properties)
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
SliceAnalysis | The slice analysis object being created or modified by the view model. more details | SliceViewModel | |
String | The name of the class. more details | Accessor | |
Collection<(Layer|BuildingComponentSublayer)> | Add layers to this collection to exclude them from the slice. more details | SliceViewModel | |
Boolean | Indicates whether the Ground and layers that are draped on the ground surface are excluded from the slice. more details | SliceViewModel | |
SlicePlane | The shape used to slice elements in a 3D scene. more details | SliceViewModel | |
String | The view model's state. more details | SliceViewModel | |
Boolean | Enable tilting the slice shape. more details | SliceViewModel | |
SceneView | The view from which the widget will operate. more details | SliceViewModel |
Property Details
-
Since: ArcGIS Maps SDK for JavaScript 4.23
-
The slice analysis object being created or modified by the view model.
This property can be set during view model construction, to provide an existing analysis to the view model for modification. Properties on the analysis can also be updated once it's assigned to the view model.
If no analysis is provided during view model construction, the view model automatically creates its own analysis and adds it to the view. In this case, the analysis will also be automatically removed from the view when the view model is destroyed.
Example// Construct a slice analysis object outside of the view model const analysis = new SliceAnalysis({ shape: { type: "plane", // autocasts as new SlicePlane() position: { type: "point", x: -0.1, y: 51.5 }, width: 50, height: 50, tilt: 45 }, tiltEnabled: true }); // Ensure that the analysis is added to the view view.analyses.add(analysis); // Frame the analysis in the view view.goTo(analysis.extent); // Pass the analysis object as a constructor parameter to modify it using the view model const viewModel = new SliceViewModel({ analysis: analysis, view: view });
-
The name of the class. The declared class name is formatted as
esri.folder.className
.
-
excludedLayers Collection<(Layer|BuildingComponentSublayer)>
-
Add layers to this collection to exclude them from the slice. Layers that are draped on the ground surface are not affected by this property
-
excludeGroundSurface Boolean
-
Indicates whether the Ground and layers that are draped on the ground surface are excluded from the slice.
- Default Value:false
-
shape SlicePlaneautocastSince: ArcGIS Maps SDK for JavaScript 4.16
-
The shape used to slice elements in a 3D scene. Currently the only supported shape is a plane.
Example// Clone the shape to modify its properties const shape = viewModel.shape.clone(); // Set new values for heading and tilt shape.heading = 180; shape.tilt = 45; // Set the new properties on the viewModel's shape viewModel.shape = shape;
-
state Stringreadonly
-
The view model's state.
Value Description disabled not ready yet ready ready for slicing slicing currently slicing sliced finished slicing Possible Values:"disabled"|"ready"|"slicing"|"sliced"
- Default Value:disabled
-
tiltEnabled BooleanSince: ArcGIS Maps SDK for JavaScript 4.16
-
Enable tilting the slice shape. If set to true, the slice shape will orient itself as best as possible to the surface under the cursor when first placing the shape. If set to false, the slice shape is restricted to be either horizontal or vertical.
- Default Value:false
-
view SceneView
-
The view from which the widget will operate.
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 | ||
Clears the shape of the slice, effectively removing it from the view. more details | SliceViewModel | ||
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 | ||
Starts the interactive creation of a new slice, clearing the previous shape. more details | SliceViewModel |
Method Details
-
addHandles(handleOrHandles, groupKey)inheritedSince: ArcGIS Maps SDK for JavaScript 4.25
-
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.
-
clear()Since: ArcGIS Maps SDK for JavaScript 4.16
-
Clears the shape of the slice, effectively removing it from the view. Other properties like excludedLayers and excludeGroundSurface are not modified.
-
Since: ArcGIS Maps SDK for JavaScript 4.25
-
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)inheritedSince: ArcGIS Maps SDK for JavaScript 4.25
-
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");
-
start()Since: ArcGIS Maps SDK for JavaScript 4.16
-
Starts the interactive creation of a new slice, clearing the previous shape.