Share via


SegmentPreference Enumeration

SegmentPreference Enumeration

The possible travel preferences for a particular route segment.

 Public Enum SegmentPreference Inherits System.Enum

[C#]

public enum SegmentPreference : System.Enum

Members

The following table lists the values for the SegmentPreference enumeration.

Name Description
Quickest

Minimum travel time; the segment is calculated as the fastest route based on posted speed limits.

Shortest

Minimum travel distance; the segment is calculated as the shortest route based on distance regardless of speed limits.

PreferredRoads

The segment is calculated based on the road type preferences entered by the user.

Remarks

Example

[Visual Basic]

'Calculate the shortest route and print instructions
Dim latLongs(1) As LatLong
latLongs(0) = New LatLong()
latLongs(0).Latitude = 40
latLongs(0).Longitude = -120
latLongs(1) = New LatLong()
latLongs(1).Latitude = 41
latLongs(1).Longitude = -121

Dim myRoute As Route
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Shortest)

Dim i As Integer
For i = 0 To myRoute.Itinerary.Segments(0).Directions.Length - 1
 Console.WriteLine(myRoute.Itinerary.Segments(0).Directions(i).Instruction)
Next i



[C#]

//Calculate the shortest route and print instructions 
LatLong[] latLongs = new LatLong[2];
latLongs[0] = new LatLong();
latLongs[0].Latitude = 40;
latLongs[0].Longitude = -120;
latLongs[1] = new LatLong();
latLongs[1].Latitude = 41;
latLongs[1].Longitude = -121;

Route myRoute;
myRoute = routeService.CalculateSimpleRoute(latLongs, "MapPoint.NA", SegmentPreference.Shortest);

for(int i = 0; i < myRoute.Itinerary.Segments[0].Directions.Length ; i++)
{
 Console.WriteLine(myRoute.Itinerary.Segments[0].Directions[i].Instruction);
}


See Also

  SegmentOptions.Preference Property