YouTube | Facebook | X(Twitter) | RSS

ネットワーク解析フィーチャを特定する方法

2016/9/1 (木)

Sub GetResultElements()
    'ユーティリティネットワークエクステンションにアクセスする
    Dim pUtilityNetworkAnalysisExt As IUtilityNetworkAnalysisExt
    Set pUtilityNetworkAnalysisExt = Application.FindExtensionByName("esriEditorext.UtilityNetworkAnalysisExt")
     
    Dim pNetworkAnalysisExt  As INetworkAnalysisExt
    Set pNetworkAnalysisExt = pUtilityNetworkAnalysisExt
     
    Dim pTraceTasks  As ITraceTasks
    Set pTraceTasks = pUtilityNetworkAnalysisExt
 
    Dim pTraceTaskResults As ITraceTaskResults
    Set pTraceTaskResults = pTraceTasks.CurrentTask
 
    Dim junctionEIDs  As IEnumNetEID
    Set junctionEIDs = pTraceTaskResults.ResultJunctions
     
    Dim edgeEIDs As IEnumNetEID
    Set edgeEIDs = pTraceTaskResults.ResultEdges
 
'    Dim pNetworkAnalysisExtResults As INetworkAnalysisExtResults
'    Set pNetworkAnalysisExtResults = pUtilityNetworkAnalysisExt
'
'    Dim junctionEID As Long
'    Dim edgeEID As Long
'
'    junctionEIDs.Reset
'    junctionEID = junctionEIDs.Next
'
'    Do Until junctionEID = 0
'
'        Debug.Print "Junction", junctionEID
'        junctionEID = junctionEIDs.Next
'    Loop
'
'    edgeEID = edgeEIDs.Next
'    edgeEIDs.Reset
'    Do Until edgeEID = 0
'
'        Debug.Print "Edge", edgeEID
'        edgeEID = edgeEIDs.Next
'    Loop
    
     
    Dim pEIDHelper As IEIDHelper
    Set pEIDHelper = New EIDHelper
    pEIDHelper.ReturnFeatures = True
    Set pEIDHelper.GeometricNetwork = pNetworkAnalysisExt.CurrentNetwork
     
    Dim pEnumEIDInfo As IEnumEIDInfo
     
    'ジャンクションの取得
    Set pEnumEIDInfo = pEIDHelper.CreateEnumEIDInfo(junctionEIDs)
    pEnumEIDInfo.Reset
     
    Dim pEIDInfo As IEIDInfo
    Set pEIDInfo = pEnumEIDInfo.Next
 
    Do Until pEIDInfo Is Nothing
        Debug.Print "Junction", pEIDInfo.Feature.OID
        Set pEIDInfo = pEnumEIDInfo.Next
    Loop
     
    'エッジの取得
    Set pEnumEIDInfo = pEIDHelper.CreateEnumEIDInfo(edgeEIDs)
    pEnumEIDInfo.Reset
     
    Set pEIDInfo = pEnumEIDInfo.Next
         
    Do Until pEIDInfo Is Nothing
        Debug.Print "Edge", pEIDInfo.Feature.OID
        Set pEIDInfo = pEnumEIDInfo.Next
    Loop
 
End Sub
  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『"地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

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