ArcObjects Library Reference

Statements - Set Route Properties Snippet

Set route solver parameters.

[C#]

//<-- Snippet Start -->
// DESCRIPTION:

// Set route solver parameters, including settings for...
ESRI.ArcGIS.NetworkAnalyst.INARouteSolver2 naRouteSolver = naSolver as ESRI.ArcGIS.NetworkAnalyst.INARouteSolver2;

// ...sequencing
naRouteSolver.FindBestSequence = false;
naRouteSolver.PreserveFirstStop = true;
naRouteSolver.PreserveLastStop = true;

// ...time constraints
naRouteSolver.UseTimeWindows = false;
naRouteSolver.UseStartTime = false;

// Note the default date value used by the solver is (12/30/1899 8:00:00AM). 
// This is the earliest date that any routes can start from.
naRouteSolver.StartTime = new System.DateTime(1899, 12, 30, 8, 0, 0); 

// ...output
naRouteSolver.CreateTraversalResult = true;
naRouteSolver.OutputLines = ESRI.ArcGIS.NetworkAnalyst.esriNAOutputLineType.esriNAOutputLineTrueShape;

//<-- Snippet End -->
[Visual Basic .NET]

'<-- Snippet Start -->
' DESCRIPTION:

' Set route solver parameters, including settings for...
Dim naRouteSolver As ESRI.ArcGIS.NetworkAnalyst.INARouteSolver2 = CType(naSolver, ESRI.ArcGIS.NetworkAnalyst.INARouteSolver2)

' ...sequencing
naRouteSolver.FindBestSequence = False
naRouteSolver.PreserveFirstStop = True
naRouteSolver.PreserveLastStop = True

' ...time constraints
naRouteSolver.UseTimeWindows = False
naRouteSolver.UseStartTime = False

' Note the default date value used by the solver is (12/30/1899 8:00:00AM). 
' This is the earliest date that any routes can start from.
naRouteSolver.StartTime = New System.DateTime(1899, 12, 30, 8, 0, 0)

' ...output
naRouteSolver.CreateTraversalResult = True
naRouteSolver.OutputLines = ESRI.ArcGIS.NetworkAnalyst.esriNAOutputLineType.esriNAOutputLineTrueShape

'<-- Snippet End -->


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.NetworkAnalyst
  • System