IFeatureSelection与IMap中选择要素的区别

IFeatureSelection接口由FeatureLayer类实现,主要用来存放用户在该图层中选择的要素,例如一般的属性查图,找到的元素一般放置在IFeatureSelection接口中。具体方法如下:

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.

使用方法:

IFeatureSelection pfeaturesel = pfeatureLyr as IFeatureSelection;
pfeaturesel.Add(pFeature);//tianjia yuansu 
IFeatureSelection pfeaturesel = pfeatureLyr as IFeatureSelection;
pfeaturesel.Clear();

注意:操作完成后要更新MapControl
IMap接口中有 SelectFeature方法,用来向FeatureLayer的Selection中添加Feature

[C#]public void SelectFeature (
    ILayerLayer,
    IFeatureFeature);
ClearFeature用来清除整个Map地图文档中所有图层的Selection中的feature .
[C#]public void ClearSelection ();

GIS需要我们添砖加瓦
原文地址:https://www.cnblogs.com/zzz-z123/p/3405902.html