Package gaiasky.scenegraph
Class AbstractSceneGraph
- java.lang.Object
-
- gaiasky.scenegraph.AbstractSceneGraph
-
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,ISceneGraph
- Direct Known Subclasses:
SceneGraph
public abstract class AbstractSceneGraph extends java.lang.Object implements ISceneGraph
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanhasOctreeDoes it contain an octreeprotected booleanhasStarGroupDoes it contain a star groupprotected com.badlogic.gdx.utils.IntMap<IPosition>hipMapMap from integer to position with all Hipparcos stars, for the constellationsprotected int[]objectsPerThreadNumber of objects per threadSceneGraphNoderootThe root of the treeprotected com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode>stringToNodeQuick lookup map.
-
Constructor Summary
Constructors Constructor Description AbstractSceneGraph()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNodeAuxiliaryInfo(SceneGraphNode node)Updates the string to node map and the star map if necessary.protected voidaddToIndex(SceneGraphNode node, com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode> map)booleancontainsNode(java.lang.String name)Whether this scene graphs contains a node with the given namevoiddispose()IFocusfindFocus(java.lang.String name)com.badlogic.gdx.utils.Array<IFocus>getFocusableObjects()intgetNObjects()SceneGraphNodegetNode(java.lang.String name)Returns the node with the given name, or null if it does not exist.com.badlogic.gdx.utils.Array<SceneGraphNode>getNodes()double[]getObjectPosition(java.lang.String name, double[] out)Gets the current position of the object identified by the given name.SceneGraphNodegetRoot()intgetSize()com.badlogic.gdx.utils.IntMap<IPosition>getStarMap()Gets a star map: HIP -> IPosition It only contains the stars with HIP numbervoidinitialize(com.badlogic.gdx.utils.Array<SceneGraphNode> nodes, ITimeFrameProvider time, boolean hasOctree, boolean hasStarGroup)Builds the scene graph using the given nodes.voidinsert(SceneGraphNode node, boolean addToIndex)Inserts a nodevoidremove(SceneGraphNode node, boolean removeFromIndex)Removes a nodevoidremoveNodeAuxiliaryInfo(SceneGraphNode node)Removes the info of the node from the aux lists.voidupdate(ITimeFrameProvider time, ICamera camera)Updates the nodes of this scene graph
-
-
-
Field Detail
-
root
public SceneGraphNode root
The root of the tree
-
stringToNode
protected com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode> stringToNode
Quick lookup map. Name to node.
-
hipMap
protected com.badlogic.gdx.utils.IntMap<IPosition> hipMap
Map from integer to position with all Hipparcos stars, for the constellations
-
objectsPerThread
protected int[] objectsPerThread
Number of objects per thread
-
hasOctree
protected boolean hasOctree
Does it contain an octree
-
hasStarGroup
protected boolean hasStarGroup
Does it contain a star group
-
-
Method Detail
-
initialize
public void initialize(com.badlogic.gdx.utils.Array<SceneGraphNode> nodes, ITimeFrameProvider time, boolean hasOctree, boolean hasStarGroup)
Builds the scene graph using the given nodes.- Specified by:
initializein interfaceISceneGraph- Parameters:
nodes- The list of nodestime- The time providerhasOctree- Whether the list of nodes contains an octreehasStarGroup- Whether the list contains a star group
-
insert
public void insert(SceneGraphNode node, boolean addToIndex)
Description copied from interface:ISceneGraphInserts a node- Specified by:
insertin interfaceISceneGraph- Parameters:
node- The node to addaddToIndex- Whether to add the ids of this node to the index
-
remove
public void remove(SceneGraphNode node, boolean removeFromIndex)
Description copied from interface:ISceneGraphRemoves a node- Specified by:
removein interfaceISceneGraph- Parameters:
node- The node to removeremoveFromIndex- Whether to remove the ids of this node from the index
-
addToIndex
protected void addToIndex(SceneGraphNode node, com.badlogic.gdx.utils.ObjectMap<java.lang.String,SceneGraphNode> map)
-
update
public void update(ITimeFrameProvider time, ICamera camera)
Description copied from interface:ISceneGraphUpdates the nodes of this scene graph- Specified by:
updatein interfaceISceneGraph- Parameters:
time- The current time providercamera- The current camera
-
addNodeAuxiliaryInfo
public void addNodeAuxiliaryInfo(SceneGraphNode node)
Description copied from interface:ISceneGraphUpdates the string to node map and the star map if necessary.- Specified by:
addNodeAuxiliaryInfoin interfaceISceneGraph- Parameters:
node- The node to add
-
removeNodeAuxiliaryInfo
public void removeNodeAuxiliaryInfo(SceneGraphNode node)
Description copied from interface:ISceneGraphRemoves the info of the node from the aux lists.- Specified by:
removeNodeAuxiliaryInfoin interfaceISceneGraph- Parameters:
node- The node to remove
-
containsNode
public boolean containsNode(java.lang.String name)
Description copied from interface:ISceneGraphWhether this scene graphs contains a node with the given name- Specified by:
containsNodein interfaceISceneGraph- Parameters:
name- The name- Returns:
- True if this scene graph contains the node, false otherwise
-
getNode
public SceneGraphNode getNode(java.lang.String name)
Description copied from interface:ISceneGraphReturns the node with the given name, or null if it does not exist.- Specified by:
getNodein interfaceISceneGraph- Parameters:
name- The name of the node.- Returns:
- The node with the name.
-
getNodes
public com.badlogic.gdx.utils.Array<SceneGraphNode> getNodes()
- Specified by:
getNodesin interfaceISceneGraph
-
getFocusableObjects
public com.badlogic.gdx.utils.Array<IFocus> getFocusableObjects()
- Specified by:
getFocusableObjectsin interfaceISceneGraph
-
findFocus
public IFocus findFocus(java.lang.String name)
- Specified by:
findFocusin interfaceISceneGraph
-
getSize
public int getSize()
- Specified by:
getSizein interfaceISceneGraph
-
dispose
public void dispose()
- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
getRoot
public SceneGraphNode getRoot()
- Specified by:
getRootin interfaceISceneGraph
-
getStarMap
public com.badlogic.gdx.utils.IntMap<IPosition> getStarMap()
Description copied from interface:ISceneGraphGets a star map: HIP -> IPosition It only contains the stars with HIP number- Specified by:
getStarMapin interfaceISceneGraph- Returns:
- The HIP star map
-
getNObjects
public int getNObjects()
-
getObjectPosition
public double[] getObjectPosition(java.lang.String name, double[] out)Description copied from interface:ISceneGraphGets the current position of the object identified by the given name. The given position is in the internal reference system and corrects stars for proper motions and other objects for their specific motions as well.- Specified by:
getObjectPositionin interfaceISceneGraph- Parameters:
name- The name of the objectout- The out double array- Returns:
- The out double array if the object exists, has a position and out has 3 or more slots. Null otherwise.
-
-