This document is archived and information here might be outdated. Recommended version. |
Prepare the context for analysis based upon the current network dataset schema.
[Visual Basic .NET] Public Sub Bind ( _ ByVal pNetworkDataset As INetworkDataset, _ ByVal pGPMessages As IGPMessages _ )
[C#] public void Bind ( INetworkDataset pNetworkDataset, IGPMessages pGPMessages );
[C++]
HRESULT Bind(
INetworkDataset* pNetworkDataset,
IGPMessages* pGPMessages
);
[C++]
Parameters pNetworkDataset [in]
pNetworkDataset is a parameter of type INetworkDataset* pGPMessages [in]
pGPMessages is a parameter of type IGPMessages*
Bind attaches the NAContext to the input NetworkDataset. This ensures the NAContext is properly initialized based on the network dataset specified.
You must call Bind after calling CreateContext on NASolver.
This illustrates how you can create a new NAContext and bind the NetworkDataset to it.
public INAContext CreateContextAndBindToNetworkDataset(INetworkDataset networkDataset)
{
INASolver naSolver=new NARouteSolver() as INASolver;
IDENetworkDataset deNetworkDataset=((IDatasetComponent)networkDataset).DataElement as IDENetworkDataset;
INAContext context=naSolver.CreateContext(deNetworkDataset, naSolver.DisplayName) as INAContext;
INAContextEdit contextEdit=(INAContextEdit)context;
contextEdit.Bind(networkDataset, new GPMessagesClass());
return context;
}