This document is archived and information here might be outdated. Recommended version. |
Specifies the ancillary role attribute field for the specified feature class.
[Visual Basic .NET] Public Sub PutAncillaryRole ( _ ByVal featureClassName As String, _ ByVal ancillaryRole As esriNetworkClassAncillaryRole, _ ByVal ancillaryRoleFieldName As String _ )
[C#] public void PutAncillaryRole ( string featureClassName, esriNetworkClassAncillaryRole ancillaryRole, string ancillaryRoleFieldName );
[C++]
HRESULT PutAncillaryRole(
BSTR featureClassName,
esriNetworkClassAncillaryRole ancillaryRole,
BSTR ancillaryRoleFieldName
);
[C++] Parameters featureClassName [in]
featureClassName is a parameter of type BSTR ancillaryRole [in]
ancillaryRole is a parameter of type esriNetworkClassAncillaryRole ancillaryRoleFieldName [in]
ancillaryRoleFieldName is a parameter of type BSTR
The following code demonstrates using the default ancillary role field name and checking the ancillary role field before calling PutAncillaryRole:
INetworkLoaderProps networkLoaderProps = networkLoader2 as INetworkLoaderProps;
string defARFld = networkLoaderProps.DefaultAncillaryRoleField;
esriNetworkLoaderFieldCheck ckFld = networkLoader2.CheckAncillaryRoleField("FeatureClassName", defARFld);
switch (ckFld)
{
case esriNLFCValid:
case esriNLFCNotFound:
pNetworkLoader2.PutAncillaryRole("FeatureClassName", esriNCARSourceSink, sDefARFld);
break;
default:
Console.WriteLine("The field " + defARFld + " could not be used as an ancillary role field.");
return;
break;
}
The following code demonstrates using the default ancillary role field name and checking the ancillary role field before calling PutAncillaryRole:
Dim networkLoaderProps As INetworkLoaderProps = CType(networkLoader2, INetworkLoaderProps)
Dim defARFld As String = networkLoaderProps.DefaultAncillaryRoleField
Dim ckFld As esriNetworkLoaderFieldCheck = networkLoader2.CheckAncillaryRoleField("FeatureClassName", defARFld)
Select Case ckFld
Case esriNLFCValid, esriNLFCNotFound
pNetworkLoader2.PutAncillaryRole("FeatureClassName", esriNCARSourceSink, sDefARFld)
Case Else
Console.WriteLine("The field " & defARFld & " could not be used as an ancillary role field.")
Exit Sub
End Select