Class MapPolyline.SolidMultiColorRepresentation
- Enclosing class:
- MapPolyline
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.here.sdk.mapview.MapPolyline.Representation
MapPolyline.Representation.InstantiationErrorCode, MapPolyline.Representation.InstantiationException -
Constructor Summary
ConstructorsConstructorDescriptionSolidMultiColorRepresentation(MapMeasureDependentRenderSize lineWidth, LineCap capShape, List<Double> colorStops, List<Long> colorIndices, List<Color> colors, double gradientLength) Creates a representation for a multicolored line without an outline.SolidMultiColorRepresentation(MapMeasureDependentRenderSize lineWidth, MapMeasureDependentRenderSize outlineWidth, Color outlineColor, LineCap capShape, List<Double> colorStops, List<Long> colorIndices, List<Color> colors, double gradientLength) Creates a representation for a multicolored line with an outline. -
Method Summary
Modifier and TypeMethodDescriptionbooleansetMultiColorGradientLength(double length) Sets the multiple color segment gradient length.booleanSets lists of colors and multiple color segment stops for the polyline to be colored in.
-
Constructor Details
-
SolidMultiColorRepresentation
public SolidMultiColorRepresentation(@NonNull MapMeasureDependentRenderSize lineWidth, @NonNull LineCap capShape, @NonNull List<Double> colorStops, @NonNull List<Long> colorIndices, @NonNull List<Color> colors, double gradientLength) throws MapPolyline.Representation.InstantiationException 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.ZOOM_LEVELis 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.
- 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.
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.
- Throws:
MapPolyline.Representation.InstantiationException-In case of invalid input parameters.
-
SolidMultiColorRepresentation
public SolidMultiColorRepresentation(@NonNull MapMeasureDependentRenderSize lineWidth, @NonNull MapMeasureDependentRenderSize outlineWidth, @NonNull Color outlineColor, @NonNull LineCap capShape, @NonNull List<Double> colorStops, @NonNull List<Long> colorIndices, @NonNull List<Color> colors, double gradientLength) throws MapPolyline.Representation.InstantiationException 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.ZOOM_LEVELis 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.
- 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.
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.
- Throws:
MapPolyline.Representation.InstantiationException-In case of invalid input parameters.
-
-
Method Details
-
setMultiColors
public boolean setMultiColors(@NonNull List<Double> colorStops, @NonNull List<Long> colorIndices, @NonNull List<Color> colors) 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.
- 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.
- Returns:
Value indicating whether parameters are valid and can be applied.
-
setMultiColorGradientLength
public boolean setMultiColorGradientLength(double length) 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.
- 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.
- Returns:
Value indicating whether specified value is valid and can be applied.
-