Class Layers

java.lang.Object
com.massifmaps.components.Layers

public class Layers extends Object
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.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Layer layer)
    Adds a new layer to the layer stack.
    void
    Adds a a list of layers to the layer stack.
    void
    Clears the layer stack.
    int
    Returns the current layer count.
    boolean
    Checks if this object is equal to the specified object.
    get(int index)
    Returns the layer at the specified index.
    Returns the list of all layers.
    int
    Returns the hash value of this object.
    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.
    boolean
    remove(Layer layer)
    Removes a layer from the layer stack.
    boolean
    Removes a list of layers from the layer stack.
    void
    set(int index, Layer layer)
    Replaces the layer at the specified index.
    void
    Replaces all the layers with the given layer list.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to the specified object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The reference object.
      Returns:
      True when objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hash value of this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash value of this object.
    • count

      public int count()
      Returns the current layer count.
      Returns:
      The layer count.
    • clear

      public void clear()
      Clears the layer stack.
    • get

      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.
    • getAll

      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.
    • set

      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.
    • setAll

      public void setAll(LayerVector layers)
      Replaces all the layers with the given layer list.
      Parameters:
      layers - The new list of layers.
    • insert

      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.
    • add

      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.
    • addAll

      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.
    • remove

      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).
    • removeAll

      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).