ネットワーク解析レイヤを作成する方法

'This function creates a new network analysis layer
''' <summary>
''' ネットワーク解析レイヤの作成
''' </summary>
''' <param name="pNetworkLayer">NetworkLayer</param>
''' <param name="pNASolver">NASolver</param>
''' <param name="sName">レイヤ名</param>
''' <returns>INALayerオブジェクト</returns>
''' <remarks>
'''     pNASolverには新規作成したオブジェクトをセットする
'''     NAClosestFacilitySolver : 最寄り施設の検出
'''     NAODCostMatrixSolver    : ODコスト マトリックス
'''     NARouteSolver           : ルート
'''     NAServiceAreaSolver     : サービス エリア
'''     NAVRPSolver             : 配車ルート(VRP)
''' </remarks>
Public Function CreateNetworkAnalysisLayer(ByVal pNetworkLayer As INetworkLayer,al pNASolver As INASolver, ByVal sName As String) As INALayer

    'Network Datasetの取得
    Dim pNetworkDataset As INetworkDataset = pNetworkLayer.NetworkDataset
    Dim pDatasetComponent As IDatasetComponent = CType(pNetworkDataset, IDatasetonent)

    'Data Elementの取得
    Dim pDENetworkDataset As IDENetworkDataset = CType(pDatasetComponent.DataEle, IDENetworkDataset)

    'NAContextを作成してバインド
    Dim pNAContext As INAContext = CType(pNASolver.CreateContext(pDENetworkDataspNASolver.Name), INAContext)
    Dim pNAContextEdit As INAContextEdit = CType(pNAContext, INAContextEdit)
    pNAContextEdit.Bind(pNetworkDataset, New GPMessages)

    Dim pNALayer As INALayer

    'ネットワーク解析レイヤの作成
    pNALayer = pNASolver.CreateLayer(pNAContext)
    Dim pLayer As ILayer = CType(pNALayer, ILayer)
    pLayer.Name = sName

    'ネットワーク解析レイヤを返す
    Return pNALayer
End Function