MapPolyline (API Reference)
Class MapPolyline
A visual representation of a line on the map.
The geometry to be visualized is represented by an instance of GeoPolyline.
Altitude component of GeoPolyline's vertices is ignored.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a dash pattern for the map polyline consisting of images rendered with certain gaps from each other.static final classRepresents a dash pattern for map polyline where the dash can be rendered as a colored line and the gap can be either empty or colored.static classBase class to represent the visual appearance of aMapPolyline.static final classRepresentation for a solid line without outline. -
Constructor Summary
ConstructorsConstructorDescriptionMapPolyline(GeoPolyline geometry, MapPolyline.Representation representation) Creates a newMapPolylineinstance with a specified visual representation. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelAnimation(MapPolylineAnimation animation) Cancels single ongoing animation of this map polyline.intGets the draw order of the polyline.Gets the draw order type of the polyline.Gets the geometry of the polyline.Gets list of map content categories this polyline should block.Gets theMetadatainstance attached to this polyline.doubleGets the progress of the polyline, 0 by default.Gets the progress color of the polyline, opaque white by default.Gets the maximum gradient length betweenMapPolyline.lineColor' and 'MapPolyline.progressColorin zoom level dependent pixels.Gets the progress outline color of the polyline, opaque white by default.Gets the list of visibility ranges.voidsetDrawOrder(int value) Sets the draw order of the polyline.voidsetDrawOrderType(DrawOrderType value) Sets the draw order type of the polyline.voidsetGeometry(GeoPolyline value) Sets the geometry of the polyline.voidSets list of map content categories this polyline should block.voidsetMetadata(Metadata value) Sets theMetadatainstance attached to this polyline.voidsetProgress(double value) Sets the progress of the polyline from its starting point as a ratio of its total length clamped to the range [0; 1].voidsetProgressColor(Color value) Sets the progress color of the polyline.voidSets the maximum gradient length betweenMapPolyline.lineColor' and 'MapPolyline.progressColorin zoom level dependent pixels.voidsetProgressOutlineColor(Color value) Sets the progress outline color of the polyline.voidsetRepresentation(MapPolyline.Representation representation) Changes the appearance of theMapPolylineinstance.voidsetVisibilityRanges(List<MapMeasureRange> value) Sets visibility ranges for this map polyline.voidstartAnimation(MapPolylineAnimation animation, AnimationListener listener) Starts an animation of this map polyline.
-
Constructor Details
-
MapPolyline
public MapPolyline(@NonNull GeoPolyline geometry, @NonNull MapPolyline.Representation representation) Creates a new
MapPolylineinstance with a specified visual representation.Altitude component of
GeoPolyline's vertices is ignored.After creating a
MapPolylinewith this representation, the deprecatedMapPolylineproperties do not work and any change to them will be ignored. Any modifications to polyline's appearance must be done withsetRepresentation(com.here.sdk.mapview.MapPolyline.Representation).- Parameters:
geometry-The list of vertices representing the polyline.
representation-The styling properties of the polyline.
-
-
Method Details
-
setRepresentation
Changes the appearance of the
MapPolylineinstance.- Parameters:
representation-The representation describing a new appearance of the
MapPolyline.
-
startAnimation
public void startAnimation(@NonNull MapPolylineAnimation animation, @NonNull AnimationListener listener) Starts an animation of this map polyline.
The
MapPolylineAnimationmay be shared between multiple instances ofMapPolyline.Starting animation on one polyline does not influence any ongoing animations on other polylines. Any ongoing animation of this map polyline will get cancelled.
- Parameters:
animation-The animation to start.
listener-The listener to receive notifications about animation start, completion or cancellation.
-
cancelAnimation
Cancels single ongoing animation of this map polyline.
Does nothing if the specified animation is not currently in progress for this polyline. Does not affect other polylines that might be running this animation.
- Parameters:
animation-The animation to cancel
-
getGeometry
Gets the geometry of the polyline.
- Returns:
The list of vertices that represent the geometry of the polyline.
-
setGeometry
Sets the geometry of the polyline. Altitude component of
GeoPolyline's vertices is ignored.- Parameters:
value-The list of vertices that represent the geometry of the polyline.
-
getMetadata
Gets the
Metadatainstance attached to this polyline. This will benullif nothing has been attached before.- Returns:
The
Metadatainstance attached to this polyline.
-
setMetadata
Sets the
Metadatainstance attached to this polyline.- Parameters:
value-The
Metadatainstance attached to this polyline.
-
getDrawOrder
public int getDrawOrder()Gets the draw order of the polyline.
The default draw order is 0.
- Returns:
The draw order of the polyline.
-
setDrawOrder
public void setDrawOrder(int value) Sets the draw order of the polyline.
Polylines with a higher draw order are drawn on top of polylines with a lower draw order.
In case multiple polylines have the same draw order, they can be rendered in different ways depending on the
getDrawOrderType()set.Supplied value is clamped to the range [0; 1023].
- Parameters:
value-The draw order of the polyline.
-
getDrawOrderType
Gets the draw order type of the polyline.
The default value is
DrawOrderType.MAP_SCENE_ADDITION_ORDER_DEPENDENT.- Returns:
The draw order type of the polyline.
-
setDrawOrderType
Sets the draw order type of the polyline.
For
DrawOrderType.MAP_SCENE_ADDITION_ORDER_DEPENDENT, map polylines with outlines having the same draw order are drawn as a whole in the order of addition to a map scene. There is no possibility that parts of another polyline, regardless of its draw order value, are drawn between outline and mainline of another polyline.With
DrawOrderType.MAP_SCENE_ADDITION_ORDER_DEPENDENT, polylines are rendered one by one.For
DrawOrderType.MAP_SCENE_ADDITION_ORDER_INDEPENDENT, for multiple polylines with outlines having the same draw order, all outlines are rendered first in an arbitrary order and then all mainlines are drawn on top of those polylines in an arbitrary order.DrawOrderType.MAP_SCENE_ADDITION_ORDER_INDEPENDENTallows speeding up the rendering process and keeping high frame rates when many similar polylines (with same styling attributes andMapPolyline.Representation) are present in a map scene.- Parameters:
value-The draw order type of the polyline.
-
getVisibilityRanges
Gets the list of visibility ranges. The map polyline is visible only inside these map measure ranges. When empty (the default), the map polyline is visible without map measure restrictions.
- Returns:
The list of visibility ranges. The map polyline is visible only inside these map measure ranges.
-
setVisibilityRanges
Sets visibility ranges for this map polyline. A range is half open - [minimumZoomLevel, maximumZoomLevel), the given maximum value is not contained in the range. The map polyline is visible only inside these map measure ranges.
When empty (the default), the map polyline is visible without map measure restrictions. Only
MapMeasureRange(s) ofMapMeasure.Kind.ZOOM_LEVELtype are supported.MapMeasureRange(s) of other unsupported types will be ignored.- Parameters:
value-The list of visibility ranges. The map polyline is visible only inside these map measure ranges.
-
getProgress
public double getProgress()Gets the progress of the polyline, 0 by default.
- Returns:
The progress from the polyline's starting point, as a ratio of its total length clamped to the range [0, 1].
-
setProgress
public void setProgress(double value) Sets the progress of the polyline from its starting point as a ratio of its total length clamped to the range [0; 1].
As the progress varies, the equivalent part of the polyline gets covered by the progress color and progress outline color. The rest of the polyline until its end point retains the line color and outline color along with an optional dash pattern.
- Parameters:
value-The progress from the polyline's starting point, as a ratio of its total length clamped to the range [0, 1].
-
getProgressColor
Gets the progress color of the polyline, opaque white by default.
- Returns:
The color used for the progress part of the polyline.
-
setProgressColor
Sets the progress color of the polyline.
- Parameters:
value-The color used for the progress part of the polyline.
-
getProgressOutlineColor
Gets the progress outline color of the polyline, opaque white by default.
- Returns:
The color used for outline of the progress part of the polyline.
-
setProgressOutlineColor
Sets the progress outline color of the polyline.
- Parameters:
value-The color used for outline of the progress part of the polyline.
-
getProgressGradientLength
Gets the maximum gradient length between
MapPolyline.lineColor' and 'MapPolyline.progressColorin zoom level dependent pixels.- Returns:
The maximum gradient length between
MapPolyline.lineColor' and 'MapPolyline.progressColorin zoom level dependent pixels.
-
setProgressGradientLength
Sets the maximum gradient length between
MapPolyline.lineColor' and 'MapPolyline.progressColorin zoom level dependent pixels. To achieve a constant gradient length, useMapMeasureDependentRenderSizewith a single value. To achieve a gradient length dependent on map zoom, useMapMeasureDependentRenderSizewith multiple values. The default value is a constant gradient length of zero pixels. The gradient is guaranteed to fit into polyline, i.e. the actual gradient can be shorter thenprogressGradientLength.For
MapMeasure.KindonlyMapMeasure.Kind.ZOOM_LEVELis supported. ForRenderSize.UnitonlyRenderSize.Unit.PIXELSis supported. A parameter with unsupported values is ignored.- Parameters:
value-The maximum gradient length between
MapPolyline.lineColor' and 'MapPolyline.progressColorin zoom level dependent pixels.
-
getMapContentCategoriesToBlock
Gets list of map content categories this polyline should block.
Default value is an empty list meaning none of the map categories will be blocked.
- Returns:
List of map content categories this polyline should block.
-
setMapContentCategoriesToBlock
Sets list of map content categories this polyline should block.
Map content categories overlapping the polyline geometry (progress and non-progress) will be discarded from being rendered.
Duplicate entries will be ignored and will have no additional effect.
- Parameters:
value-List of map content categories this polyline should block.
-