gispeng

在AE中取得所有图层以及没某个图层选择要素的方法

在AE中取得所有图层以及没某个图层选择要素的方法
作者:gispower  出处:GIS动力站

1、使用IEnumFeature对象获取map中的FeatureSelection,该方法可以获取所有图层的选择要素

Dim m_pMap as Imap

Set m_pMap=Mapcontrol1.Map

    Dim pEnumFeature As IEnumFeature

    Set pEnumFeature = m_pMap.FeatureSelection

Dim pfeat As IFeature

Set pfeat = pEnumFeature.Next

Do while not pfeat is nothing

       ‘opera

       Set pfeat=pEnumFeature.Next

Loop

 

2、使用ISelectionSetIEnumIDsFeatureClass.GetFeature()方法获取某个图层中的选择要素

Dim lyr2 As IFeatureLayer

Set lyr2 = MapControl1.Layer(1)

Dim selection As IFeatureSelection

Set selection = lyr2

Dim psel As ISelectionSet

Set psel = selection.SelectionSet

Dim lID As Long

Dim pEnumIDs As IEnumIDs

Set pEnumIDs = psel.IDs

Dim s As String

Dim pFeature As IFeature

lID = pEnumIDs.Next

Do

Set pFeature = lyr2.FeatureClass.GetFeature(lID)

‘opera

lID = pEnumIDs.Next

Loop Until lID = -1 \'-1 is returned after last valid ID has been reached

分类:

技术点:

相关文章:

  • 2021-12-26
  • 2021-07-09
  • 2022-02-19
  • 2021-10-16
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案