ArcObjects Library Reference (NetworkAnalyst)  

NAClassLoader CoClass

Loads a network class based on its field maps.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.

Extended Error Information

Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.

Interfaces

Interfaces Description
INAClassLoader Provides access to populate network analysis classes in preparation for analysis.
INAClassLoader2 Provides access to populate network analysis classes in preparation for analysis.
ISupportErrorInfo Indicates whether a specific interface can return Automation error objects.

Remarks

An NAClass is like a feature class with "rows" of network analysis inputs and outputs.  The NAClassLoader uses a specified field mapping (INAClassFieldMap) and a network locator (INALocator) to populate an NAClass.

[C#]
// Load Stops
INAClassFieldMap naClassFieldMap = new NAClassFieldMapClass();
naClassFieldMap.CreateMapping(stopsNAClass.ClassDefinition, inputStopsFClass.Fields);
if (workspace.Type == esriFileSystemWorkspace)
    naClassFieldMap.set_MappedField("Name", SHAPE_INPUT_NAME_FIELD);
else
    naClassFieldMap.set_MappedField("Name", INPUT_NAME_FIELD);
INAClassLoader naLoader = new NAClassLoaderClass();
naLoader.Locator = naContext.Locator;
naLoader.NAClass = stopsNAClass;
naLoader.FieldMap = naClassFieldMap;
  
int rowsIn = 0;
int rowsLocated = 0;
naLoader.Load((ICursor)inputStopsFClass.Search(null, true), new CancelTrackerClass(), ref rowsIn, ref rowsLocated);
[Visual Basic .NET]
' Load Stops
Dim naClassFieldMap As INAClassFieldMap = New NAClassFieldMap() 
naClassFieldMap.CreateMapping(stopsNAClass.ClassDefinition, inputStopsFClass.Fields)
If workspace.Type = esriFileSystemWorkspace Then
    naClassFieldMap.MappedField("Name") = SHAPE_INPUT_NAME_FIELD
Else
    naClassFieldMap.MappedField("Name") = INPUT_NAME_FIELD
End If
 
Dim naLoader As INAClassLoader = New NAClassLoader() 
naLoader.Locator = naContext.Locator
naLoader.NAClass = stopsNAClass
naLoader.FieldMap = naClassFieldMap
 
Dim rowsIn As Integer =  0 
Dim rowsLocated As Integer =  0 
naLoader.Load(inputStopsFClass.Search(Nothing, True), New CancelTracker(),  rowsIn,  rowsLocated)