MapboxRouteLineApiExtensions

object MapboxRouteLineApiExtensions

Extension functions for MapboxRouteLineApi calls that are implemented as callbacks. This offers an alternative to those callbacks by providing Kotlin oriented suspend functions.

Functions

Link copied to clipboard
suspend fun MapboxRouteLineApi.clearRouteLine(): Expected<RouteLineError, RouteLineClearValue>

Clears the route line data.

Link copied to clipboard
suspend fun MapboxRouteLineApi.findClosestRoute(    target: Point,     mapboxMap: MapboxMap,     padding: Float): Expected<RouteNotFound, ClosestRouteValue>

The map will be queried for a route line feature at the target point or a bounding box centered at the target point with a padding value determining the box's size. If a route feature is found the index of that route in this class's route collection is returned. The primary route is given precedence if more than one route is found.

Link copied to clipboard
suspend fun MapboxRouteLineApi.getRouteDrawData(): Expected<RouteLineError, RouteSetValue>
Link copied to clipboard
fun Expected<RouteLineError, RouteSetValue>.setAlternativeTrafficColor(expression: Expression): Expected<RouteLineError, RouteSetValue>

Overrides the color Expression for the alternative traffic lines with the Expression provided. If the Expected is an error the same Expected object is returned.

fun Expected<RouteLineError, RouteSetValue>.setAlternativeTrafficColor(@ColorInt color: Int): Expected<RouteLineError, RouteSetValue>

Overrides the color Expression for the alternative traffic lines with the color indicated. The entire traffic line will take on the color provided. If the Expected is an error the same Expected object is returned.

Link copied to clipboard
suspend fun MapboxRouteLineApi.setNavigationRouteLines(newRoutes: List<NavigationRouteLine>): Expected<RouteLineError, RouteSetValue>
suspend fun MapboxRouteLineApi.setNavigationRouteLines(newRoutes: List<NavigationRouteLine>, alternativeRoutesMetadata: List<AlternativeRouteMetadata>): Expected<RouteLineError, RouteSetValue>

Sets the routes that will be operated on.

Link copied to clipboard
suspend fun MapboxRouteLineApi.setNavigationRoutes(newRoutes: List<NavigationRoute>): Expected<RouteLineError, RouteSetValue>
suspend fun MapboxRouteLineApi.setNavigationRoutes(newRoutes: List<NavigationRoute>, alternativeRoutesMetadata: List<AlternativeRouteMetadata>): Expected<RouteLineError, RouteSetValue>

Sets the routes that will be operated on.

Link copied to clipboard
fun Expected<RouteLineError, RouteSetValue>.setPrimaryTrafficColor(expression: Expression): Expected<RouteLineError, RouteSetValue>

Overrides the color Expression for the primary traffic line with the Expression provided. If the Expected is an error the same Expected object is returned.

fun Expected<RouteLineError, RouteSetValue>.setPrimaryTrafficColor(@ColorInt color: Int): Expected<RouteLineError, RouteSetValue>

Overrides the color Expression for the primary traffic line with the color indicated. The entire traffic line will take on the color provided. If the Expected is an error the same Expected object is returned.

Link copied to clipboard
suspend fun MapboxRouteLineApi.setRoutes(newRoutes: List<RouteLine>): Expected<RouteLineError, RouteSetValue>

Sets the routes that will be operated on.

Link copied to clipboard
suspend fun MapboxRouteLineApi.showRouteWithLegIndexHighlighted(legIndex: Int): Expected<RouteLineError, RouteLineUpdateValue>

If successful this method returns a RouteLineUpdateValue that when rendered will display the route line with the route leg indicated by the provided leg index highlighted. All the other legs will only show a simple line with RouteLineColorResources.inActiveRouteLegsColor.