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 GET request synchronously.
|
T |
awaitIgnoreError()
Performs the request synchronously, ignoring exceptions while performing the request and errors
returned by the server.
|
void |
cancel()
Attempt 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)
Performs the request asynchronously, calling onResult or onFailure after the request has been
completed.
|
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)
public DirectionsApiRequest destination(java.lang.String destination)
public DirectionsApiRequest origin(LatLng origin)
public DirectionsApiRequest destination(LatLng destination)
public DirectionsApiRequest mode(TravelMode mode)
TRANSIT
you must also specify
either a departureTime
or an arrivalTime
.mode
- The travel mode to request directions for.public DirectionsApiRequest avoid(DirectionsApi.RouteRestriction... restrictions)
restrictions
- one or more of DirectionsApi.RouteRestriction.TOLLS
, DirectionsApi.RouteRestriction.HIGHWAYS
, DirectionsApi.RouteRestriction.FERRIES
public DirectionsApiRequest units(Unit units)
public DirectionsApiRequest region(java.lang.String region)
region
- The region code, specified as a ccTLD ("top-level domain") two-character value.public DirectionsApiRequest arrivalTime(org.joda.time.ReadableInstant time)
time
- The arrival time to calculate directions for.public DirectionsApiRequest departureTime(org.joda.time.ReadableInstant time)
time
- The departure time to calculate directions for.public DirectionsApiRequest waypoints(java.lang.String... waypoints)
For more information on waypoints, see Using Waypoints in Routes.
public DirectionsApiRequest waypoints(LatLng... waypoints)
public DirectionsApiRequest optimizeWaypoints(boolean optimize)
public DirectionsApiRequest alternatives(boolean alternateRoutes)
public DirectionsApiRequest transitMode(TransitMode... transitModes)
public DirectionsApiRequest transitRoutingPreference(TransitRoutingPreference pref)
public DirectionsApiRequest trafficModel(TrafficModel trafficModel)
public final void setCallback(PendingResult.Callback<T> callback)
PendingResult
setCallback
in interface PendingResult<T>
public final T await() throws ApiException, java.lang.InterruptedException, java.io.IOException
PendingResult
await
in interface PendingResult<T>
ApiException
java.lang.InterruptedException
java.io.IOException
public final T awaitIgnoreError()
PendingResult
awaitIgnoreError
in interface PendingResult<T>
public final void cancel()
PendingResult
cancel
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 analyticspublic A custom(java.lang.String parameter, java.lang.String value)