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
|
java.lang.String |
getAccessToken() |
java.lang.String[] |
getAnnotation()
Deprecated.
Use
getAnnotations() |
java.lang.String[] |
getAnnotations()
Determine whether or not you are currently requesting additional metadata along the route.
|
java.lang.String |
getBearings()
Determine whether you are filtering the road segment the waypoint will be placed on by direction and dictating
the angle of approach.
|
java.lang.String |
getCoordinates()
Set the list of coordinates for the Optimized Trips service.
|
java.lang.String |
getDestination()
Returned route ends at
DirectionsCriteria.SOURCE_ANY or DirectionsCriteria.SOURCE_LAST
coordinate. |
java.lang.String |
getDistributions()
If distribution values are set inside your request, this will return a String containing the given values.
|
java.lang.String |
getGeometries()
The SDK currently only supports
Polyline geometry (not GeoJSON) to simplify the response. |
java.lang.String |
getLanguage() |
java.lang.String |
getOverview()
Determine whether you want the route geometry to be full, simplified, etc.
|
java.lang.String |
getProfile()
The current profile set for usage with the Optimized Trips API.
|
java.lang.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.
|
java.lang.Boolean |
getRoundTrip()
set whether the route is a roundtrip (route returns to first location).
|
java.lang.String |
getSource()
Returned route starts at
DirectionsCriteria.SOURCE_ANY (default )or
DirectionsCriteria.SOURCE_FIRST coordinate. |
java.lang.Boolean |
getSteps()
Determine whether or not you are requesting for the steps information or not in your request.
|
java.lang.String |
getUser() |
T |
setAccessToken(java.lang.String accessToken)
Required to call when building
MapboxOptimizedTrips.Builder. |
T |
setAnnotation(java.lang.String... annotation)
Deprecated.
use
getAnnotations() instead |
T |
setAnnotations(java.lang.String... annotation)
Whether or not to return additional metadata along the route.
|
T |
setBaseUrl(java.lang.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(java.lang.String appName)
Base package name or other simple string identifier
|
T |
setCoordinates(java.util.List<com.mapbox.services.commons.models.Position> coordinates)
Set the list of coordinates for the Optimized Trips service.
|
T |
setDestination(java.lang.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(java.lang.String geometries)
The SDK currently only supports
Polyline geometry (not GeoJSON) to simplify the response. |
T |
setLanguage(java.lang.String language)
Optionally set the language of returned turn-by-turn text instructions.
|
T |
setOverview(java.lang.String overview)
Optionally, set whether you want the route geometry to be full, simplified, etc.
|
T |
setProfile(java.lang.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(java.lang.Boolean roundTrip)
set whether the route is a roundtrip (route returns to first location).
|
T |
setSource(java.lang.String source)
Returned route starts at
DirectionsCriteria.SOURCE_ANY (default )or
DirectionsCriteria.SOURCE_FIRST coordinate. |
T |
setSteps(java.lang.Boolean steps)
Optionally, call if you'd like to include step information within route.
|
T |
setUser(java.lang.String user) |
getBaseUrl, getClientAppName, validateAccessTokenpublic T setAccessToken(java.lang.String accessToken)
MapboxOptimizedTrips.Builder.setAccessToken in class MapboxBuilderaccessToken - Mapbox access token, You must have a Mapbox account inorder to use
the Optimized Trip API.public T setUser(java.lang.String user)
user - User stringpublic T setProfile(java.lang.String profile)
profile - Profile stringpublic T setCoordinates(java.util.List<com.mapbox.services.commons.models.Position> coordinates)
coordinates - List of Position giving origin and destination(s) coordinates.public T setRoundTrip(java.lang.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(java.lang.String source)
DirectionsCriteria.SOURCE_ANY (default )or
DirectionsCriteria.SOURCE_FIRST coordinate.source - either "any" or "first".public T setDestination(java.lang.String destination)
DirectionsCriteria.SOURCE_ANY or DirectionsCriteria.SOURCE_LAST
coordinate.destination - either "any" or "last".public T setGeometries(java.lang.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(java.lang.String overview)
overview - String defining type of overview you'd like the API to give. Use one of
the constants.public T setSteps(java.lang.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(java.lang.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(java.lang.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(java.lang.String baseUrl)
setBaseUrl in class MapboxBuilderbaseUrl - base url used as end pointpublic T setClientAppName(java.lang.String appName)
setClientAppName in class MapboxBuilderappName - base package name or other simple string identifierpublic T setLanguage(java.lang.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 java.lang.String getProfile()
DirectionsCriteria.PROFILE_DRIVING,
DirectionsCriteria.PROFILE_CYCLING,
or DirectionsCriteria.PROFILE_WALKINGpublic java.lang.Boolean getRoundTrip()
setSource(String) and
setDestination(String).MapboxOptimizedTrips has been set to have the route return to original position,
else false.public java.lang.String getSource()
DirectionsCriteria.SOURCE_ANY (default )or
DirectionsCriteria.SOURCE_FIRST coordinate."any" or "first".public java.lang.String getDestination()
DirectionsCriteria.SOURCE_ANY or DirectionsCriteria.SOURCE_LAST
coordinate."any" or "last".public java.lang.String getCoordinates()
Position giving origin and destination(s) coordinates.public java.lang.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 java.lang.String getRadiuses()
public java.lang.String getUser()
public java.lang.String getOverview()
public java.lang.Boolean getSteps()
public java.lang.String getBearings()
@Deprecated public java.lang.String[] getAnnotation()
getAnnotations()DirectionsCriteria.ANNOTATION_DISTANCE, DirectionsCriteria.ANNOTATION_DURATION, and
DirectionsCriteria.ANNOTATION_SPEED. Several annotations can be used by separating them with ,.public java.lang.String[] getAnnotations()
DirectionsCriteria.ANNOTATION_DISTANCE, DirectionsCriteria.ANNOTATION_DURATION, and
DirectionsCriteria.ANNOTATION_SPEED. Several annotations can be used by separating them with ,.public java.lang.String getAccessToken()
getAccessToken in class MapboxBuilderpublic java.lang.String getLanguage()
public java.lang.String getDistributions()
public MapboxOptimizedTrips build() throws ServicesException
build in class MapboxBuilderMapboxOptimizedTripsServicesException - occurs if your request you've built isn't valid and/or contains errors.