RouteTrafficIncidentStyle

public struct RouteTrafficIncidentStyle

Style configuration for on-route traffic. 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 such as fonts and icons are bundled into the framework. You can provide custom icons in magnitudeOfDelayStyles

Important

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

Lifecycle

  • Initializes the style configuration for on-route traffic.

    Declaration

    Swift

    public init(
        lineWidths: [Double: Double] = Default.lineWidths,
        outlineWidths: [Double: Double] = Default.outlineWidths,
        lineStartCapType: LineCapType = Default.lineStartCapType,
        lineEndCapType: LineCapType = Default.lineEndCapType,
        lineJointType: LineJoinType = Default.lineJointType,
        markerLabelFontURL: String = Default.Asset.markerLabelFontURI,
        markerLabelTextSize: Double = Default.markerLabelTextSize,
        markerLabelOutlineWidth: Double = Default.markerLabelOutlineWidth,
        markerLabelTextOffset: MarkerLabelOptions.TextOffset = Default.markerLabelTextOffset,
        markerLabelTextAnchoring: TextAnchoring = Default.markerLabelTextAnchoring,
        markerVisibilityByCategory: [TrafficIncidentCategory: MarkerVisibility] = Default
            .markerVisibilityByCategory,
        magnitudeOfDelayStyles: [MagnitudeOfDelayKey: MagnitudeOfDelayStyle] = Default.magnitudeOfDelayStyles
    ) throws

    Parameters

    lineWidths

    The line width of the on-route traffic lines. This parameter must be a non-empty dictionary containing non-negative values for both the width and the zoom level where that width is to be used.

    outlineWidths

    The outline width of the on-route traffic lines. This parameter must be a non-empty dictionary containing non-negative values for both the width and the zoom level where that width is to be used.

    lineStartCapType

    The on-route traffic line start cap.

    lineEndCapType

    The on-route traffic line end cap.

    lineJointType

    The on-route traffic line joint type.

    markerLabelFontURL

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

    markerLabelTextSize

    The size of the label text in the traffic marker.

    markerLabelOutlineWidth

    The width 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. This dictionary does not have to contain keys of all possible categories. If a category is missing in the dictionary, markers of that category will not be displayed.

    Important

    Control of traffic incident marker visibility is not implemented yet.

    magnitudeOfDelayStyles

    /// Style properties for traffic incidents by magnitude of delay. This dictionary may not contain keys for all possible magnitudes of delay. If a magnitude of delay is missing in the dictionary, style for MagnitudeOfDelayKey.any is used. If MagnitudeOfDelayKey.any is missing and not all other magnitudes of delay are provided, initializator will throw RouteStyleError

Public

  • The line widths of on-route traffic lines. This parameter must be a non-empty dictionary containing non-negative values for both the width and the zoom level where that width is used.

    Declaration

    Swift

    public let lineWidths: [Double : Double]
  • The outline line width of on-route traffic lines. This parameter must be a non-empty dictionary containing non-negative values for both the width and the zoom level where that width is used.

    Declaration

    Swift

    public let outlineWidths: [Double : Double]
  • The on-route traffic line start cap.

    Declaration

    Swift

    public let lineStartCapType: LineCapType
  • The on-route traffic line end cap.

    Declaration

    Swift

    public let lineEndCapType: LineCapType
  • The on-route traffic line joint type.

    Declaration

    Swift

    public let lineJointType: LineJoinType
  • The URL of the font for the label text in the traffic marker.

    Declaration

    Swift

    public let markerLabelFontURL: String
  • The size of the label text in the traffic marker.

    Declaration

    Swift

    public let markerLabelTextSize: Double
  • The width of the outline of the label text in the traffic marker.

    Declaration

    Swift

    public let markerLabelOutlineWidth: Double
  • The offset that will be used to position the label in the traffic marker.

    Declaration

    Swift

    public let markerLabelTextOffset: MarkerLabelOptions.TextOffset
  • The anchoring that determines how the label is positioned on the traffic marker.

    Declaration

    Swift

    public let markerLabelTextAnchoring: TextAnchoring
  • Traffic incident marker visibility by category. That dictionary does not have to contain keys of all possible categories. If a category is missing in the dictionary, markers of that category will not be displayed.

    Declaration

    Swift

    public let markerVisibilityByCategory: [TrafficIncidentCategory : MarkerVisibility]
  • Style properties for traffic incidents by magnitude of delay. This dictionary may not contain keys for all possible magnitudes of delay. If a magnitude of delay is missing in the dictionary, style for MagnitudeOfDelayKey.any is used.

    Declaration

    Swift

    public let magnitudeOfDelayStyles: [MagnitudeOfDelayKey : MagnitudeOfDelayStyle]