Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class BaseNode

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.Node
          extended by org.j3d.aviatrix3d.BaseNode
Direct Known Subclasses:
BaseGroup, OctTree

public abstract class BaseNode
extends Node

A general purpose container class to allow end users to extend the basic Node capabilities, while still providing a way to manage scene graph state such as liveness calls and update handlers.

A lot of the state calls of children can only be called by extending the class and calling protected methods. When a child scenegraph object is defined for a collection of children outside of the base aviatrix3d package there is no way for passing in liveness state due to the protected nature of the required methods. This class provides methods that allow a derived class to call back into the package and set those states.

Version:
$Revision: 2.1 $
Author:
Alan Hudson, Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Constructor Summary
protected BaseNode()
          The default constructor
 
Method Summary
protected  void checkForCyclicChild(SceneGraphObject node, SceneGraphObject parent)
          Check to see if this node is the same reference as the passed node that is a parent of this node.
protected  void checkForCyclicParent(SceneGraphObject node, SceneGraphObject child)
          Check to see if this node is the same reference as the passed node.
protected  void clearUpdateHandler(SceneGraphObject node)
          Clear the scenegraph update handler for this node.
protected  void removeParent(Node node, Node p)
          Remove a parent from this node.
protected  void setLive(SceneGraphObject node, boolean state)
          Set the live state of the given node to this state.
protected  void setParent(Node node, Node p)
          Specify this nodes parent.
protected  void setUpdateHandler(SceneGraphObject node)
          Set the scenegraph update handler for this node.
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, markBoundsDirty, recomputeBounds, removeParent, requestBoundsUpdate, setBounds, setParent, updateBounds, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseNode

protected BaseNode()
The default constructor

Method Detail

setParent

protected void setParent(Node node,
                         Node p)
                  throws AlreadyParentedException
Specify this nodes parent. Should not be called directly by external callers. Setting a value of null will clear the existing parent. Bit broken right now as it doesn't handle multiple-parents like needed in a proper scene graph. If the node has a parent already, an exception is generated. Note that this method is ignored if the derived type is SharedGroup.

Parameters:
node - The node instance to set the parent on
p - The new parent instance to call or null
Throws:
AlreadyParentedException - There is a valid parent already set

removeParent

protected void removeParent(Node node,
                            Node p)
Remove a parent from this node. An alternate way to remove a parent from the list.

Parameters:
node - The node instance to set the parent on
p - The new parent instance to remove from the list

setLive

protected void setLive(SceneGraphObject node,
                       boolean state)
Set the live state of the given node to this state.

Parameters:
state - The new liveness state to set
node - The node instance to set the live state on

checkForCyclicParent

protected void checkForCyclicParent(SceneGraphObject node,
                                    SceneGraphObject child)
                             throws CyclicSceneGraphStructureException
Check to see if this node is the same reference as the passed node. This is the upwards check to ensure that there is no cyclic scene graph structures at the point where someone adds a node to the scenegraph. When the reference and this are the same, an exception is generated.

Parameters:
child - The reference to check against this class
node - The node instance to check on
Throws:
CyclicSceneGraphStructureException - Equal parent and child

checkForCyclicChild

protected void checkForCyclicChild(SceneGraphObject node,
                                   SceneGraphObject parent)
                            throws CyclicSceneGraphStructureException
Check to see if this node is the same reference as the passed node that is a parent of this node. This is the downwards check to ensure that there is no cyclic scene graph structures at the point where someone adds a node to the scenegraph. When the reference and this are the same, an exception is generated. Since each class may have different lists of child node setups, this should be overriden by any class that can take children, and have the call passed along to the children.

Parameters:
node - The node instance to check on
parent - The reference to check against this class
Throws:
CyclicSceneGraphStructureException - Equal parent and child

setUpdateHandler

protected void setUpdateHandler(SceneGraphObject node)
Set the scenegraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Parameters:
node - The node instance to set the state on

clearUpdateHandler

protected void clearUpdateHandler(SceneGraphObject node)
Clear the scenegraph update handler for this node.

Parameters:
node - The node instance to set the state on

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org