RouteTrafficIncidentStyle

data class RouteTrafficIncidentStyle(val lineWidths: List<WidthByZoom> = DEFAULT_LINE_WIDTHS, val lineOutlineWidths: List<WidthByZoom> = DEFAULT_LINE_OUTLINE_WIDTHS, val lineStartCapType: CapType = DEFAULT_LINE_START_CAP_TYPE, val lineEndCapType: CapType = DEFAULT_LINE_END_CAP_TYPE, val markerLabelFontUri: String = DEFAULT_MARKER_LABEL_FONT_URI, val markerLabelTextSize: Double = DEFAULT_MARKER_LABEL_TEXT_SIZE, val markerLabelTextOutlineWidth: Double = DEFAULT_MARKER_LABEL_TEXT_OUTLINE_WIDTH, val markerLabelTextOffset: PointF = DEFAULT_MARKER_LABEL_OFFSET, val markerLabelTextAnchoring: TextAnchoring = DEFAULT_MARKER_LABEL_ANCHORING, val markerVisibilityByCategory: Map<TrafficIncidentCategory, RouteTrafficIncidentStyle.MarkerVisibility> = DEFAULT_MARKER_VISIBILITY_BY_CATEGORY, val magnitudeOfDelayUnknown: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_UNKNOWN, val magnitudeOfDelayMinor: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_MINOR, val magnitudeOfDelayModerate: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_MODERATE, val magnitudeOfDelayMajor: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_MAJOR, val magnitudeOfDelayIndefinite: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_INDEFINITE)

Style configuration for on-route traffic incidents.

During instance construction, certain input values are checked against the range of values expected for that field (e.g., width values must be non-negative).

Default assets and resources are bundled into the library (e.g., fonts and icons). You do not need to supply any asset/resource files unless you want to customize something. To customize marker pin and icon images, replace the default image files in your application's res folder with new versions. The custom image files must have the same file path as the default image files provided within the library. See the table below.

Magnitude of Delay Resource File Path
unknown Marker pin for all categories except road works <app_res>/drawable@/marker_traffic_bg_base.png
Marker pin for the road works category <app_res>/drawable@/marker_traffic_roadworks_bg_base.png
Marker icon for the road works category <app_res>/drawable@/ic_map_roadworks.png
Marker icon for the unknown category <app_res>/drawable@/ic_map_info.png
minor Marker pin <app_res>/drawable@/marker_traffic_minor_bg_base.png
Marker icon for the road works category <app_res>/drawable@/ic_map_minor_roadworks.png
Marker icon for the unknown category <app_res>/drawable@/ic_map_minor_info.png
moderate Marker pin <app_res>/drawable@/marker_traffic_moderate_bg_base.png
Marker icon for the road works category <app_res>/drawable@/ic_map_moderate_roadworks.png
Marker icon for the unknown category <app_res>/drawable@/ic_map_moderate_info.png
major Marker pin <app_res>/drawable@/marker_traffic_major_bg_base.png
Marker icon for the road works category <app_res>/drawable@/ic_map_major_roadworks.png
Marker icon for the unknown category <app_res>/drawable@/ic_map_major_info.png
indefinite Marker pin <app_res>/drawable@/marker_traffic_road_closed_bg_base.png
Marker icon for the road closed category <app_res>/drawable@/ic_map_road_closed.png

In the table above @ is a placeholder for the density dpi suffix, meaning either: -ldpi, -mdpi, -hdpi, -xhdpi, -xxhdpi, or -xxxhdpi.

Important: This is a Public Preview API. It may be changed or removed at any time.

Parameters

lineWidths

The width (in dp units) of the traffic line. This parameter must be a non-empty list containing non-negative values for both the width and the zoom level where the width is used. Items in this list must not contain duplicated zoom level values.

lineOutlineWidths

The width (in dp units) of the traffic line's outline. This parameter must be a non-empty list containing non-negative values for both the width and the zoom level where the width is used. Items in this list must not contain duplicated zoom level values.

lineStartCapType

The CapType at the traffic line's start.

lineEndCapType

The CapType at the traffic line's end.

markerLabelFontUri

The URI of the font for the label text in traffic marker.

markerLabelTextSize

The size (in dp units) of the label text in the traffic marker.

markerLabelTextOutlineWidth

The width (in dp units) of the outline of the label text in the traffic marker.

markerLabelTextOffset

The offset that will be used to position the label in the traffic marker.

markerLabelTextAnchoring

The anchoring that determines how the label is positioned on the traffic marker.

markerVisibilityByCategory

The visibility of traffic incident markers by category. The dictionary does not have to contain the keys of all possible categories. If a category is missing in the dictionary, markers of that category will not be displayed.

magnitudeOfDelayUnknown

The style properties for traffic incidents with an unknown delay magnitude.

magnitudeOfDelayMinor

The style properties for traffic incidents with a minor delay magnitude.

magnitudeOfDelayModerate

The style properties for traffic incidents with a moderate delay magnitude.

magnitudeOfDelayMajor

The style properties for traffic incidents with a major delay magnitude.

magnitudeOfDelayIndefinite

The style properties for traffic incidents with an indefinite delay magnitude.

Constructors

Link copied to clipboard
fun RouteTrafficIncidentStyle(lineWidths: List<WidthByZoom> = DEFAULT_LINE_WIDTHS, lineOutlineWidths: List<WidthByZoom> = DEFAULT_LINE_OUTLINE_WIDTHS, lineStartCapType: CapType = DEFAULT_LINE_START_CAP_TYPE, lineEndCapType: CapType = DEFAULT_LINE_END_CAP_TYPE, markerLabelFontUri: String = DEFAULT_MARKER_LABEL_FONT_URI, markerLabelTextSize: Double = DEFAULT_MARKER_LABEL_TEXT_SIZE, markerLabelTextOutlineWidth: Double = DEFAULT_MARKER_LABEL_TEXT_OUTLINE_WIDTH, markerLabelTextOffset: PointF = DEFAULT_MARKER_LABEL_OFFSET, markerLabelTextAnchoring: TextAnchoring = DEFAULT_MARKER_LABEL_ANCHORING, markerVisibilityByCategory: Map<TrafficIncidentCategory, RouteTrafficIncidentStyle.MarkerVisibility> = DEFAULT_MARKER_VISIBILITY_BY_CATEGORY, magnitudeOfDelayUnknown: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_UNKNOWN, magnitudeOfDelayMinor: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_MINOR, magnitudeOfDelayModerate: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_MODERATE, magnitudeOfDelayMajor: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_MAJOR, magnitudeOfDelayIndefinite: RouteTrafficIncidentStyle.PropertiesPerMagnitudeOfDelay = DEFAULT_MAGNITUDE_OF_DELAY_INDEFINITE)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Represents the criteria for a traffic marker to be visible.

Link copied to clipboard
data class PropertiesPerMagnitudeOfDelay(val lineColor: Color, val lineOutlineColor: Color, val markerLabelTextColor: Color, val markerLabelTextOutlineColor: Color)

The traffic incident style properties that have specific values per magnitude of delay.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard