Class MapPolyline


  • public final class MapPolyline
    extends NativeBase

    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.

    • Constructor Detail

      • MapPolyline

        public MapPolyline​(@NonNull
                           GeoPolyline geometry,
                           @NonNull
                           MapPolyline.Representation representation)

        Creates a new MapPolyline instance with a specified visual representation.

        Altitude component of GeoPolyline's vertices is ignored.

        After creating a MapPolyline with this representation, the deprecated MapPolyline properties do not work and any change to them will be ignored. Any modifications to polyline's appearance must be done with setRepresentation(com.here.sdk.mapview.MapPolyline.Representation).

        Parameters:
        geometry -

        The list of vertices representing the polyline.

        representation -

        The styling properties of the polyline.

    • Method Detail

      • setRepresentation

        public void setRepresentation​(@NonNull
                                      MapPolyline.Representation representation)

        Changes the appearance of the MapPolyline instance.

        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 MapPolylineAnimation may be shared between multiple instances of MapPolyline.

        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

        public void cancelAnimation​(@NonNull
                                    MapPolylineAnimation animation)

        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

        @NonNull
        public GeoPolyline getGeometry()

        Gets the geometry of the polyline.

        Returns:

        The list of vertices that represent the geometry of the polyline.

      • setGeometry

        public void setGeometry​(@NonNull
                                GeoPolyline value)

        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

        @Nullable
        public Metadata getMetadata()

        Gets the Metadata instance attached to this polyline. This will be null if nothing has been attached before.

        Returns:

        The Metadata instance attached to this polyline.

      • setMetadata

        public void setMetadata​(@Nullable
                                Metadata value)

        Sets the Metadata instance attached to this polyline.

        Parameters:
        value -

        The Metadata instance 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.

      • getVisibilityRanges

        @NonNull
        public java.util.List<MapMeasureRange> 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

        public void setVisibilityRanges​(@NonNull
                                        java.util.List<MapMeasureRange> value)

        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) of MapMeasure.Kind.ZOOM_LEVEL type 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

        @NonNull
        public Color getProgressColor()

        Gets the progress color of the polyline, opaque white by default.

        Returns:

        The color used for the progress part of the polyline.

      • setProgressColor

        public void setProgressColor​(@NonNull
                                     Color value)

        Sets the progress color of the polyline.

        Parameters:
        value -

        The color used for the progress part of the polyline.

      • getProgressOutlineColor

        @NonNull
        public Color 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

        public void setProgressOutlineColor​(@NonNull
                                            Color value)

        Sets the progress outline color of the polyline.

        Parameters:
        value -

        The color used for outline of the progress part of the polyline.

      • getProgressGradientLength

        @NonNull
        public MapMeasureDependentRenderSize getProgressGradientLength()

        Gets the maximum gradient length between MapPolyline.lineColor' and 'MapPolyline.progressColor in zoom level dependent pixels.

        Returns:

        The maximum gradient length between MapPolyline.lineColor' and 'MapPolyline.progressColor in zoom level dependent pixels.

      • setProgressGradientLength

        public void setProgressGradientLength​(@NonNull
                                              MapMeasureDependentRenderSize value)

        Sets the maximum gradient length between MapPolyline.lineColor' and 'MapPolyline.progressColor in zoom level dependent pixels. To achieve a constant gradient length, use MapMeasureDependentRenderSize with a single value. To achieve a gradient length dependent on map zoom, use MapMeasureDependentRenderSize with 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 then progressGradientLength.

        For MapMeasure.Kind only MapMeasure.Kind.ZOOM_LEVEL is supported. For RenderSize.Unit only RenderSize.Unit.PIXELS is supported. A parameter with unsupported values is ignored.

        Parameters:
        value -

        The maximum gradient length between MapPolyline.lineColor' and 'MapPolyline.progressColor in zoom level dependent pixels.

      • getMapContentCategoriesToBlock

        @NonNull
        public java.util.List<MapContentCategory> 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

        public void setMapContentCategoriesToBlock​(@NonNull
                                                   java.util.List<MapContentCategory> value)

        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.