Package com.yandex.mapkit.traffic
Interface TrafficLayer
interface TrafficLayer
A layer with traffic information.
Summary
Methods
Type and modifiers |
Method and Description |
boolean |
isTrafficVisible() |
void |
setTrafficVisible(boolean on) |
boolean |
setTrafficStyle(@NonNull java.lang.String style) |
boolean |
setTrafficStyle(int id, |
void |
resetTrafficStyles() |
void |
addTrafficListener(@NonNull TrafficListener trafficListener) |
void |
removeTrafficListener(@NonNull TrafficListener trafficListener) |
boolean |
isValid() |
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, |
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.