|
![](http://bbs.3s001.com/static/image/common/ico_lz.png)
楼主 |
发表于 2022-10-13 11:26
|
显示全部楼层
'选择要素
Sub SelectFeatures()
Dim mxDoc As IMxDocument '地图文档
Dim lyr As IFeatureLayer '要素层
Dim sel As IFeatureSelection '选择集
Dim filter As IQueryFilter '查询过滤器
Dim selEvents As ISelectionEvents '???
Set mxDoc = Application.Document '获取当前地图文档
Set lyr = FindLayer(mxDoc.FocusMap, "BUILDING") '调用FindLayer函数查找图层
Set sel = lyr '将找到的图层设为选择集
Set filter = New QueryFilter '创建查询过滤器
filter.WhereClause = "BDNAME ='实验楼A'" '设置where子句
sel.SelectFeatures filter, esriSelectionResultNew, False '选中满足条件的要素
mxDoc.activeView.PartialRefresh esriViewGeoSelection, Nothing, Nothing '绘出选中的要素
Set selEvents = mxDoc.FocusMap '???
selEvents.SelectionChanged '通知系统选择已经改变了
End Sub |
|