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.progressColoroverrides any of the multiple color.At map measures smaller than smallest map measure in the
lineWidthline width is constant and equal to the width given for the smallest map measure in thelineWidth.At map measures bigger than biggest map measure in the
lineWidthline width is constant and equal to the width given for the biggest map measure in thelineWidth.At map measures between two nearest given map measures line width is linearly interpolated between width values given for these map measures.
For
MapMeasure.KindonlyMapMeasure.Kind.zoomLevelis supported.For
RenderSize.UnitonlyRenderSize.Unit.pixelsis supported.lineWidthmust not be 0 (lineWidth.sizeswith 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.InstantiationErrorIn case of invalid input parameters.Declaration
Swift
public init(lineWidth: MapMeasureDependentRenderSize, capShape: LineCap, colorStops: [Double], colorIndices: [UInt32], colors: [UIColor], gradientLength: Double) throwsParameters
lineWidthThe width of the polyline depending on the map measure.
capShapeThe cap shape applied to both ends of the polyline.
colorStopsList 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.
colorIndicesList 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.
colorsList of colors. Maximum size is 16 colors. An empty list is not allowed.
gradientLengthMultiple 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.progressColoroverrides 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
lineWidthandoutlineWidth, the value is constant and equal to the width given for the smallest map measure in thelineWidthandoutlineWidth.At map measures bigger than biggest map measure in the
lineWidthandoutlineWidth, the value is constant and equal to the width given for the biggest map measure in thelineWidthandoutlineWidth.At map measures between two nearest given map measure is linearly interpolated between width values given for these map measures.
For
MapMeasure.KindonlyMapMeasure.Kind.zoomLevelis supported.For
RenderSize.UnitonlyRenderSize.Unit.pixelsis supported.lineWidthmust not be 0 (lineWidth.sizeswith 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.InstantiationErrorIn 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) throwsParameters
lineWidthThe width of the polyline depending on the map measure.
outlineWidthThe width of the outline on one side of the polyline depending on the map measure.
outlineColorThe outline color of the polyline.
capShapeThe cap shape applied to both ends of the polyline.
colorStopsList 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.
colorIndicesList 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.
colorsList of colors. Maximum size is 16 colors. An empty list is not allowed.
gradientLengthMultiple 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 thatMapPolylineright away. If this representation is not set on anyMapPolyline, values will be applied once representation is set on aMapPolyline.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]) -> BoolParameters
colorStopsList 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.
colorIndicesList 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.
colorsList 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 thatMapPolylineright away. If this representation is not set on anyMapPolyline, value will be applied once representation is set on aMapPolyline.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) -> BoolParameters
lengthMultiple 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.