SelectionManager class

The SelectionManager class manages feature layer selection. It enables you to update the selection by features.

AMD Module Require

require(["jimu/SelectionManager"], function(SelectionManager) { /* code goes here */ });

Constructor

SelectionManager has no constructor. Use SelectionManager.getInstance() to get the SelectionManager instance.

Example:

require(['jimu/SelectionManager], function(SelectionManager){
          var selectionManager = SelectionManager.getInstance();
          ...
        });

Methods

setSelectionSymbol(layer)

Sets the default selection symbol for the feature layer.

Return type: Undefined.

Parameters:

<FeatureLayer> layer—Required. The feature layer used to set the default selection symbol.

setSelection(layer, features)

Creates a new selection set by the specified features.

Return type: Deferred.

Parameters:

<FeatureLayer> layer—Required. The feature layer used to update the selection set.

<Feature[]> features—Required. Uses the specified features as the selection set of the layer.

addFeaturesToSelection(layer, features)

Adds features to the layer's current selection set.

Return type: Deferred.

Parameters:

<FeatureLayer> layer—Required. The feature layer used to update the selection set.

<Feature[]> features—Required. Adds the specified features to the selection set of the layer.

removeFeaturesFromSelection(layer, features)

Removes features from the layer’s current selection.

Return type: Deferred.

Parameters:

<FeatureLayer> layer—Required. The feature layer used to update the selection set.

<Feature[]> features—Required. Removes the specified features from the layer's current selection.

clearSelection(layer)

Clears the layer's current selection.

Return type: Deferred.

Parameters:

<FeatureLayer> layer—Required. The feature layer used to clear the selection set.

updateSelectionByFeatures(layer, features, selectionMethod)

Updates the layer’s current selection set by features. The other methods, such as setSelection, addFeaturesToSelection, removeFeaturesFromSelection, and clearSelection, all internally execute this method.

Return type: Deferred.

Parameters:

<FeatureLayer> layer—Required. The feature layer used to update the selection set.

<Feature[]> features—Required. Uses the specified features to update the selection set.

<Number> selectionMethod—Required. Defines how the rest of the selection is combined with the existing selection. Available constant values are FeatureLayer.SELECTION_ADD, FeatureLayer.SELECTION_NEW, and FeatureLayer.SELECTION_SUBTRACT. See FeatureLayer for details.

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