SliceViewModel

AMD: require(["esri/widgets/Slice/SliceViewModel"], (SliceViewModel) => { /* code goes here */ });
ESM: import SliceViewModel from "@arcgis/core/widgets/Slice/SliceViewModel";
Class: esri/widgets/Slice/SliceViewModel
Inheritance: SliceViewModel Accessor
Since: ArcGIS API for JavaScript 4.10

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.

See also:

Constructors

new SliceViewModel(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
SliceAnalysismore details

The slice analysis object being created or modified by the view model.

more detailsSliceViewModel
Stringmore details

The name of the class.

more detailsAccessor
Collection<(Layer|BuildingComponentSublayer)>more details

Add layers to this collection to exclude them from the slice.

more detailsSliceViewModel
Booleanmore details

Indicates whether the Ground and layers that are draped on the ground surface are excluded from the slice.

more detailsSliceViewModel
SlicePlanemore details

The shape used to slice elements in a 3D scene.

more detailsSliceViewModel
Stringmore details

The view model's state.

more detailsSliceViewModel
Booleanmore details

Enable tilting the slice shape.

more detailsSliceViewModel
SceneViewmore details

The view from which the widget will operate.

more detailsSliceViewModel

Property Details

analysis SliceAnalysisautocastreadonly
Since: ArcGIS API 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
});
declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

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
Since: ArcGIS API 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 Boolean
Since: ArcGIS API 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
more details

Clears the shape of the slice, effectively removing it from the view.

more detailsSliceViewModel
more details

Starts the interactive placement of a new slice, clearing the previous shape.

more detailsSliceViewModel

Method Details

clear()
Since: ArcGIS API 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.

start()
Since: ArcGIS API for JavaScript 4.16

Starts the interactive placement of a new slice, clearing the previous shape.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.