Interface RoutePainter

com.yandex.mapkit.transport.masstransit

public interface RoutePainter

Makes it easy to paint a ColoredPolylineMapObject using the colors for traffic on the route.

Do this in two steps: 1. Initialize the painter. Set the traffic jam style you want and the route from which the painter will take the traffic info. 2. Choose any subpolyline of the route's geometry and pass it to the painter along with the ColoredPolylineMapObject you wish to paint. The painter will set the geometry of the map object to that of the chosen subpolyline and assign colors for any of its segments.

You can assign other routes to the painter. But make sure that the subpolyline you give to the painter will correspond to the set route's geometry, or the painter will crash.

Methods

void reset(@NonNull Route route)

Resets colors according to the current traffic intensity on the route.

void setJamStyle(@NonNull JamStyle style)

Sets the current style.

void updatePolyline(@NonNull ColoredPolylineMapObject polyline, @NonNull Subpolyline subpolyline)

Sets a new geometry and colors for a polyline.

Method Detail

reset

public void reset (@NonNull Route route)

Resets colors according to the current traffic intensity on the route.

setJamStyle

public void setJamStyle (@NonNull JamStyle style)

Sets the current style.

updatePolyline

public void updatePolyline (@NonNull ColoredPolylineMapObject polyline, @NonNull Subpolyline subpolyline)

Sets a new geometry and colors for a polyline.

The method calls only the following polyline methods: - setGeometry - setColors - setPaletteColor