Defines the options used by the Navigator
for calculating a route to a destination.
Nested Class Summary
@interface | RoutingOptions.RoutingStrategy | The routing strategy specifies how routes are ranked, which affects the route that is chosen initially, and during re-routing. | |
@interface | RoutingOptions.TravelMode | Specifies the type of transportation used to tailor the directions. |
Public Constructor Summary
Public Method Summary
RoutingOptions |
alternateRoutesStrategy(AlternateRoutesStrategy alternateRoutesOption)
Configures the number of alternate routes to be displayed during navigation.
|
RoutingOptions |
avoidFerries(boolean avoidFerries)
Configures whether to avoid ferries when generating a route to a destination.
|
RoutingOptions |
avoidHighways(boolean avoidHighways)
Configures whether to avoid highways and motorways when generating a route to a destination.
|
RoutingOptions |
avoidTolls(boolean avoidTolls)
Configures whether to avoid toll roads when generating a route to a destination.
|
AlternateRoutesStrategy |
getAlternateRoutesStrategy()
Returns the preferred display strategy for the number of alternate routes that are shown during
navigation.
|
boolean |
getAvoidFerries()
Returns a boolean indicating whether ferries are avoided.
|
boolean |
getAvoidHighways()
Returns a boolean indicating whether highways and motorways are avoided.
|
boolean |
getAvoidTolls()
Returns a boolean indicating whether toll roads are avoided.
|
long |
getLocationTimeoutMs()
Returns the maximum time in milliseconds to wait for a location fix before
Navigator.setDestinations(List fails. |
int | |
List<Integer> | |
int |
getTravelMode()
Returns the type of directions to provide to the user.
|
RoutingOptions |
locationTimeoutMs(long locationTimeoutMs)
Configures the maximum time to wait for a location fix before
Navigator.setDestinations(List
fails with Navigator.RouteStatus.LOCATION_UNKNOWN . |
RoutingOptions |
routingStrategy(int routingStrategy)
Specifies the routing strategy used in navigation.
|
RoutingOptions |
targetDistancesMeters(List<Integer> targetDistancesMeters)
Specifies the target distance (in meters) to each destination, and overrides the routing
strategy with
RoutingOptions.RoutingStrategy.TARGET_DISTANCE . |
RoutingOptions |
travelMode(int travelMode)
Specifies the type of transportation used to determine the navigation directions.
|
Inherited Method Summary
Public Constructors
public RoutingOptions ()
Public Methods
public RoutingOptions alternateRoutesStrategy (AlternateRoutesStrategy alternateRoutesOption)
Configures the number of alternate routes to be displayed during navigation. By default, all available alternate routes are shown.
Parameters
alternateRoutesOption | The preferred display strategy for the number of alternate routes that are shown during navigation. |
---|
Returns
- the object for which the method was called, with the updated alternate route setting.
public RoutingOptions avoidFerries (boolean avoidFerries)
Configures whether to avoid ferries when generating a route to a destination. If the value is not specified, the default value is true.
Parameters
avoidFerries | If true , ferries are avoided. |
---|
Returns
- the object for which the method was called with the updated ferry avoidance setting
public RoutingOptions avoidHighways (boolean avoidHighways)
Configures whether to avoid highways and motorways when generating a route to a destination. If the value is not specified, the default value is false.
Parameters
avoidHighways | If true , highways and motorways are avoided. |
---|
Returns
- the object for which the method was called with the updated highway avoidance setting
public RoutingOptions avoidTolls (boolean avoidTolls)
Configures whether to avoid toll roads when generating a route to a destination. If the value is not specified, the default value is false.
Parameters
avoidTolls | If true , toll roads are avoided. |
---|
Returns
- the object for which the method was called with the updated toll avoidance setting
public AlternateRoutesStrategy getAlternateRoutesStrategy ()
Returns the preferred display strategy for the number of alternate routes that are shown during navigation.
public boolean getAvoidFerries ()
Returns a boolean indicating whether ferries are avoided.
Returns
true
if ferries are avoided
public boolean getAvoidHighways ()
Returns a boolean indicating whether highways and motorways are avoided.
Returns
true
if highways and motorways are avoided
public boolean getAvoidTolls ()
Returns a boolean indicating whether toll roads are avoided.
Returns
true
if toll roads are avoided
public long getLocationTimeoutMs ()
Returns the maximum time in milliseconds to wait for a location fix before Navigator.setDestinations(List
fails. If the value is zero, there is no limit.
Returns
- the maximum time to wait for a location fix
public int getRoutingStrategy ()
public List<Integer> getTargetDistancesMeters ()
public int getTravelMode ()
Returns the type of directions to provide to the user.
public RoutingOptions locationTimeoutMs (long locationTimeoutMs)
Configures the maximum time to wait for a location fix before Navigator.setDestinations(List
fails with Navigator.RouteStatus.LOCATION_UNKNOWN
. A value of zero, the default, will
cause it to wait forever.
Parameters
locationTimeoutMs | The maximum time, in milliseconds, to wait for a location. |
---|
Returns
- the object for which the method was called, with the updated location timeout setting
public RoutingOptions routingStrategy (int routingStrategy)
Specifies the routing strategy used in navigation.
If you set a targetDistancesMeters, and if you set a routing strategy other than RoutingOptions.RoutingStrategy.TARGET_DISTANCE
, then the targetDistance field is cleared. If RoutingOptions.RoutingStrategy.TARGET_DISTANCE
is the desired strategy, then you must set a valid targetDistancesMeters(List
by calling targetDistancesMeters(List)
separately.
Parameters
routingStrategy |
---|
public RoutingOptions targetDistancesMeters (List<Integer> targetDistancesMeters)
Specifies the target distance (in meters) to each destination, and overrides the routing
strategy with RoutingOptions.RoutingStrategy.TARGET_DISTANCE
.
Warning: This is an experimental routing strategy. It is only available for single
destination trips. If you set multiple destinations and/or target distances, then RoutingOptions.RoutingStrategy.TARGET_DISTANCE
is applied to the first destination using the target distance
at index 0 of targetDistancesMeters(List
and RoutingOptions.RoutingStrategy.DEFAULT_BEST
is
applied to the remaining destinations.
Warning: You must not use RoutingOptions.RoutingStrategy.TARGET_DISTANCE
in combination with any
AlternateRoutesStrategy
except the default AlternateRoutesStrategy.SHOW_ALL
. If
you use it in combination with other AlternateRoutesStrategy
s, then suboptimal routes
are calculated.
Parameters
targetDistancesMeters | The non-empty list of positive integers representing one desired
target distance (in meters) for each destination set using Navigator.setDestinations(List . |
---|
Returns
- the object upon which the method was called, with the updated target distances and routing strategy.
public RoutingOptions travelMode (int travelMode)
Specifies the type of transportation used to determine the navigation directions.
Parameters
travelMode |
---|
Returns
- the object for which the method was called with the updated travel mode.