Builder

class Builder

Responsible for instantiating an instance of MapboxRouteLineOptions

Parameters

context

an instance of Context

routeLineResources

an instance of RouteLineResources

routeLineBelowLayerId

determines the elevation of the route layers

routeStyleDescriptors

a collection of RouteStyleDescriptor objects

vanishingRouteLineEnabled

indicates if the vanishing route line feature is enabled

displayRestrictedRoadSections

indicates if the route line will display restricted road sections with a dashed line

styleInactiveRouteLegsIndependently

enabling this feature will change the color of the route legs that aren't currently being navigated. See RouteLineColorResources to specify the color used.

displaySoftGradientForTraffic

enabling this will display the traffic color transitions with a gradual gradient color blend. If false the color transitions will abruptly transition from one color to the next.

softGradientTransition

this value influences the length of the color transition when the displaySoftGradientForTraffic param is set to true

vanishingRouteLineUpdateIntervalNano

can be used to decrease the frequency of the vanishing route line updates improving the performance at the expense of visual appearance of the vanishing point on the line during navigation.

iconPitchAlignment

the pitch alignment value used for waypoint icons. The default is IconPitchAlignment.MAP

shareLineGeometrySources

enables route line's GeoJson source data sharing between multiple instances of the map. If this option is enabled for multiple instances of MapboxRouteLineViews that are used to draw route lines on multiple maps at the same time, they will all share the GeoJson source to optimize execution time of updates and decrease the memory footprint. Enable only for instances that should share the geometry of the lines, leave disabled for instances that should draw geometries distinct from other instances.

Constructors

Link copied to clipboard
fun Builder(context: Context)

Responsible for instantiating an instance of MapboxRouteLineOptions

Functions

Link copied to clipboard
fun build(): MapboxRouteLineOptions
Link copied to clipboard
fun displayRestrictedRoadSections(displayRestrictedRoadSections: Boolean): MapboxRouteLineOptions.Builder

Indicates if the route line will display restricted road sections with a dashed line. False by default.

Link copied to clipboard

Influences the appearance of the gradient used for the traffic line. By default there is an abrupt transition between different colors representing traffic congestion. If this value is set to true there is a smoother transition between the colors. This value is false by default.

Link copied to clipboard
fun iconPitchAlignment(iconPitchAlignment: IconPitchAlignment): MapboxRouteLineOptions.Builder

Orientation of waypoint icons when map is pitched.

Link copied to clipboard
fun lineDepthOcclusionFactor(@FloatRange(from = 0.0, to = 1.0) lineDepthOcclusionFactor: Double): MapboxRouteLineOptions.Builder

Decrease line layer opacity based on occlusion from 3D objects. Value 0 disables occlusion, value 1 means fully occluded.

Link copied to clipboard
fun shareLineGeometrySources(shareLineGeometrySources: Boolean): MapboxRouteLineOptions.Builder

Enable route line's GeoJson source data sharing between multiple instances of the map. If this option is enabled for multiple instances of MapboxRouteLineViews that are used to draw route lines on multiple maps at the same time, they will all share the GeoJson source to optimize execution time of updates and decrease the memory footprint. Enable only for instances that should share the geometry of the lines, leave disabled for instances that should draw geometries distinct from other instances.

Link copied to clipboard
fun softGradientTransition(transitionDistance: Int): MapboxRouteLineOptions.Builder

When displayRestrictedRoadSections is set to true this value will influence the length of the gradient transition between traffic congestion colors. Larger values will result in the color transition occurring over a longer length of the line. Values between 5 and 75 are recommended. The default value is 30.

Link copied to clipboard

Enabling this feature will result in route legs that aren't currently being navigated to be color differently than the active leg. See RouteLineColorResources for the color option.

Link copied to clipboard
fun vanishingRouteLineUpdateInterval(interval: Long = RouteLayerConstants.DEFAULT_VANISHING_POINT_MIN_UPDATE_INTERVAL_NANO): MapboxRouteLineOptions.Builder

Used for throttling the interval of updates to the vanishing route line. The default value is RouteLayerConstants.DEFAULT_VANISHING_POINT_MIN_UPDATE_INTERVAL_NANO.

Link copied to clipboard
fun waypointLayerIconAnchor(iconAnchor: IconAnchor = IconAnchor.CENTER): MapboxRouteLineOptions.Builder

Determines the icon anchor for the SymbolLayer that hosts the waypoint icons including the icons for the origin and destination points.

Link copied to clipboard
fun waypointLayerIconOffset(iconOffset: List<Double> = listOf(0.0, 0.0)): MapboxRouteLineOptions.Builder

Determines the icon offset for the SymbolLayer that hosts the waypoint icons including the icons for the origin and destination points.

Link copied to clipboard
fun withRouteLineBelowLayerId(layerId: String?): MapboxRouteLineOptions.Builder

Indicates the elevation of the route line related layers. A good starting point is LocationComponentConstants.LOCATION_INDICATOR_LAYER for 2D location puck and LocationComponentConstants.MODEL_LAYER for 3D location puck.

Link copied to clipboard
fun withRouteLineResources(resourceProvider: RouteLineResources): MapboxRouteLineOptions.Builder

An instance of RouteLineResources

Link copied to clipboard
fun withRouteStyleDescriptors(routeStyleDescriptors: List<RouteStyleDescriptor>): MapboxRouteLineOptions.Builder

RouteStyleDescriptor is an override of an alternative route line coloring based on a provided identifier. Setting one or more RouteStyleDescriptor objects here will configure the layer such that any route set with a matching identifier will get colored according to the values provided in the RouteStyleDescriptor.

Link copied to clipboard
fun withTolerance(tolerance: Double): MapboxRouteLineOptions.Builder

Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance) for the GeoJsonSources created to display the route line.

Link copied to clipboard
fun withVanishingRouteLineEnabled(isEnabled: Boolean): MapboxRouteLineOptions.Builder

Determines if the vanishing route line feature is enabled. It is not enabled by default.