ArcObjects Library Reference (Carto)  

IFeatureSelection Interface

Provides access to members that control feature selection.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Members

Description
Method Add Adds a feature to the selection set.
Read/write property BufferDistance Buffer distance used for the selection.
Method Clear Clears the selection.
Read/write property CombinationMethod Combination method for the selection.
Method SelectFeatures Selects features based upon the specifed criteria and combination method.
Method SelectionChanged Fires the features layer update event. Required when SelectionSet changes.
Read/write property SelectionColor Selection color. (used when SetSelectionSymbol = FALSE).
Read/write property SelectionSet The selected set of features.
Read/write property SelectionSymbol Selection symbol.
Read/write property SetSelectionSymbol Indicates if the selected set of features is drawn using the SelectionSymbol.

CoClasses that implement IFeatureSelection

CoClasses and Classes Description
CadAnnotationLayer An ESRI Cad annotation layer.
CadastralFabricSubLayer Cadastral Fabric Feature Layer Object.
CadFeatureLayer ESRI CAD Feature Layer class.
CoverageAnnotationLayer An ESRI coverage annotation layer.
DimensionLayer A collection of properties for a dimension layer.
FDOGraphicsLayer A collection of properties for an annotation layer (feature data object graphics layer).
FeatureLayer A collection of features and their visual representation.
GdbRasterCatalogLayer Geodabase RasterCatalog source and display options.
ImageServerLayer Image server layer source and display options.
IMSSubFeatureLayer A collection of IMS features as a sublayer of an IMSMapLayer.
MADtedLayer (esriDefenseSolutions) A layer used to control the display of MA DTED Catalogs.
MARasterLayer (esriDefenseSolutions) A layer used to control the display of MA RPF Catalogs.
TemporalFeatureLayer (esriTrackingAnalyst) Defines the coclass IDL parameters and attributes of the TemporalFeatureLayer COM object.

Remarks

IFeatureSelection is a very useful interface to manage or perform selection on a layer or to modify the way the selection is displayed.

The following methods and properties are useful to manage the selection:

The CombinationMethod property is not used.
SelectionSet returns a SelectionSet corresponding to the current selection on the layer.
Clear will clear an existing selection.
Add adds one single feature to the selection.
SelectFeatures will perform a selection based on a query filter. If nothing is used as a query filter all the features will be selected. You can also specify a combination method. The justOne parameter tells the search to stop once it has found one feature.
Call SelectionChanged after modifying SelectionSet to fire update events on the layer.

The following methods and properties are useful to modify the way the selection is displayed:

SelectionSymbol will return or set the symbol used to display selected features on the layer.
SetSelectionSymbol is a boolean used to indicate if the SelectionSymbol is used or not to draw the selection. For feature layers, this is similar to using the "Show selected features...with this symbol" option in the layer properties.
SelectionColor is equivalent to using the "Show selected features...with this color" option in the layer properties.
If BufferDistance is set to a value greater than 0, a buffer will be drawn around the selected features. This is similar to using the Buffer Selection tool that can be added to the map with the Customize command found in the Tools menu.

.NET Snippets

Zoom to Selected Globe Features | Clear Selected Map Features | Select Map Features by Attribute Query |

.NET Samples

Create a custom selection extension by extending ArcObjects (Code Files: SelectionExtension) | Create camera flyby from path (Code Files: frmCameraPath) | Custom reshape polyline edit task (Code Files: ReshapePolylineEditTask) | Custom selection extension (Code Files: SelectionExtension) | Custom vertex editing commands (Code Files: CustomVertexCommands UsingOutOfBoxVertexCommands) | Executing geoprocessing tools in the background (Code Files: RunGPForm) | Network Analyst barrier location editor (Code Files: NABarrierLocationEditor) | Selection restriction evaluator (Code Files: SelectionRestrictionEvaluator) | Using the traversal result to select source features (Code Files: SelectFeaturesTool) |

.NET Related Topics

How to create a selection set using a scatter plot graph | How to zoom to selected features in globe | Performing map selection |