public static class MapboxOptimizedTrips.Builder<T extends MapboxOptimizedTrips.Builder> extends MapboxBuilder
baseUrl, clientAppName
Constructor and Description |
---|
Builder()
Constructor
|
Modifier and Type | Method and Description |
---|---|
MapboxOptimizedTrips |
build()
Build method
|
String |
getAccessToken() |
String[] |
getAnnotation()
Deprecated.
Use
getAnnotations() |
String[] |
getAnnotations()
Determine whether or not you are currently requesting additional metadata along the route.
|
String |
getBearings()
Determine whether you are filtering the road segment the waypoint will be placed on by direction and dictating
the angle of approach.
|
String |
getCoordinates()
Set the list of coordinates for the Optimized Trips service.
|
String |
getDestination()
Returned route ends at
DirectionsCriteria.SOURCE_ANY or DirectionsCriteria.SOURCE_LAST
coordinate. |
String |
getDistributions()
If distribution values are set inside your request, this will return a String containing the given values.
|
String |
getGeometries()
The SDK currently only supports
Polyline geometry (not GeoJSON) to simplify the response. |
String |
getLanguage() |
String |
getOverview()
Determine whether you want the route geometry to be full, simplified, etc.
|
String |
getProfile()
The current profile set for usage with the Optimized Trips API.
|
String |
getRadiuses()
Get the maximum distance in meters you have set that each coordinate is allowed to move when snapped to a nearby
road segment.
|
Boolean |
getRoundTrip()
set whether the route is a roundtrip (route returns to first location).
|
String |
getSource()
Returned route starts at
DirectionsCriteria.SOURCE_ANY (default )or
DirectionsCriteria.SOURCE_FIRST coordinate. |
Boolean |
getSteps()
Determine whether or not you are requesting for the steps information or not in your request.
|
String |
getUser() |
T |
setAccessToken(String accessToken)
Required to call when building
MapboxOptimizedTrips.Builder . |
T |
setAnnotation(String... annotation)
Deprecated.
use
getAnnotations() instead |
T |
setAnnotations(String... annotation)
Whether or not to return additional metadata along the route.
|
T |
setBaseUrl(String baseUrl)
Optionally change the APIs base URL to something other then the default Mapbox one.
|
T |
setBearings(double[]... bearings)
Optionally, Use to filter the road segment the waypoint will be placed on by direction and dictates the angle of
approach.
|
T |
setClientAppName(String appName)
Base package name or other simple string identifier
|
T |
setCoordinates(List<com.mapbox.services.commons.models.Position> coordinates)
Set the list of coordinates for the Optimized Trips service.
|
T |
setDestination(String destination)
Returned route ends at
DirectionsCriteria.SOURCE_ANY or DirectionsCriteria.SOURCE_LAST
coordinate. |
T |
setDistributions(double[]... distributions)
Specify pick-up and drop-off locations for a trip by providing a
double[] each with a number pair that
correspond with the coordinates list. |
T |
setGeometries(String geometries)
The SDK currently only supports
Polyline geometry (not GeoJSON) to simplify the response. |
T |
setLanguage(String language)
Optionally set the language of returned turn-by-turn text instructions.
|
T |
setOverview(String overview)
Optionally, set whether you want the route geometry to be full, simplified, etc.
|
T |
setProfile(String profile) |
T |
setRadiuses(double[] radiuses)
Optionally, set the maximum distance in meters that each coordinate is allowed to move when snapped to a nearby
road segment.
|
T |
setRoundTrip(Boolean roundTrip)
set whether the route is a roundtrip (route returns to first location).
|
T |
setSource(String source)
Returned route starts at
DirectionsCriteria.SOURCE_ANY (default )or
DirectionsCriteria.SOURCE_FIRST coordinate. |
T |
setSteps(Boolean steps)
Optionally, call if you'd like to include step information within route.
|
T |
setUser(String user) |
getBaseUrl, getClientAppName, validateAccessToken
public T setAccessToken(String accessToken)
MapboxOptimizedTrips.Builder
.setAccessToken
in class MapboxBuilder
accessToken
- Mapbox access token, You must have a Mapbox account inorder to use
the Optimized Trip API.public T setProfile(String profile)
profile
- Profile stringpublic T setCoordinates(List<com.mapbox.services.commons.models.Position> coordinates)
coordinates
- List of Position
giving origin and destination(s) coordinates.public T setRoundTrip(Boolean roundTrip)
setSource(String)
and
setDestination(String)
.roundTrip
- boolean true if you'd like the route to return to original position, else false.public T setSource(String source)
DirectionsCriteria.SOURCE_ANY
(default )or
DirectionsCriteria.SOURCE_FIRST
coordinate.source
- either "any" or "first"
.public T setDestination(String destination)
DirectionsCriteria.SOURCE_ANY
or DirectionsCriteria.SOURCE_LAST
coordinate.destination
- either "any" or "last"
.public T setGeometries(String geometries)
Polyline
geometry (not GeoJSON) to simplify the response. You do have
the option on whether the precision is 5 or 6 using either DirectionsCriteria.GEOMETRY_POLYLINE
or
DirectionsCriteria.GEOMETRY_POLYLINE6
.geometries
- A String
constant which equals either "polyline"
or "polyline6"
.public T setRadiuses(double[] radiuses)
Double.POSITIVE_INFINITY
. If no routable road
is found within the radius, a NoSegment
error is returned.radiuses
- double array containing the radiuses defined in unit meters.public T setOverview(String overview)
overview
- String defining type of overview you'd like the API to give. Use one of
the constants.public T setSteps(Boolean steps)
steps
- true if you'd like step information.public T setBearings(double[]... bearings)
setRadiuses(double[])
parameter. The parameter takes two values per
waypoint: the first is an angle clockwise from true north between 0 and 360. The second is the range of degrees
the angle can deviate by. We recommend a value of 45 degrees or 90 degrees for the range, as bearing measurements
tend to be inaccurate. This is useful for making sure we reroute vehicles on new routes that continue traveling
in their current direction. A request that does this would provide bearing and radius values for the first
waypoint and leave the remaining values empty. If provided, the list of bearings must be the same length as the
list of waypoints, but you can skip a coordinate and show its position by passing in a double array with no
values included like so: new double[] {}
.bearings
- a double array with two values indicating the angle and the other value indicating the deviating
range.@Deprecated public T setAnnotation(String... annotation)
getAnnotations()
insteadDirectionsCriteria.ANNOTATION_DISTANCE
, DirectionsCriteria.ANNOTATION_DURATION
, and
DirectionsCriteria.ANNOTATION_SPEED
. Several annotations can be used by separating them with ,
.annotation
- String referencing one of the annotations direction criteria's.public T setAnnotations(String... annotation)
DirectionsCriteria.ANNOTATION_DISTANCE
, DirectionsCriteria.ANNOTATION_DURATION
, and
DirectionsCriteria.ANNOTATION_SPEED
. Several annotations can be used by separating them with ,
.annotation
- String referencing one of the annotations direction criteria's.public T setBaseUrl(String baseUrl)
setBaseUrl
in class MapboxBuilder
baseUrl
- base url used as end pointpublic T setClientAppName(String appName)
setClientAppName
in class MapboxBuilder
appName
- base package name or other simple string identifierpublic T setLanguage(String language)
en
for English.language
- The locale in which results should be returned.public T setDistributions(double[]... distributions)
double[]
each with a number pair that
correspond with the coordinates list. The first number indicates what place the coordinate of the pick-up
location is in the coordinates list, and the second number indicates what place the coordinate of the drop-off
location is in the coordinates list. Each pair must contain exactly two numbers. Pick-up and drop-off locations
in one pair cannot be the same. The returned solution will visit pick-up locations before visiting drop-off
locations. The depot (first location) can only be a pick-up location but not a drop-off location.distributions
- double[]
with two values, first being the pickup coordinate in the coordinates list
and the second number being the coordinate in the coordinates list which should be the drop
off location.public String getProfile()
DirectionsCriteria.PROFILE_DRIVING
,
DirectionsCriteria.PROFILE_CYCLING
,
or DirectionsCriteria.PROFILE_WALKING
public Boolean getRoundTrip()
setSource(String)
and
setDestination(String)
.MapboxOptimizedTrips
has been set to have the route return to original position,
else false.public String getSource()
DirectionsCriteria.SOURCE_ANY
(default )or
DirectionsCriteria.SOURCE_FIRST
coordinate."any" or "first"
.public String getDestination()
DirectionsCriteria.SOURCE_ANY
or DirectionsCriteria.SOURCE_LAST
coordinate."any" or "last"
.public String getCoordinates()
Position
giving origin and destination(s) coordinates.public String getGeometries()
Polyline
geometry (not GeoJSON) to simplify the response. You do have
the option on whether the precision is 5 or 6 using either DirectionsCriteria.GEOMETRY_POLYLINE
or
DirectionsCriteria.GEOMETRY_POLYLINE6
.String
constant which equals either "polyline"
or "polyline6"
.public String getRadiuses()
public String getUser()
public String getOverview()
public Boolean getSteps()
public String getBearings()
@Deprecated public String[] getAnnotation()
getAnnotations()
DirectionsCriteria.ANNOTATION_DISTANCE
, DirectionsCriteria.ANNOTATION_DURATION
, and
DirectionsCriteria.ANNOTATION_SPEED
. Several annotations can be used by separating them with ,
.public String[] getAnnotations()
DirectionsCriteria.ANNOTATION_DISTANCE
, DirectionsCriteria.ANNOTATION_DURATION
, and
DirectionsCriteria.ANNOTATION_SPEED
. Several annotations can be used by separating them with ,
.public String getAccessToken()
getAccessToken
in class MapboxBuilder
public String getLanguage()
public String getDistributions()
public MapboxOptimizedTrips build() throws ServicesException
build
in class MapboxBuilder
MapboxOptimizedTrips
ServicesException
- occurs if your request you've built isn't valid and/or contains errors.© 2015–2016 Mapbox. All rights reserved.