Package gaiasky.scenegraph
Class SceneGraph
java.lang.Object
gaiasky.scenegraph.SceneGraph
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,ISceneGraph
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Does it contain an octreeprotected boolean
Does it contain a star groupMap from integer to position with all Hipparcos stars, for the constellationsprotected final Map<String,
SceneGraphNode> Quick lookup map.The root of the tree -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Updates the string to node map and the star map if necessary.protected boolean
addToIndex
(SceneGraphNode node) Adds the given node to the index.boolean
containsNode
(String name) Whether this scene graphs contains a node with the given namevoid
dispose()
com.badlogic.gdx.utils.Array<IFocus>
int
Returns the node with the given name, or null if it does not exist.com.badlogic.gdx.utils.Array<SceneGraphNode>
getNodes()
double[]
getObjectPosition
(String name, double[] out) Gets the current position of the object identified by the given name.getRoot()
int
getSize()
Gets a star map: HIP -> IPosition It only contains the stars with HIP numbervoid
initialize
(com.badlogic.gdx.utils.Array<SceneGraphNode> nodes, ITimeFrameProvider time, boolean hasOctree, boolean hasStarGroup) Builds the scene graph using the given nodes.void
insert
(SceneGraphNode node, boolean addToIndex) Inserts a nodevoid
matchingFocusableNodes
(String name, SortedSet<String> results) Returns focusable nodes matching the given string, to a maximum of 10.void
matchingFocusableNodes
(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort) Returns focusable nodes matching the given string, to a maximum ofmaxResults
.void
remove
(SceneGraphNode node, boolean removeFromIndex) Removes a nodevoid
Removes the info of the node from the aux lists.void
update
(ITimeFrameProvider time, ICamera camera) Updates the nodes of this scene graph
-
Field Details
-
root
The root of the tree -
index
Quick lookup map. Name to node. -
hipMap
Map from integer to position with all Hipparcos stars, for the constellations -
hasOctree
protected boolean hasOctreeDoes it contain an octree -
hasStarGroup
protected boolean hasStarGroupDoes it contain a star group
-
-
Constructor Details
-
SceneGraph
public SceneGraph(int numNodes)
-
-
Method Details
-
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:
initialize
in 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
-
update
Description copied from interface:ISceneGraph
Updates the nodes of this scene graph- Specified by:
update
in interfaceISceneGraph
- Parameters:
time
- The current time providercamera
- The current camera
-
insert
Description copied from interface:ISceneGraph
Inserts a node- Specified by:
insert
in interfaceISceneGraph
- Parameters:
node
- The node to addaddToIndex
- Whether to add the ids of this node to the index
-
remove
Description copied from interface:ISceneGraph
Removes a node- Specified by:
remove
in interfaceISceneGraph
- Parameters:
node
- The node to removeremoveFromIndex
- Whether to remove the ids of this node from the index
-
addToIndex
Adds the given node to the index. Returns false if it was not added due to a naming conflict (name already exists) with the same object (same class and same names).- Parameters:
node
- The node to add.- Returns:
- False if the object already exists.
-
addNodeAuxiliaryInfo
Description copied from interface:ISceneGraph
Updates the string to node map and the star map if necessary.- Specified by:
addNodeAuxiliaryInfo
in interfaceISceneGraph
- Parameters:
node
- The node to add
-
removeNodeAuxiliaryInfo
Description copied from interface:ISceneGraph
Removes the info of the node from the aux lists.- Specified by:
removeNodeAuxiliaryInfo
in interfaceISceneGraph
- Parameters:
node
- The node to remove
-
matchingFocusableNodes
Description copied from interface:ISceneGraph
Returns focusable nodes matching the given string, to a maximum of 10.- Specified by:
matchingFocusableNodes
in interfaceISceneGraph
- Parameters:
name
- The name.results
- The results.
-
matchingFocusableNodes
public void matchingFocusableNodes(String name, SortedSet<String> results, int maxResults, AtomicBoolean abort) Description copied from interface:ISceneGraph
Returns focusable nodes matching the given string, to a maximum ofmaxResults
.- Specified by:
matchingFocusableNodes
in interfaceISceneGraph
- Parameters:
name
- The name.results
- The results.maxResults
- The maximum number of results.abort
- To enable abortion mid-computation.
-
containsNode
Description copied from interface:ISceneGraph
Whether this scene graphs contains a node with the given name- Specified by:
containsNode
in interfaceISceneGraph
- Parameters:
name
- The name- Returns:
- True if this scene graph contains the node, false otherwise
-
getNode
Description copied from interface:ISceneGraph
Returns the node with the given name, or null if it does not exist.- Specified by:
getNode
in interfaceISceneGraph
- Parameters:
name
- The name of the node.- Returns:
- The node with the name.
-
getNodes
- Specified by:
getNodes
in interfaceISceneGraph
-
getFocusableObjects
- Specified by:
getFocusableObjects
in interfaceISceneGraph
-
findFocus
- Specified by:
findFocus
in interfaceISceneGraph
-
getSize
public int getSize()- Specified by:
getSize
in interfaceISceneGraph
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
getRoot
- Specified by:
getRoot
in interfaceISceneGraph
-
getStarMap
Description copied from interface:ISceneGraph
Gets a star map: HIP -> IPosition It only contains the stars with HIP number- Specified by:
getStarMap
in interfaceISceneGraph
- Returns:
- The HIP star map
-
getNObjects
public int getNObjects() -
getObjectPosition
Description copied from interface:ISceneGraph
Gets 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:
getObjectPosition
in 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.
-