ArcObjects Library Reference (NetworkAnalystUI)  

NetworkAnalystExtension CoClass

The extension for network analysis.

Product Availability

Available with ArcGIS Desktop. Requires Network Analyst Extension.

Interfaces

Interfaces Description
IActiveViewEvents (esriCarto) Provides access to events that occur when the state of the active view changes.
IConnectionPointContainer Supports connection points for connectable objects.
IDocumentEvents (esriArcMapUI) Provides access to events that occur in ArcMap.
IExtension (esriSystem) Provides access to members that define an extension.
IExtensionConfig (esriSystem) Provides access to members that describe an extension.
INALocationEditOptions Provides access to location edit options.
INetworkAnalystExtension Provides access to the network analyst extension.
IPersistStream (esriSystem)

Event Interfaces

Interfaces Description
INetworkAnalystExtensionEvents (default) Provides access to events triggered by the network analysis extension.

Remarks

The NetworkAnalystExtension is an ArcMap application extension that manages the current NetworkLayer and provides access to the NAWindow and the NALayers

There are methods to get

[C#]

This C# example shows three ways of how you can get the Network Analyst Extension.

// Get Network Analyst Extension by name
public INetworkAnalystExtension GetNetworkAnalystExtensionByName(IApplication app)
{
  return app.FindExtensionByName("Network Analyst") as INetworkAnalystExtension;
}
// Get Network Analyst Extension by ProgID
public INetworkAnalystExtension GetNetworkAnalystExtensionByProgID(IApplication app)
{
  UID uid = new UIDClass();
  uid.Value = "esriNetworkAnalystUI.NetworkAnalystExtension";
  return app.FindExtensionByCLSID(uid) as INetworkAnalystExtension;
}
// Get Network Analyst Extension by CLSID
public INetworkAnalystExtension GetNetworkAnalystExtensionByCLSID(IApplication app)
{
  UID uid = new UIDClass();
  uid.Value = "{C967BD39-1118-42EE-AAAB-B31642C89C3E}";
  return app.FindExtensionByCLSID(uid) as INetworkAnalystExtension;
}
[Visual Basic .NET]

This VB.NET example shows three ways of how you can get the Network Analyst Extension.

' Get Network Analyst Extension by name
Public Function GetNetworkAnalystExtensionByName(ByVal app As IApplication) As INetworkAnalystExtension
  Return app.FindExtensionByName("Network Analyst")
End Function
 
' Get Network Analyst Extension by ProgID
Public Function GetNetworkAnalystExtensionByProgID(ByVal app As IApplication) As INetworkAnalystExtension
  Dim uid As UID =  New UID() 
  uid.Value = "esriNetworkAnalystUI.NetworkAnalystExtension"
  Return app.FindExtensionByCLSID(uid)
End Function
 
' Get Network Analyst Extension by CLSID
Public Function GetNetworkAnalystExtensionByCLSID(ByVal app As IApplication) As INetworkAnalystExtension
  Dim uid As UID =  New UID() 
  uid.Value = "{C967BD39-1118-42EE-AAAB-B31642C89C3E}"
  Return app.FindExtensionByCLSID(uid)
End Function

Working with Events

[Visual Basic 6.0]

When working with NetworkAnalystExtension's default outbound interface in Visual Basic 6 declare variables as follows:

Private WithEvents pNetworkAnalystExtension as NetworkAnalystExtension