選択フィーチャの OID 群を取得する方法

      2017/12/09

''' <summary>
''' フィーチャ レイヤの選択フィーチャOID群の取得
''' </summary>
''' <param name="pFeatureLayer">FeatureLayer</param>
''' <returns>List(Of Long)</returns>
''' <remarks>.NET FrameworkのList型でOIDを返す</remarks>
Private Function GetSelectedOIDs(ByVal pFeatureLayer As IFeatureLayer) As List(Ong)
    Dim pFeatureSelection As IFeatureSelection = CType(pFeatureLayer, IFeatureSeion)
    Dim pSelectionSet As ISelectionSet = pFeatureSelection.SelectionSet
 
    Dim pEnumIDs As IEnumIDs = pSelectionSet.IDs
    pEnumIDs.Reset()                '
    Dim o As Long = pEnumIDs.Next()
    Dim array As New List(Of Long)  'List()にOID群を格納
    Do Until o = -1
        array.Add(o)
        o = pEnumIDs.Next()
    Loop
 
    Return array
End Function

 - プログラミング, ArcGIS , ,