SolidMultiColorRepresentation

public class SolidMultiColorRepresentation : MapPolyline.Representation

Representation allows map polyline to be colored in multiple specified color segments.

Color segment is defined by color stops. Color stop is specified as a polyline length ratio (0.0 - start of the polyline, 1.0 - end of the polyline). Color stop represents a color change starting at that exact point up until either the next color stop (if one exists) or the end of the polyline.

Progress color MapPolyline.progressColor overrides any of the multiple color.

Examples: The following configuration will color map polyline as follows:

  • from the start to the middle of it at the 0.5 point - in Red
  • from the middle point 0.5 to the 0.7 point - in Green
  • from 0.7 to 1.0 - in Red ‘colorStops: {0.0, 0.5, 0.7}, colorIndices: {0, 1, 0}, colors: {Red, Green}’

Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

  • Creates a representation for a multicolored line without an outline.

    Color segment is defined by color stops. Color stop is specified as a polyline length ratio (0.0 - start of the polyline, 1.0 - end of the polyline). Color stop represents a color change starting at that exact point up until either the next color stop (if one exists) or the end of the polyline.

    Progress color MapPolyline.progressColor overrides any of the multiple color.

    At map measures smaller than smallest map measure in the lineWidth line width is constant and equal to the width given for the smallest map measure in the lineWidth.

    At map measures bigger than biggest map measure in the lineWidth line width is constant and equal to the width given for the biggest map measure in the lineWidth.

    At map measures between two nearest given map measures line width is linearly interpolated between width values given for these map measures.

    For MapMeasure.Kind only MapMeasure.Kind.zoomLevel is supported.

    For RenderSize.Unit only RenderSize.Unit.pixels is supported.

    lineWidth must not be 0 (lineWidth.sizes with all values set to 0.0).

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

    Throws

    MapPolyline.Representation.InstantiationError In case of invalid input parameters.

    Declaration

    Swift

    public init(lineWidth: MapMeasureDependentRenderSize, capShape: LineCap, colorStops: [Double], colorIndices: [UInt32], colors: [UIColor], gradientLength: Double) throws

    Parameters

    lineWidth

    The width of the polyline depending on the map measure.

    capShape

    The cap shape applied to both ends of the polyline.

    colorStops

    List containing color stop values indicating a change of color on a polyline. Color stops must be in the range of [0.0, 1.0]. Color stop values must be sorted in ascending order (e.g. 0.0, 0.2, 0.3, 1.0). Duplicate values are not allowed. Color stop list must be of the same size as color indices list. Maximum size is 100 color stops. An empty list is not allowed. The first color stop value in the list must be 0.0.

    colorIndices

    List of color indices (from the color list) corresponding to the color stops. Value range is: [0, (color list size - 1)]. Values outside of the range are not allowed. Color indices list must be of the same size as color stop list. Maximum size is 100 color indices.

    colors

    List of colors. Maximum size is 16 colors. An empty list is not allowed.

    gradientLength

    Multiple color segment gradient length.

  • Creates a representation for a multicolored line with an outline.

    Color segment is defined by color stops. Color stop is specified as a polyline length ratio (0.0 - start of the polyline, 1.0 - end of the polyline). Color stop represents a color change starting at that exact point up until either the next color stop (if one exists) or the end of the polyline.

    Progress color MapPolyline.progressColor overrides any of the multiple color.

    The total width of the polyline is line width + 2 * outline width.

    At map measures smaller than smallest map measure in the lineWidth and outlineWidth, the value is constant and equal to the width given for the smallest map measure in the lineWidth and outlineWidth.

    At map measures bigger than biggest map measure in the lineWidth and outlineWidth, the value is constant and equal to the width given for the biggest map measure in the lineWidth and outlineWidth.

    At map measures between two nearest given map measure is linearly interpolated between width values given for these map measures.

    For MapMeasure.Kind only MapMeasure.Kind.zoomLevel is supported.

    For RenderSize.Unit only RenderSize.Unit.pixels is supported.

    lineWidth must not be 0 (lineWidth.sizes with all values set to 0.0).

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

    Throws

    MapPolyline.Representation.InstantiationError In case of invalid input parameters.

    Declaration

    Swift

    public init(lineWidth: MapMeasureDependentRenderSize, outlineWidth: MapMeasureDependentRenderSize, outlineColor: UIColor, capShape: LineCap, colorStops: [Double], colorIndices: [UInt32], colors: [UIColor], gradientLength: Double) throws

    Parameters

    lineWidth

    The width of the polyline depending on the map measure.

    outlineWidth

    The width of the outline on one side of the polyline depending on the map measure.

    outlineColor

    The outline color of the polyline.

    capShape

    The cap shape applied to both ends of the polyline.

    colorStops

    List containing color stop values indicating a change of color on a polyline. Color stops must be in the range of [0.0, 1.0]. Color stop values must be sorted in ascending order (e.g. 0.0, 0.2, 0.3, 1.0). Duplicate values are not allowed. Color stop list must be of the same size as color indices list. Maximum size is 100 color stops. An empty list is not allowed. The first color stop value in the list must be 0.0.

    colorIndices

    List of color indices (from the color list) corresponding to the color stops. Value range is: [0, (color list size - 1)]. Values outside of the range are not allowed. Color indices list must be of the same size as color stop list. Maximum size is 100 color indices.

    colors

    List of colors. Maximum size is 16 colors. An empty list is not allowed.

    gradientLength

    Multiple color segment gradient length.

  • Sets lists of colors and multiple color segment stops for the polyline to be colored in. When this representation is already set on any MapPolyline, values will be applied on that MapPolyline right away. If this representation is not set on any MapPolyline, values will be applied once representation is set on a MapPolyline.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public func setMultiColors(colorStops: [Double], colorIndices: [UInt32], colors: [UIColor]) -> Bool

    Parameters

    colorStops

    List containing color stop values indicating a change of color on a polyline. Color stops must be in the range of [0.0, 1.0]. Color stop values must be sorted in ascending order (e.g. 0.0, 0.2, 0.3, 1.0). Duplicate values are not allowed. Color stop list must be of the same size as color indices list. Maximum size is 100 color stops. An empty list is not allowed. The first color stop value in the list must be 0.0.

    colorIndices

    List of color indices (from the color list) corresponding to the color stops. Value range is: [0, (color list size - 1)]. Values outside of the range are not allowed. Color indices list must be of the same size as color stop list. Maximum size is 100 color indices.

    colors

    List of colors. Maximum size is 16 colors. An empty list is not allowed.

    Return Value

    Value indicating whether parameters are valid and can be applied.

  • Sets the multiple color segment gradient length.

    Colors of two adjacent color segments can be blended to have a nicer visual appeal. Blending produces color gradient of specific length which is part of the color segment being blended.

    Start of the segment is blended with a color from the previous segment. Blending length is specified as a ratio of the smallest color segment length (from the list of color stops). E.g. a value of ‘0.1’ means 10% of the length of the smallest segment will be blended with a color from its previous segment. For this smallest segment gradient length is applied as-is, for all other segments it is scaled proportionally based on the smallest segment’s size to other segment size ratio.

    Length of ‘0.0’ is the default value which means blending will not be applied. Valid value range is [0.0, 1.0]. Out of range values are not supported. When this representation is already set on any MapPolyline, value will be applied on that MapPolyline right away. If this representation is not set on any MapPolyline, value will be applied once representation is set on a MapPolyline.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public func setMultiColorGradientLength(length: Double) -> Bool

    Parameters

    length

    Multiple color segment gradient length. Length of ‘0.0’ is the default value which means blending will not be applied. Valid value range is [0.0, 1.0]. Out of range values are not supported.

    Return Value

    Value indicating whether specified value is valid and can be applied.