public static class MapboxDirectionsMatrix.Builder<T extends MapboxDirectionsMatrix.Builder> extends MapboxBuilder
baseUrl, clientAppName
Constructor and Description |
---|
Builder()
Constructor
|
Modifier and Type | Method and Description |
---|---|
MapboxDirectionsMatrix |
build()
Build method
|
String |
getAccessToken() |
String |
getCoordinates()
The coordinates parameter denotes the points the API will consider happens.
|
String |
getDestinations() |
String |
getProfile() |
String |
getSources() |
String |
getUser() |
T |
setAccessToken(String accessToken)
Required to call when building
MapboxDirectionsMatrix.Builder . |
T |
setBaseUrl(String baseUrl)
Set the base url of the API.
|
T |
setClientAppName(String appName)
Set the App Name to identify
|
T |
setCoordinates(List<com.mapbox.services.commons.models.Position> coordinates)
Set the list of coordinates for the directions matrix service.
|
T |
setDestination(com.mapbox.services.commons.models.Position destination)
Appends the specified destination to the end of the coordinates list.
|
T |
setDestinations(int... destinations)
Optionally pass in indexes to generate an asymmetric matrix.
|
T |
setOrigin(com.mapbox.services.commons.models.Position origin)
Inserts the specified position at the beginning of the coordinates list.
|
T |
setProfile(String profile) |
T |
setSources(int... sources)
Optionally pass in indexes to generate an asymmetric matrix.
|
T |
setUser(String user) |
getBaseUrl, getClientAppName, validateAccessToken
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 setDestinations(int... destinations)
destinations
- 1 or more indexes as a integer, if more then one, separate with a comma.public T setSources(int... sources)
sources
- 1 or more indexes as a integer, if more then one, separate with a comma.public T setOrigin(com.mapbox.services.commons.models.Position origin)
origin
- Position
of route origin.public T setDestination(com.mapbox.services.commons.models.Position destination)
destination
- Position
of route destination.public T setAccessToken(String accessToken)
MapboxDirectionsMatrix.Builder
.setAccessToken
in class MapboxBuilder
accessToken
- Mapbox access token, You must have a Mapbox account inorder to use
this library.public T setBaseUrl(String baseUrl)
MapboxBuilder
setBaseUrl
in class MapboxBuilder
baseUrl
- base url used as end pointpublic T setClientAppName(String appName)
MapboxBuilder
setClientAppName
in class MapboxBuilder
appName
- base package name or other simple string identifierpublic String getDestinations()
public String getSources()
public String getCoordinates()
{longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...]
- Each coordinate is a pair of a longitude double and latitude double, which are separated by a , - Coordinates are separated by a ; from each other - A query must at minimum have 2 coordinates and may at maximum have 25 coordinates
public String getUser()
public String getProfile()
DirectionsCriteria.PROFILE_DRIVING
,
DirectionsCriteria.PROFILE_CYCLING
,
or DirectionsCriteria.PROFILE_WALKING
public String getAccessToken()
getAccessToken
in class MapboxBuilder
public MapboxDirectionsMatrix build() throws ServicesException
build
in class MapboxBuilder
ServicesException
- Generic Exception for all things directions matrix.© 2015–2016 Mapbox. All rights reserved.