Package com.massifmaps.layers
Class CelestialLayer
java.lang.Object
com.massifmaps.layers.Layer
com.massifmaps.layers.CelestialLayer
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.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CelestialObject object) Adds an object to the layer.voidaddAll(CelestialObjectVector objects) Adds a list of objects to the layer.voidclear()Removes every object from the layer.getAll()Returns all objects of the layer.Returns the object event listener.booleanTests whether this layer is being currently updated.booleanremove(CelestialObject object) Removes an object from the layer.voidSets the object event listener, which reports clicks on objects of this layer.Methods inherited from class com.massifmaps.layers.Layer
containsMetaDataKey, equals, getMetaData, getMetaDataElement, getOpacity, getUpdatePriority, getVisibleZoomRange, hashCode, isPostProcessed, isVisible, refresh, setCullDelay, setMetaData, setMetaDataElement, setOpacity, setPostProcessed, setUpdatePriority, setVisible, setVisibleZoomRange, simulateClick, update
-
Constructor Details
-
CelestialLayer
public CelestialLayer()
-
-
Method Details
-
add
Adds an object to the layer.- Parameters:
object- The object to add.
-
addAll
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
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
Returns all objects of the layer.- Returns:
- The objects of the layer.
-
getCelestialEventListener
Returns the object event listener.- Returns:
- The object event listener.
-
setCelestialEventListener
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:LayerTests whether this layer is being currently updated.- Overrides:
isUpdateInProgressin classLayer- Returns:
- True when the layer is being updated or false when the layer is in steady state.
-