MapboxRouteLineView

class MapboxRouteLineView

Responsible for rendering side effects produced by the MapboxRouteLineApi. The MapboxRouteLineApi class consumes route data from the Navigation SDK and produces the data necessary to visualize one or more routes on the map. This class renders the data from the MapboxRouteLineApi by calling the appropriate map related commands so that the map can have an appearance that is consistent with the state of the navigation SDK and the application.

Each Layer added to the map by this class is a persistent layer - it will survive style changes. This means that if the data has not changed, it does not have to be manually redrawn after a style change. See Style.addPersistentStyleLayer.

Many of the method calls execute tasks on a background thread. A cancel method is provided in this class which will cancel the background tasks.

If you're recreating the MapboxRouteLineView instance, for example to change the MapboxRouteLineOptions, make sure that your first interaction restores the state and re-applies the options by calling MapboxRouteLineApi.getRouteDrawData and passing the result to MapboxRouteLineView.renderRouteDrawDataInternal.

Parameters

options

Resource options used rendering the route line on the map

Constructors

Link copied to clipboard
fun MapboxRouteLineView(options: MapboxRouteLineOptions)

Creates MapboxRouteLineView instance.

Functions

Link copied to clipboard
fun cancel()

Cancels any/all background tasks that may be running.

Link copied to clipboard
fun getAlternativeRoutesVisibility(style: Style): Visibility?

Returns the visibility of the alternative route(s) map layer.

Link copied to clipboard
fun getPrimaryRouteVisibility(style: Style): Visibility?

Returns the visibility of the primary route map layer.

Link copied to clipboard
fun getTrafficVisibility(style: Style): Visibility?

Returns the visibility of the primary route map traffic layer.

Link copied to clipboard
fun hideAlternativeRoutes(style: Style)

Hides the layers used for the alternative route line(s).

Link copied to clipboard
fun hideOriginAndDestinationPoints(style: Style)

Sets the layer containing the origin and destination icons to not visible.

Link copied to clipboard
fun hidePrimaryRoute(style: Style)

Hides the layers used for the primary route line.

Link copied to clipboard
fun hideTraffic(style: Style)

Hides the layers used for the traffic line(s).

Link copied to clipboard
fun initializeLayers(style: Style)

Initializes the route line related layers. Other calls in this class will initialize the layers if they have not yet been initialized. If you have a use case for initializing the layers in advance of any API calls this method may be used.

Link copied to clipboard
fun renderClearRouteLineValue(style: Style, clearRouteLineValue: Expected<RouteLineError, RouteLineClearValue>)

Applies side effects related to clearing the route(s) from the map.

fun renderClearRouteLineValue(    style: Style,     clearRouteLineValue: Expected<RouteLineError, RouteLineClearValue>,     map: MapboxMap,     callback: RoutesRenderedCallback)

Applies side effects related to the vanishing route line feature.

Link copied to clipboard
fun renderRouteDrawData(style: Style, routeDrawData: Expected<RouteLineError, RouteSetValue>)
fun renderRouteDrawData(    style: Style,     routeDrawData: Expected<RouteLineError, RouteSetValue>,     map: MapboxMap,     callback: RoutesRenderedCallback)

Applies drawing related side effects.

Link copied to clipboard
fun renderRouteLineUpdate(style: Style, update: Expected<RouteLineError, RouteLineUpdateValue>)

Applies side effects related to the vanishing route line feature.

Link copied to clipboard
fun showAlternativeRoutes(style: Style)

Shows the layers used for the alternative route line(s).

Link copied to clipboard
fun showOriginAndDestinationPoints(style: Style)

Sets the layer containing the origin and destination icons to visible.

Link copied to clipboard
fun showPrimaryRoute(style: Style)

Shows the layers used for the primary route line.

Link copied to clipboard
fun showTraffic(style: Style)

Shows the layers used for the traffic line(s).

Properties

Link copied to clipboard
val options: MapboxRouteLineOptions