NavigationMapRoute

open class NavigationMapRoute : LifecycleObserver

Provide a route using addRoutes and a route will be drawn using runtime styling. The route will automatically be placed below all labels independent of specific style. If the map styles changed when a routes drawn on the map, the route will automatically be redrawn onto the new map style.

You are given the option when first constructing an instance of this class to pass in a style resource. This allows for custom colorizing and line scaling of the route. Inside your applications {@code style.xml} file, you extend {@code

Constructors

NavigationMapRoute
Link copied to clipboard
@TestOnly()
open fun NavigationMapRoute(navigation: MapboxNavigation, mapView: MapView, mapboxMap: MapboxMap, lifecycleOwner: LifecycleOwner, styleRes: Int, belowLayer: String, mapClickListener: MapRouteClickListener, didFinishLoadingStyleListener: MapView.OnDidFinishLoadingStyleListener, progressChangeListener: MapRouteProgressChangeListener)
NavigationMapRoute
Link copied to clipboard
@TestOnly()
open fun NavigationMapRoute(navigation: MapboxNavigation, mapView: MapView, mapboxMap: MapboxMap, lifecycleOwner: LifecycleOwner, styleRes: Int, belowLayer: String, mapClickListener: MapRouteClickListener, didFinishLoadingStyleListener: MapView.OnDidFinishLoadingStyleListener, progressChangeListener: MapRouteProgressChangeListener, routeLine: MapRouteLine, routeArrow: MapRouteArrow)

Types

Builder
Link copied to clipboard
open class Builder
The Builder of NavigationMapRoute.

Functions

addIdentifiableRoute
Link copied to clipboard
open fun addIdentifiableRoute(directionsRoute: IdentifiableRoute)
addIdentifiableRoutes
Link copied to clipboard
open fun addIdentifiableRoutes(directionsRoutes: List<IdentifiableRoute>)
addProgressChangeListener
Link copied to clipboard
open fun addProgressChangeListener(navigation: MapboxNavigation)
This method will allow this class to listen to route progress and adapt the route linewhenever STARTED.In order to use the vanishing route line feature be sure to enable the feature beforecalling this method.
addRoute
Link copied to clipboard
open fun addRoute(directionsRoute: DirectionsRoute)
Allows adding a single primary route for the user to traverse along.
addRoutes
Link copied to clipboard
open fun addRoutes(directionsRoutes: List<out DirectionsRoute>)
Provide a list of DirectionsRoutes, the primary route will default to the first routein the directions route list.
onNewRouteProgress
Link copied to clipboard
open fun onNewRouteProgress(routeProgress: RouteProgress)
Can be used to manually update the route progress.
removeProgressChangeListener
Link copied to clipboard
open fun removeProgressChangeListener(navigation: MapboxNavigation)
Should be called if addProgressChangeListener wascalled to prevent leaking.
setOnRouteSelectionChangeListener
Link copied to clipboard
open fun setOnRouteSelectionChangeListener(onRouteSelectionChangeListener: OnRouteSelectionChangeListener)
Add a OnRouteSelectionChangeListener to know which route the user has currentlyselected as their primary route.
showAlternativeRoutes
Link copied to clipboard
open fun showAlternativeRoutes(alternativesVisible: Boolean)
Toggle whether or not you'd like the map to display the alternative routes.
updateRouteArrowVisibilityTo
Link copied to clipboard
open fun updateRouteArrowVisibilityTo(isVisible: Boolean)
Hides the progress arrow on the map drawn by this class.
updateRouteVisibilityTo
Link copied to clipboard
open fun updateRouteVisibilityTo(isVisible: Boolean)
Hides all routes on the map drawn by this class.

Properties

vanishRouteLineEnabled
Link copied to clipboard
private open var vanishRouteLineEnabled: Boolean