public class DirectionsApiRequest
extends java.lang.Object
PendingResult.Callback<T>| Modifier and Type | Field and Description |
|---|---|
protected boolean |
optimizeWaypoints |
protected java.lang.String[] |
waypoints |
| Modifier and Type | Method and Description |
|---|---|
DirectionsApiRequest |
alternatives(boolean alternateRoutes)
If set to true, specifies that the Directions service may provide more than one route
alternative in the response.
|
DirectionsApiRequest |
arrivalTime(org.joda.time.ReadableInstant time)
Set the arrival time for a Transit directions request.
|
DirectionsApiRequest |
avoid(DirectionsApi.RouteRestriction... restrictions)
Indicates that the calculated route(s) should avoid the indicated features.
|
T |
await()
Performs the request synchronously.
|
T |
awaitIgnoreError()
Performs the request synchronously, ignoring exceptions while performing the request and errors
returned by the server.
|
void |
cancel()
Attempts to cancel the request.
|
A |
channel(java.lang.String channel)
A channel to pass with the request.
|
A |
custom(java.lang.String parameter,
java.lang.String value)
Custom parameter.
|
DirectionsApiRequest |
departureTime(org.joda.time.ReadableInstant time)
Set the departure time for a transit or driving directions request.
|
DirectionsApiRequest |
destination(LatLng destination)
The destination, as a latitude/longitude location.
|
DirectionsApiRequest |
destination(java.lang.String destination)
The address or textual latitude/longitude value from which you wish to calculate directions.
|
A |
language(java.lang.String language)
The language in which to return results.
|
DirectionsApiRequest |
mode(TravelMode mode)
Specifies the mode of transport to use when calculating directions.
|
DirectionsApiRequest |
optimizeWaypoints(boolean optimize)
Allow the Directions service to optimize the provided route by rearranging the waypoints in a
more efficient order.
|
DirectionsApiRequest |
origin(LatLng origin)
The origin, as a latitude/longitude location.
|
DirectionsApiRequest |
origin(java.lang.String origin)
The address or textual latitude/longitude value from which you wish to calculate directions.
|
protected A |
param(java.lang.String key,
java.lang.String val) |
protected A |
param(java.lang.String key,
com.google.maps.internal.StringJoin.UrlValue val) |
protected java.util.Map<java.lang.String,java.lang.String> |
params() |
DirectionsApiRequest |
region(java.lang.String region) |
void |
setCallback(PendingResult.Callback<T> callback)
|
DirectionsApiRequest |
trafficModel(TrafficModel trafficModel)
Specifies the traffic model to use when requesting future driving directions.
|
DirectionsApiRequest |
transitMode(TransitMode... transitModes)
Specifies one or more preferred modes of transit.
|
DirectionsApiRequest |
transitRoutingPreference(TransitRoutingPreference pref)
Specifies preferences for transit requests.
|
DirectionsApiRequest |
units(Unit units)
Specifies the unit system to use when displaying results.
|
protected void |
validateRequest() |
DirectionsApiRequest |
waypoints(LatLng... waypoints)
The list of waypoints as latitude/longitude locations.
|
DirectionsApiRequest |
waypoints(java.lang.String... waypoints)
Specifies a list of waypoints.
|
protected boolean optimizeWaypoints
protected java.lang.String[] waypoints
protected void validateRequest()
public DirectionsApiRequest origin(java.lang.String origin)
origin - The starting location for the Directions request.DirectionsApiRequest for call chaining.public DirectionsApiRequest destination(java.lang.String destination)
destination - The ending location for the Directions request.DirectionsApiRequest for call chaining.public DirectionsApiRequest origin(LatLng origin)
origin - The starting location for the Directions request.DirectionsApiRequest for call chaining.public DirectionsApiRequest destination(LatLng destination)
destination - The ending location for the Directions request.DirectionsApiRequest for call chaining.public DirectionsApiRequest mode(TravelMode mode)
TRANSIT you must also specify
either a departureTime or an arrivalTime.mode - The travel mode to request directions for.DirectionsApiRequest for call chaining.public DirectionsApiRequest avoid(DirectionsApi.RouteRestriction... restrictions)
restrictions - one or more of DirectionsApi.RouteRestriction.TOLLS, DirectionsApi.RouteRestriction.HIGHWAYS, DirectionsApi.RouteRestriction.FERRIESDirectionsApiRequest for call chaining.public DirectionsApiRequest units(Unit units)
units - The preferred units for displaying distances.DirectionsApiRequest for call chaining.public DirectionsApiRequest region(java.lang.String region)
region - The region code, specified as a ccTLD ("top-level domain") two-character value.DirectionsApiRequest for call chaining.public DirectionsApiRequest arrivalTime(org.joda.time.ReadableInstant time)
time - The arrival time to calculate directions for.DirectionsApiRequest for call chaining.public DirectionsApiRequest departureTime(org.joda.time.ReadableInstant time)
time - The departure time to calculate directions for.DirectionsApiRequest for call chaining.public DirectionsApiRequest waypoints(java.lang.String... waypoints)
For more information on waypoints, see Using Waypoints in Routes.
waypoints - The waypoints to add to this directions request.DirectionsApiRequest for call chaining.public DirectionsApiRequest waypoints(LatLng... waypoints)
waypoints - The waypoints to add to this directions request.DirectionsApiRequest for call chaining.public DirectionsApiRequest optimizeWaypoints(boolean optimize)
optimize - Whether to optimize waypoints.DirectionsApiRequest for call chaining.public DirectionsApiRequest alternatives(boolean alternateRoutes)
alternateRoutes - whether to return alternate routes.DirectionsApiRequest for call chaining.public DirectionsApiRequest transitMode(TransitMode... transitModes)
transitModes - The preferred transit modes.DirectionsApiRequest for call chaining.public DirectionsApiRequest transitRoutingPreference(TransitRoutingPreference pref)
pref - The transit routing preferences for this request.DirectionsApiRequest for call chaining.public DirectionsApiRequest trafficModel(TrafficModel trafficModel)
trafficModel - The traffic model for estimating driving time.DirectionsApiRequest for call chaining.public final void setCallback(PendingResult.Callback<T> callback)
PendingResultonResult or onFailure after the request has been
completed.setCallback in interface PendingResult<T>callback - The callback to call on completion.public final T await()
throws ApiException,
java.lang.InterruptedException,
java.io.IOException
PendingResultawait in interface PendingResult<T>ApiException - Thrown if the API Returned result is an error.java.lang.InterruptedException - Thrown when a thread is waiting, sleeping, or otherwise occupied,
and the thread is interrupted.java.io.IOException - Thrown when an I/O exception of some sort has occurred.public final T awaitIgnoreError()
PendingResultawaitIgnoreError in interface PendingResult<T>public final void cancel()
PendingResultcancel in interface PendingResult<T>protected A param(java.lang.String key,
java.lang.String val)
protected A param(java.lang.String key,
com.google.maps.internal.StringJoin.UrlValue val)
protected java.util.Map<java.lang.String,java.lang.String> params()
public final A language(java.lang.String language)
language - The language code, e.g. "en-AU" or "es".public A channel(java.lang.String channel)
channel - String to pass with the request for analytics.public A custom(java.lang.String parameter,
java.lang.String value)
parameter - The name of the custom parameter.value - The value of the custom parameter.