Class CelestialLayer

java.lang.Object
com.massifmaps.layers.Layer
com.massifmaps.layers.CelestialLayer

public class CelestialLayer extends Layer
A layer of objects that live in the sky rather than on the map: anything placed by a
direction, an object overhead, or a curve traced across the sky.

Nothing here is tied to the map's coordinates unless an object asks for it (see
CelestialObject::setPosition), so panning the map does not drag the sky along. The layer
is drawn in its place in the layer order, so adding it FIRST puts every object behind the
map and lets terrain hide what is behind a ridge, which is what an object in the sky wants.

Objects are batched by bitmap, so a catalogue of thousands sharing one bitmap - or none -
costs a single draw call.
  • Constructor Details

    • CelestialLayer

      public CelestialLayer()
  • Method Details

    • add

      public void add(CelestialObject object)
      Adds an object to the layer.
      Parameters:
      object - The object to add.
    • addAll

      public void addAll(CelestialObjectVector objects)
      Adds a list of objects to the layer. Cheaper than adding them one at a time, which
      rebuilds the batches per object.
      Parameters:
      objects - The objects to add.
    • remove

      public boolean remove(CelestialObject object)
      Removes an object from the layer.
      Parameters:
      object - The object to remove.
      Returns:
      True if the object was found and removed.
    • clear

      public void clear()
      Removes every object from the layer.
    • getAll

      public CelestialObjectVector getAll()
      Returns all objects of the layer.
      Returns:
      The objects of the layer.
    • getCelestialEventListener

      public CelestialEventListener getCelestialEventListener()
      Returns the object event listener.
      Returns:
      The object event listener.
    • setCelestialEventListener

      public void setCelestialEventListener(CelestialEventListener listener)
      Sets the object event listener, which reports clicks on objects of this layer.
      Parameters:
      listener - The new object event listener.
    • isUpdateInProgress

      public boolean isUpdateInProgress()
      Description copied from class: Layer
      Tests whether this layer is being currently updated.
      Overrides:
      isUpdateInProgress in class Layer
      Returns:
      True when the layer is being updated or false when the layer is in steady state.