This document is archived and information here might be outdated.  Recommended version.


NetworkAnalystUI (ArcObjects .NET 10.5 SDK)

NetworkAnalystUI


Supported with:
  • ArcGIS for Desktop Basic with Network Analyst
  • ArcGIS for Desktop Standard with Network Analyst
  • ArcGIS for Desktop Advanced with Network Analyst
Library dependencies: Version, System, SystemUI, Geometry, GraphicsCore, Display, Server, Output, Geodatabase, GISClient, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, DataSourcesNetCDF, GeoDatabaseDistributed, GeoDatabaseExtensions, Carto, NetworkAnalysis, Location, GeoAnalyst, Animation, Maplex, Geoprocessing, NetworkAnalyst, Schematic, SpatialAnalyst, 3DAnalyst, GlobeCore, EngineCore, TrackingAnalyst, Framework, Desktop.Addins, GeoDatabaseUI, DisplayUI, OutputUI, Search, Catalog, CatalogUI, CartoUI, DataSourcesRasterUI, ArcCatalog, ArcCatalogUI, ArcMap, ArcMapUI, AnimationUI, Editor, GeoReferenceUI, EditorExt, LocationUI, GeoDatabaseDistributedUI, GeoprocessingUI, OutputExtensions, OutputExtensionsUI, ArcScan

Additional library information: Contents, Object Model Diagram

The NetworkAnalystUI library provides objects for working with the ArcGIS Network Analyst extension extension in ArcMap, such as NetworkAnalystExtension and NAWindow. This library defines a few geoprocessing objects as well.
It is not common for developers to extend this library.

See the following sections for more information about this namespace:

NetworkAnalystExtension

In ArcMap, there is an application extension object provided for the ArcGIS Network Analyst extension called NetworkAnalystExtension. Its primary interface is INetworkAnalystExtension. Use this interface to find the currently selected network dataset and to access NAWindow.
The following code example shows how to use the NetworkAnalystExtension object to get NetworkLayer and NAWindow:
[C#]
public INetworkLayer GetCurrentNetworkLayer(IApplication app)
{
    INetworkAnalystExtension networkAnalystExtension;
    networkAnalystExtension=app.FindExtensionByName("Network Analyst")as
        INetworkAnalystExtension;
    return networkAnalystExtension.CurrentNetworkLayer;
}

public INAWindow GetNAWindow(IApplication app)
{
    INetworkAnalystExtension networkAnalystExtension;
    networkAnalystExtension=app.FindExtensionByName("Network Analyst")as
        INetworkAnalystExtension;
    return networkAnalystExtension.NAWindow;
}
[VB.NET]
Public Function GetCurrentNetworkLayer(ByVal app As IApplication) As INetworkLayer
    Dim networkAnalystExtension As INetworkAnalystExtension
    networkAnalystExtension=app.FindExtensionByName("Network Analyst")
    Return networkAnalystExtension.CurrentNetworkLayer
End Function

Public Function GetNAWindow(ByVal app As IApplication) As INAWindow
    Dim networkAnalystExtension As INetworkAnalystExtension
    networkAnalystExtension=app.FindExtensionByName("Network Analyst")
    Return networkAnalystExtension.NAWindow
End Function

NAWindow

The NAWindow object is used to manage network analysis layers and to manipulate network location objects in ArcMap. Its main interface, INAWindow, allows access to things such as the current analysis layer, the selected category, and the selected items. It also exposes methods—StartOperation, StopOperation, and AbortOperation—that manage editing transactions on network analysis classes within an ArcMap undo/redo operation.
The following code example shows how to use the NALayer object to get the active network analysis layer:
[C#]
public INALayer GetActiveNetworkAnalysisLayer(IApplication app)
{
    INetworkAnalystExtension networkAnalystExtension;
    networkAnalystExtension=app.FindExtensionByName("Network Analyst")as
        INetworkAnalystExtension;
    return networkAnalystExtension.NAWindow.ActiveAnalysis;
}
[VB.NET]
Public Function GetActiveNetworkAnalysisLayer(ByVal app As IApplication) As INALayer
    Dim networkAnalystExtension As INetworkAnalystExtension
    networkAnalystExtension=app.FindExtensionByName("Network Analyst")
    Return networkAnalystExtension.NAWindow.ActiveAnalysis
End Function

Geoprocessing

The following IMDElementCtrl geoprocessing objects are defined in the NetworkAnalystUI library:

See Also:

Sample: Add a traversal result to the map
Sample: ArcGIS Network Analyst extension Engine application
Sample: Export any network analysis class to a text file
How to set up a ArcGIS Network Analyst extension solve to work with the undo/redo stack