Share via


DirectionAction Enumeration

DirectionAction Enumeration

The possible actions used in a single line in a route itinerary.

Public Enum DirectionAction Inherits System.Enum

[C#]
public enum DirectionAction : System.Enum

Members

The following table lists the values for the DirectionAction enumeration.

Name Description
Other

Other action.

Depart

Depart from a waypoint.

Arrive

Arrive at a waypoint.

TurnLeft

Turn left.

TurnRight

Turn right.

BearLeft

Bear left.

BearRight

Bear right.

Merge

Merge onto a highway or motorway, or limited-access road.

Continue

Continue traveling in the same direction as in the previous instruction.

TurnBack

Turn back to travel in the opposite direction as the previous direction.

TakeRoundabout

Take a roundabout.

ConstructionDelay

A warning indicating that delays can be expected because of construction.

ConstructionStop

A warning indicating that stops or road closures can be expected because of road construction.

NameChange

A warning indicating that the name of the road changes.

LeftLeft

Turn or bear left, and then immediately turn or bear left.

LeftRight

Turn or bear left, and then immediately turn or bear right.

RightLeft

Turn or bear right, and then immediately turn or bear left.

RightRight

Turn or bear right, and then immediately turn or bear right.

TakeRamp

Take a ramp.

TakeRampLeft

Take a ramp to the left.

TakeRampRight

Take a ramp to the right.

KeepStraight

Continue straight when faced with multiple options.

KeepLeft

Stay to the left when faced with multiple options.

KeepRight

Stay to the right when faced with multiple options.

Remarks

  • The DirectionAction enumeration is used with the Direction.Action property.

  • The Waypoint.Name property allows you to define names for waypoints, which appear in the Depart and Arrive lines of the itinerary.

  • If the Direction.DirectionType property value is Warning and the Direction.Action property value is KeepLeft, KeepRight, KeepStraight, TurnLeft, or TurnRight, the road name stays the same.

Example

[Visual Basic]

'Calculate a route and add a note for construction
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.Quickest)

Dim i As Integer
For i = 0 To myRoute.Itinerary.Segments(0).Directions.Length - 1
 If (myRoute.Itinerary.Segments(0).Directions(i).Action = DirectionAction.ConstructionDelay _
  Or myRoute.Itinerary.Segments(0).Directions(i).Action = DirectionAction.ConstructionStop) Then
   Console.WriteLine("Construction ahead!")
 End If
 Console.WriteLine(myRoute.Itinerary.Segments(0).Directions(i).Instruction)
Next i



[C#]

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.Quickest);

for(int i = 0; i < myRoute.Itinerary.Segments[0].Directions.Length ; i++)
{
 if (myRoute.Itinerary.Segments[0].Directions[i].Action == DirectionAction.ConstructionDelay | 
  myRoute.Itinerary.Segments[0].Directions[i].Action == DirectionAction.ConstructionStop) 
 {
  Console.WriteLine("Construction ahead!");
 }
 Console.WriteLine(myRoute.Itinerary.Segments[0].Directions[i].Instruction);
}


See Also

  Direction.Action Property   |   Waypoint.Name Property   |   Direction.DirectionType Property