The thing is that points should be selected automatically (for example, all points in active view). And then deleted. It seems i forgot to mention it the beginning of this thread 🙂
Ye you did forgot to mention that 🙂Ok here is the solution:
private IMxDocument MxDoc = ArcMap.Document;
protected override void OnClick()
{
IActiveView activeView = MxDoc.ActiveView;
IEnvelope env = activeView.Extent;
IGeometry geom = (IGeometry)env;
Map.SelectByShape(geom, null, false);
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, env);
}
But here is the thing. It selects all features from ALL layers I don't know if that is a problem but you can later delete features only from one layer. Of course to do that you need to start edit session:)There is one more option: before selecting by shape you can set the selectable property for feature layers that you don't want to be selected to false. I would do this like this:
IUID uid = new UIDClass();
uid.Value = "{40A9E885-5533-11D0-98BE-00805F7CED21}";
IEnumLayer enumLayerByName = Map.get_Layers((UID)uid, true);
enumLayerByName.Reset();
ILayer iLayer = enumLayerByName.Next();
while (!(iLayer == null))
{
if (iLayer.Name != "your_layer_name")
{
IFeatureLayer featLayer= (IFeatureLayer)iLayer;
featLayer.Selectable = false;
}
iLayer = enumLayerByName.Next();
}
CheersMDruzgala