public class MapboxOfflineRouter extends Object
Constructor and Description |
---|
MapboxOfflineRouter(String offlinePath)
Creates an offline router which uses the specified offline path for storing and retrieving
data.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(String version,
OnOfflineTilesConfiguredCallback callback)
Configures the navigator for getting offline routes.
|
void |
downloadTiles(OfflineTiles offlineTiles,
RouteTileDownloadListener listener)
Starts the download of tiles specified by the provided
OfflineTiles object. |
void |
fetchAvailableTileVersions(String accessToken,
OnTileVersionsFoundCallback callback)
Call this method to fetch the latest available offline tile versions that
can be used with
downloadTiles(OfflineTiles, RouteTileDownloadListener) . |
void |
findRoute(OfflineRoute route,
OnOfflineRouteFoundCallback callback)
Uses libvalhalla and local tile data to generate mapbox-directions-api-like JSON.
|
void |
removeTiles(String version,
com.mapbox.geojson.BoundingBox boundingBox,
OnOfflineTilesRemovedCallback callback)
Removes tiles within / intersected by a bounding box
|
public MapboxOfflineRouter(String offlinePath)
offlinePath
- directory path where the offline data is locatedpublic void configure(String version, OnOfflineTilesConfiguredCallback callback)
version
- version of offline tiles to usecallback
- a callback that will be fired when the offline data is configured and
findRoute(OfflineRoute, OnOfflineRouteFoundCallback)
can be called safelypublic void findRoute(@NonNull OfflineRoute route, OnOfflineRouteFoundCallback callback)
route
- the OfflineRoute
to get a DirectionsRoute
fromcallback
- a callback to pass back the resultpublic void downloadTiles(OfflineTiles offlineTiles, RouteTileDownloadListener listener)
OfflineTiles
object.offlineTiles
- object specifying parameters for the tile requestlistener
- which is updated on error, on progress update and on completionpublic void fetchAvailableTileVersions(String accessToken, OnTileVersionsFoundCallback callback)
downloadTiles(OfflineTiles, RouteTileDownloadListener)
.accessToken
- Mapbox access token to call the version APIcallback
- with the available versionspublic void removeTiles(String version, com.mapbox.geojson.BoundingBox boundingBox, OnOfflineTilesRemovedCallback callback)
Note that calling findRoute(OfflineRoute, OnOfflineRouteFoundCallback)
while
removeTiles(String, BoundingBox, OnOfflineTilesRemovedCallback)
could lead
to undefine behavior
version
- version of offline tiles to useboundingBox
- bounding box within which routing tiles should be removedcallback
- a callback that will be fired when the routing tiles have been removed completely© 2019 Mapbox. All rights reserved.