This document is archived and information here might be outdated.  Recommended version.


IMap.SelectByShape Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Carto)  

IMap.SelectByShape Method

Selects features in the map given a shape and a selection environment (optional).

[Visual Basic .NET]
Public Sub SelectByShape ( _
    ByVal Shape As IGeometry, _
    ByVal env As ISelectionEnvironment, _
    ByVal justOne As Boolean _
)
[C#]
public void SelectByShape (
    IGeometry Shape,
    ISelectionEnvironment env,
    bool justOne
);
[C++]
HRESULT SelectByShape(
  IGeometry* Shape,
  ISelectionEnvironment* env,
  VARIANT_BOOL justOne
);
[C++]

Parameters Shape [in]
Shape is a parameter of type IGeometry env [in]
env is a parameter of type ISelectionEnvironment justOne [in] justOne is a parameter of type VARIANT_BOOL

Product Availability

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

Remarks

SelectByShape searches for features in all layers of type IFeatureLayer, that are intersected by the input shape.  Each layer is searched only if its IFeatureLayer::Selectable property is set to TRUE. 

The ISelectionEnvironment parameter determines the selection outcome.  For example, a new selection may be created or the features found may be added to the existing feature selection.  See the esriSelectionOption enumeration for the different selection options.  The application's selection environment is available via IMxApplication::SelectionEnvironment.

The justOne parameter tells the search to stop once it has found one feature.

After the search is complete, IActiveViewEvents::SelectionChanged is called to notify all listeners the selection has changed.

See Also

IMap Interface

.NET Related Topics

Performing map selection