MapboxRouteShieldApi

class MapboxRouteShieldApi

A class that can be used to request route shields using either BannerComponents.imageBaseUrl or BannerComponents.mapboxShield. The class exposes API(s) that one can invoke to either always use mapbox legacy shields BannerComponents.imageBaseUrl or use mapbox designed shields BannerComponents.mapboxShield. In cases where API is unable to download mapbox designed shields for any reason, the API falls back to download legacy shields if available. Returns error otherwise.

MapboxRouteShieldApi returns route shield with text in the form of a SVG wrapped in a ByteArray. Since this SVG would later have to be converted to vector drawable at runtime for rendering purposes, it is important to note that the API supports most of the SVG features from Tiny SVG 1.2.

Constructors

Link copied to clipboard
fun MapboxRouteShieldApi()

Functions

Link copied to clipboard
fun cancel()

Invoke the function to cancel any job invoked through other APIs

Link copied to clipboard
fun getRouteShields(road: Road, callback: RouteShieldCallback)

Given a Road object, the function requests mapbox legacy road shields (if available) using Road.shieldUrl for the current road.

fun getRouteShields(bannerComponents: List<BannerComponents>?, callback: RouteShieldCallback)

Given a list of BannerComponents the function requests mapbox legacy road shields (if available) using BannerComponents.imageBaseUrl.

fun getRouteShields(    road: Road,     userId: String?,     styleId: String?,     accessToken: String?,     callback: RouteShieldCallback)

Given a Road object, the function requests mapbox designed road shields (if available) using Road.mapboxShield for the current road. If for any reason the API is unable to download the shield, it falls back to download and return the legacy shield if available. Returns error otherwise.

fun getRouteShields(    bannerComponents: List<BannerComponents>?,     userId: String?,     styleId: String?,     accessToken: String?,     callback: RouteShieldCallback)

Given a list of BannerComponents the function requests mapbox designed road shields (if available) using BannerComponents.mapboxShield. If for any reason the API is unable to download the shield, it falls back to download and return the legacy shield if available. Returns error otherwise.