Interface Layer

com.yandex.mapkit.layers

public interface Layer

Interface for working with the layer.

Methods

void activate(boolean on)

Shows or hides the layer on the map.

void clear()

Clears all cached tiles and starts new requests for tiles that are displayed.

void invalidate(@NonNull String version)

Invalidates the layer and reloads all tiles that have been modified in the new map version.

boolean isValid()

Tells if this Layer is valid or no.

void remove()

Removes the layer from the map.

boolean setStyle(@NonNull String style)

Applies JSON style transformation to the layer.

Method Detail

activate

public void activate (boolean on)

Shows or hides the layer on the map.

clear

public void clear ()

Clears all cached tiles and starts new requests for tiles that are displayed.

invalidate

public void invalidate (@NonNull String version)

Invalidates the layer and reloads all tiles that have been modified in the new map version.

To update a layer that does not have a version, leave this parameter empty. Can be called on any thread.

isValid

public boolean isValid ()

Tells if this Layer is valid or no.

Any other method (except for this one) called on an invalid Layer 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.

remove

public void remove ()

Removes the layer from the map.

setStyle

public boolean setStyle (@NonNull String style)

Applies JSON style transformation to the layer.

Set to empty string to clear any previous custom styles. Returns true if the style was successfully parsed and false otherwise. If the returned value is false, the current style remains unchanged.