Package org.web3d.vrml.nodes
Class SceneGraphTraverser
java.lang.Object
org.web3d.vrml.nodes.SceneGraphTraverser
Utility class that traverses a live VRML scene graph.
- Version:
- $Revision: 1.23 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
reset()
Clear the use map.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the script code can be reported in a nice, pretty fashion.void
Set the detailObs to be used.void
Set the simpleObs to be used.void
traverseGraph
(VRMLNode source) Traverse the given scene graph now.void
traverseGraph
(VRMLNode parent, VRMLNode source) Traverse the given scene graph now with the option of providing an explicit, parent reference.
-
Constructor Details
-
SceneGraphTraverser
public SceneGraphTraverser()Create a new traverser ready to go.
-
-
Method Details
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Parameters:
reporter
- The instance to use or null
-
setObserver
Set the detailObs to be used. If an detailObs is already set, it is replaced by the new one. A value of null will clear the current detailObs.- Parameters:
obs
- The new detailObs reference to use
-
setObserver
Set the simpleObs to be used. If an simpleObs is already set, it is replaced by the new one. A value of null will clear the current simpleObs.- Parameters:
obs
- The new simpleObs reference to use
-
traverseGraph
Traverse the given scene graph now. If the call is currently in progress then this will issue an exception. Any node can be used as the root node. If no detailObs is set, this method returns immediately. This method is equivalent to callingtraverseGraph(null, source);
.- Parameters:
source
- The root of the scene graph to traverse- Throws:
IllegalStateException
- Attempt to call this method while it is currently traversing a scene graph
-
traverseGraph
Traverse the given scene graph now with the option of providing an explicit, parent reference. If the call is currently in progress then this will issue an exception. Any node can be used as the root node. If no detailObs is set or the source is null, this method returns immediately.A explicit root may be provided for various reasons. The most common would be for loading externprotos where the root of the traversed graph is actually going to be in a separate file and scene graph structure from where we are starting this traversal from.
- Parameters:
parent
- a parent reference to the scenesource
- The root of the scene graph to traverse- Throws:
IllegalStateException
- Attempt to call this method while it is currently traversing a scene graph
-
reset
public void reset()Clear the use map. This will not be cleared between traversal calls
-