• О MapKit
    • Начало работы
  • Стили карты
  • Версии MapKit
  • Часто задаваемые вопросы
  • Обратная связь

Package com.yandex.mapkit.traffic

Interface TrafficLayer

interface TrafficLayer

A layer with traffic information.

Summary

Methods

Type and modifiers

Method and Description

boolean

isTrafficVisible()
Checks if traffic is visible.

void

setTrafficVisible(boolean on)
Sets traffic visibility.

boolean

setTrafficStyle(@NonNull java.lang.String style)
Applies JSON style transformations to the traffic layer.

boolean

setTrafficStyle(int id,
                @NonNull java.lang.String style)

Applies JSON style transformations to the traffic layer.

void

resetTrafficStyles()
Resets all JSON style transformations applied to the traffic layer.

void

addTrafficListener(@NonNull TrafficListener trafficListener)
Adds a traffic listener.

void

removeTrafficListener(@NonNull TrafficListener trafficListener)
Removes a traffic listener.

boolean

isValid()
Tells if this TrafficLayer is valid or not.

Methods

isTrafficVisible

boolean isTrafficVisible()

Checks if traffic is visible.


setTrafficVisible

void setTrafficVisible(boolean on)

Sets traffic visibility.


setTrafficStyle

boolean setTrafficStyle(@NonNull java.lang.String style)

Applies JSON style transformations to the traffic layer.

Same as setTrafficStyle(0, style). Set to empty string to clear previous styling. Returns true if the style was successfully parsed; false otherwise. If the return value is false, the current traffic style remains unchanged.


setTrafficStyle

boolean setTrafficStyle(int id,
                        @NonNull java.lang.String style)

Applies JSON style transformations to the traffic layer.

Replaces previous styling with the specified ID (if such exists). Stylings are applied in an ascending order. Set to empty string to clear previous styling with the specified ID. Returns true if the style was successfully parsed; false otherwise. If the return value is false, the current traffic style remains unchanged.


resetTrafficStyles

void resetTrafficStyles()

Resets all JSON style transformations applied to the traffic layer.


addTrafficListener

void addTrafficListener(@NonNull TrafficListener trafficListener)

Adds a traffic listener.

The class does not retain the object in the 'trafficListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeTrafficListener

void removeTrafficListener(@NonNull TrafficListener trafficListener)

Removes a traffic listener.


isValid

boolean isValid()

Tells if this TrafficLayer is valid or not.

Any other method (except for this one) called on an invalid TrafficLayer will throw java.lang.RuntimeException. An instance becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.


Предыдущая
Следующая