public class

Layers

extends Object
java.lang.Object
   ↳ com.carto.components.Layers

Class Overview

Container for all raster and vector layers of the map view.

The order in which layers are added is important for vector elements like Points, Lines
and Polygons. For these elements the layer ordering defines their draw order.
Other elements like NMLModels and Polygon3Ds are z ordered and are drawn using the depth buffer.
For Billboard elements like Markers and Labels, the layer ordering is unimportant, because
they will be sorted from back to front and drawn in that order on top of all other vector elements.

Summary

Public Methods
void add(Layer layer)
Adds a new layer to the layer stack.
void addAll(LayerVector layers)
Adds a a list of layers to the layer stack.
void clear()
Clears the layer stack.
int count()
Returns the current layer count.
synchronized void delete()
boolean equals(Object obj)
Checks if this object is equal to the specified object.
Layer get(int index)
Returns the layer at the specified index.
LayerVector getAll()
Returns the list of all layers.
int hashCode()
Returns the hash value of this object.
void insert(int index, Layer layer)
Inserts a new layer at the specified position.
boolean remove(Layer layer)
Removes a layer from the layer stack.
boolean removeAll(LayerVector layers)
Removes a list of layers from the layer stack.
void set(int index, Layer layer)
Replaces the layer at the specified index.
void setAll(LayerVector layers)
Replaces all the layers with the given layer list.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void add (Layer layer)

Adds a new layer to the layer stack. The new layer will be the last (and topmost) layer.

Parameters
layer The layer to be added.

public void addAll (LayerVector layers)

Adds a a list of layers to the layer stack. The new layers will be the last (and topmost) layers.

Parameters
layers The layer list to be added.

public void clear ()

Clears the layer stack.

public int count ()

Returns the current layer count.

Returns
  • The layer count.

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 Layer get (int index)

Returns the layer at the specified index.

Parameters
index The layer index to return. Must be between 0 and count (exclusive).
Returns
  • The layer at the specified index.
Throws
IndexOutOfBoundsException If the index is out of range.

public LayerVector getAll ()

Returns the list of all layers. The layers are in the order in which they were added.

Returns
  • A vector of all previously added layers.

public int hashCode ()

Returns the hash value of this object.

Returns
  • The hash value of this object.

public void insert (int index, Layer layer)

Inserts a new layer at the specified position.
All previous layers starting from this index will be moved to the next position.

Parameters
index The layer index. Must be between 0 and count (inclusive).
layer The new layer.
Throws
IndexOutOfBoundsException If the index is out of range.

public boolean remove (Layer layer)

Removes a layer from the layer stack.

Parameters
layer The layer to be removed.
Returns
  • True if the layer was removed. False otherwise (layer was not found).

public boolean removeAll (LayerVector layers)

Removes a list of layers from the layer stack.

Parameters
layers The list of layers to be removed.
Returns
  • True if all layer were removed. False otherwise (some layers were not found).

public void set (int index, Layer layer)

Replaces the layer at the specified index.

Parameters
index The layer index to replace. Must be between 0 and count (exclusive).
layer The new layer.
Throws
IndexOutOfBoundsException If the index is out of range.

public void setAll (LayerVector layers)

Replaces all the layers with the given layer list.

Parameters
layers The new list of layers.