Network Toolbar

Last Modified:4/17/2001

The Utility Network Analyst toolbar was originally written in VB, before being converted to C++ to be consistent with the other tools in the code set. The Network Toolbar sample is the original code with some modifications to bring up to speed with the 8.1 components. The purpose of this code is to expose some of the network analysis functionality available through ArcObjects. The code consists of a toolbar, a pulldown menu for saving and loading flags and barriers and setting options, a set of tools for specifying flags and barriers, and a combo box containing the list of available trace tasks. The code is separated into two separate dlls, one that contains the COM interfaces, and another that implements these interfaces to create the toolbar. The combo box of trace tasks is extensible, so additional trace tasks can be created and added to the list.

This code demonstrates:

As mentioned previously, there are multiple VB projects involved:

How to use:
  1. Register the NetSolversInt and NetworkSolvers DLLs on your machine.
  2. Execute the TraceRegisterPrj exe to register all of the components. Run categories.exe from ..\arcexe83\bin and make sure a "Developer Sample Trace Tasks" category was created and populated.
  3. Start an ArcMap session and add feature classes that participate in a geometric network.
  4. Use the customize dialog in ArcMap to add the Network toolbar. The tools on the toolbar will be enabled if you have network feature classes in the map.
  5. Select the "Add junction flag" or "Add edge flag" tools (second and third tools on the toolbar) and add the appropriate flag to the network.
  6. Browse the Trace task list and choose a task to perform. Select "Find Connected" if your network is not too large. Find Connected is the only task that does not require flow direction to be established. (Flow direction can be set using the Utility Network Analysis toolbar.) Once you select a task, choose the "Trace Flow Solver" command to execute the task. When the task has completed, the results will be displayed. The display color is based on the default Selection color and can be changed through the Options dialog under the Selection pulldown on the main toolbar. The results of your trace will persist until you select one of the "clear" traces commands on the toolbar.


Requires: Network feature classes.

Difficulty: Advanced

Visual Basic
File Description
frmProperties.frm Form for setting the properties used during traces.
frmResources.frm Form containing all the command button icons.
Utils.bas Basic module for defining all of the global variable used by the application. Also contains the basic routines used by the application.
ClearBarriersTool.cls Command class for clearing any assigned barriers.
ClearFlags.cls Command class for clearing any assigned flags.
clsBarriers.cls Custom class for holding on to barrier definitions before converting them to INetElementBarriers objects.
clsEdgeFlag.cls Custom class for holding on to edge flag definitions before converting them to IEdgeFlag objects.
clsGeomNetwork.cls Custom class for holding the different geometric networks represented by the layers the map.
clsJunctionFlag.cls Custom class for holding on to junction flag definitions before converting them to IJunctionFlag objects.
clsNetworkLayer.cls Custom class for storing the Feature Class ID and isolation setting for the layers in the current network
clsNetworks.cls Custom Collection class for holding the set of Networks in the current map.
clsTraceResults.cls Custom class for storing a collection of trace results.
clsFindAncestors.cls Trace task for finding the common ancestors from two of more flags.
clsFindConnected.cls Trace task for finding the connected features from the current set of flags.
clsFindLoops.cls Trace task for finding the features with indeterminate flow (features that can be reached from more than one direction.
clsFlagsAndBarriers.cls Class containing the tools for adding new flags and barriers.
clsNetworkMenu.cls Class that creates the dropdown list of options on the network menu.
clsNetworkPullDown.cls Class containing the Flag and Barrier save and restore options, and the command for converting trace results into a selection set.
clsProperties.cls Command for displaying the properties dialog for the toolbar.
clsTraceCombo.cls Class containing the combo box of trace tasks for the toolbar.
clsTraceDownstream.cls Trace task for finding all of the features downstream from the current set of flags.
clsTraceSelectTool.cls Class containing the commands for solving a trace, removing the last trace from saved collection, and removing all traces from the saved collection.
clsTraceSolver.cls Main class for the network toolbar. Implements IExtension and the interfaces developed specifically for this toolbar.
clsTraceTools.cls Class for generating the network.
clsTraceUpstream.cls Trace task for finding upstream elements from the selected flags.

Key CoClasses: Editor
Key Interfaces: INetSolver, ITraceFlowSolver, INetFlag, IEdgeFlag, IJunctionFlag, INetElementBarriers
Key Members: INetSolver::ElementBarriers, NetSolver::DisableElementClass, ITraceSolver::PutEdgeOrigins, ITraceSolver::PutJunctionOrigins, ITraceFlowSolver::FindFlowElements