Package gaiasky.scenegraph
Class AbstractSceneGraph
java.lang.Object
gaiasky.scenegraph.AbstractSceneGraph
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,ISceneGraph
- Direct Known Subclasses:
SceneGraph
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanDoes it contain an octreeprotected booleanDoes it contain a star groupMap from integer to position with all Hipparcos stars, for the constellationsprotected int[]Number of objects per threadThe root of the treeprotected com.badlogic.gdx.utils.ObjectMap<String,SceneGraphNode>Quick lookup map. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidUpdates the string to node map and the star map if necessary.protected voidaddToIndex(SceneGraphNode node, com.badlogic.gdx.utils.ObjectMap<String,SceneGraphNode> map)booleancontainsNode(String name)Whether this scene graphs contains a node with the given namevoiddispose()com.badlogic.gdx.utils.Array<IFocus>intReturns 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()intgetSize()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 nodevoidmatchingFocusableNodes(String name, com.badlogic.gdx.utils.Array<String> results)Returns focusable nodes matching the given string, to a maximum of 10voidmatchingFocusableNodes(String name, com.badlogic.gdx.utils.Array<String> results, int maxResults, AtomicBoolean abort)Returns focusable nodes matching the given string, to a maximum ofmaxResults.voidremove(SceneGraphNode node, boolean removeFromIndex)Removes a nodevoidRemoves the info of the node from the aux lists.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gaiasky.scenegraph.ISceneGraph
update
-
Field Details
-
root
The root of the tree -
stringToNode
Quick lookup map. Name to node. -
hipMap
Map from integer to position with all Hipparcos stars, for the constellations -
objectsPerThread
protected int[] objectsPerThreadNumber of objects per thread -
hasOctree
protected boolean hasOctreeDoes it contain an octree -
hasStarGroup
protected boolean hasStarGroupDoes it contain a star group
-
-
Constructor Details
-
AbstractSceneGraph
public AbstractSceneGraph(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:
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
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
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<String,SceneGraphNode> map) -
addNodeAuxiliaryInfo
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
Description copied from interface:ISceneGraphRemoves the info of the node from the aux lists.- Specified by:
removeNodeAuxiliaryInfoin interfaceISceneGraph- Parameters:
node- The node to remove
-
matchingFocusableNodes
Description copied from interface:ISceneGraphReturns focusable nodes matching the given string, to a maximum of 10- Specified by:
matchingFocusableNodesin interfaceISceneGraph- Parameters:
name- The nameresults- The results
-
matchingFocusableNodes
public void matchingFocusableNodes(String name, com.badlogic.gdx.utils.Array<String> results, int maxResults, AtomicBoolean abort)Description copied from interface:ISceneGraphReturns focusable nodes matching the given string, to a maximum ofmaxResults.- Specified by:
matchingFocusableNodesin 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: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
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
- Specified by:
getNodesin interfaceISceneGraph
-
getFocusableObjects
- Specified by:
getFocusableObjectsin interfaceISceneGraph
-
findFocus
- 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
- Specified by:
getRootin interfaceISceneGraph
-
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
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.
-