Xj3D VRML/X3D Code API

org.web3d.vrml.nodes
Class SceneGraphTraverser

java.lang.Object
  extended byorg.web3d.vrml.nodes.SceneGraphTraverser

public class SceneGraphTraverser
extends java.lang.Object

Utility class that traverses a live VRML scene graph.

Version:
$Revision: 1.22 $
Author:
Justin Couch

Constructor Summary
SceneGraphTraverser()
          Create a new traverser ready to go.
 
Method Summary
 void reset()
          Clear the use map.
 void setErrorReporter(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 setObserver(SceneGraphTraversalDetailObserver obs)
          Set the detailObs to be used.
 void setObserver(SceneGraphTraversalSimpleObserver obs)
          Set the detailObs 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SceneGraphTraverser

public SceneGraphTraverser()
Create a new traverser ready to go.

Method Detail

setErrorReporter

public void setErrorReporter(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

public void setObserver(SceneGraphTraversalDetailObserver obs)
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

public void setObserver(SceneGraphTraversalSimpleObserver obs)
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

traverseGraph

public void traverseGraph(VRMLNode source)
                   throws java.lang.IllegalStateException
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 calling traverseGraph(null, source);.

Parameters:
source - The root of the scene graph to traverse
Throws:
java.lang.IllegalStateException - Attempt to call this method while it is currently traversing a scene graph

traverseGraph

public void traverseGraph(VRMLNode parent,
                          VRMLNode source)
                   throws java.lang.IllegalStateException
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:
source - The root of the scene graph to traverse
Throws:
java.lang.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


Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium