public class

Layer

extends Object
java.lang.Object
   ↳ com.carto.layers.Layer
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

An abstract base class for all layers.

Summary

Public Methods
boolean containsMetaDataKey(String key)
Returns true if the specified key exists in the layer meta data map.
synchronized void delete()
boolean equals(Object obj)
Checks if this object is equal to the specified object.
StringVariantMap getMetaData()
Returns a copy of the layer meta data map.
Variant getMetaDataElement(String key)
Returns a layer meta data element corresponding to the key.
float getOpacity()
Returns the opacity of this layer.
int getUpdatePriority()
Returns the layer task priority of this layer.
MapRange getVisibleZoomRange()
Returns the visible zoom range of this layer.
int hashCode()
Returns the hash value of this object.
boolean isUpdateInProgress()
Tests whether this layer is being currently updated.
boolean isVisible()
Returns the visibility of this layer.
void refresh()
Refreshes the layer using old stored visibility information.
void setCullDelay(int delay)
Sets the layer culling delay.
void setMetaData(StringVariantMap metaData)
Sets a new meta data map for the layer.
void setMetaDataElement(String key, Variant element)
Adds a new key-value pair to the layer meta data map.
void setOpacity(float opacity)
Set the opacity of the layer.
void setUpdatePriority(int priority)
Sets the layer task priority.
void setVisible(boolean visible)
Sets the visibility of this layer.
void setVisibleZoomRange(MapRange range)
Sets the visible zoom range for this layer.
void simulateClick(ClickType clickType, ScreenPos screenPos, ViewState viewState)
Simulate click on this layer.
void update(CullState cullState)
Updates the layer using new visibility information.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean containsMetaDataKey (String key)

Returns true if the specified key exists in the layer meta data map.

Parameters
key The key to check.
Returns
  • True if the meta data element exists.

public synchronized void delete ()

public boolean equals (Object obj)

Checks if this object is equal to the specified object.

Parameters
obj The reference object.
Returns
  • True when objects are equal, false otherwise.

public StringVariantMap getMetaData ()

Returns a copy of the layer meta data map. The changes you make to this map are NOT reflected in the actual meta data of the layer.

Returns
  • A copy of the layer meta data map.

public Variant getMetaDataElement (String key)

Returns a layer meta data element corresponding to the key. If no value is found null variant is returned.

Parameters
key The key to use.
Returns
  • The value corresponding to the key from the meta data map. If the key does not exist, empty variant is returned.

public float getOpacity ()

Returns the opacity of this layer.

Returns
  • The opacity of this layer.

public int getUpdatePriority ()

Returns the layer task priority of this layer.

Returns
  • The priority level for the tasks of this layer.

public MapRange getVisibleZoomRange ()

Returns the visible zoom range of this layer.

Returns
  • The visible zoom range of this layer.

public int hashCode ()

Returns the hash value of this object.

Returns
  • The hash value of this object.

public boolean isUpdateInProgress ()

Tests whether this layer is being currently updated.

Returns
  • True when the layer is being updated or false when the layer is in steady state.

public boolean isVisible ()

Returns the visibility of this layer.

Returns
  • True if the layer is visible.

public void refresh ()

Refreshes the layer using old stored visibility information. This method might be called if some of the layer data
changes.

public void setCullDelay (int delay)

Sets the layer culling delay. The culling delay is used to delay layer content rendering in case of user interaction,
higher delay improves performance and battery life at the expense of interactivity. Default is 200ms-400ms, depending
on layer type.

Parameters
delay The new culling delay in milliseconds.

public void setMetaData (StringVariantMap metaData)

Sets a new meta data map for the layer. Old meta data values will be lost.

Parameters
metaData The new meta data map for this layer.

public void setMetaDataElement (String key, Variant element)

Adds a new key-value pair to the layer meta data map. If the key already exists in the map,
it's value will be replaced by the new value.

Parameters
key The new key.
element The new value.

public void setOpacity (float opacity)

Set the opacity of the layer.

Parameters
opacity The opacity of the layer in range (0..1). 1.0 is the default value.

public void setUpdatePriority (int priority)

Sets the layer task priority. Higher priority layers get to load data before
lower priority layers. Normal layers and tile layers have seperate task queues and thus
don't compete with each other for task queue access. The default is 0.

Parameters
priority The new task priority for this layer, higher values get better access.

public void setVisible (boolean visible)

Sets the visibility of this layer.

Parameters
visible The new visibility state of the layer.

public void setVisibleZoomRange (MapRange range)

Sets the visible zoom range for this layer. Current zoom level must be within this range for the layer to be visible.
This range is half-open, thus layer is visible if range.min <= ZOOMLEVEL < range.max.

Parameters
range new visible zoom range

public void simulateClick (ClickType clickType, ScreenPos screenPos, ViewState viewState)

Simulate click on this layer. This may trigger any event listeners attached to the layer.

Parameters
clickType The type of the click.
screenPos The screen position for the simulated click.
viewState The view state to use.

public void update (CullState cullState)

Updates the layer using new visibility information. This method is periodically called when the map view moves.
The visibilty info is saved, so the data can be refreshed later.

Parameters
cullState The new visibilty information.