Aviatrix3D
2.0 Dev

org.j3d.aviatrix3d
Class SharedGroup

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.Group
              extended byorg.j3d.aviatrix3d.SharedGroup
All Implemented Interfaces:
GroupPickTarget, PickableObject, PickTarget

public class SharedGroup
extends Group

A grouping node that can have multiple parents, thus allowing a graph structure to the scene graph. Normal nodes cannot have more than one parent, so this class provides the ability to have more than one. In doing so, it overrides the normal methods provided by Node to provide the shared functionality.

Version:
$Revision: 1.17 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Group
childList, dirtyBoundsCount, lastChild, pickableList, pickFlags, wkVec1, wkVec2
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickableObject
COLLIDABLE_OBJECT, GENERAL_OBJECT, PROXIMITY_OBJECT, VISIBLE_OBJECT
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickTarget
CUSTOM_PICK_TYPE, GROUP_PICK_TYPE, LEAF_PICK_TYPE, SINGLE_PICK_TYPE
 
Constructor Summary
SharedGroup()
          The default constructor
 
Method Summary
protected  void checkForCyclicParent(SceneGraphObject child)
          Check to see if this node is the same reference as the passed node.
 Node getParent()
          Overridden to always return the current first parent in the list.
 void getParents(Node[] parents)
          Get the listing of the number of parents that this node currently has.
protected  void markBoundsDirty()
          Mark this node as having dirty bounds due to one of it's children having their bounds changed.
 int numParents()
          Request the number of parents this node currently contains
protected  void removeParent(Node p)
          Remove a parent from this shared group.
protected  void setLive(boolean state)
          Notification that this object is live now.
protected  void setParent(Node p)
          Specify this nodes parent, overridden to provide behaviour that appends the node to the list rather than replacing it.
protected  void updateBounds()
          Update this node's bounds and then call the parent to update it's bounds.
 
Methods inherited from class org.j3d.aviatrix3d.Group
addChild, checkForCyclicChild, checkPickMask, getAllChildren, getChild, getPickableBounds, getPickableChild, getPickableChildren, getPickMask, getPickTargetType, getRenderableChild, indexOfChild, numChildren, numPickableChildren, numRenderableChildren, pickBatch, pickSingle, recomputeBounds, removeAllChildren, removeChild, removeChild, requestBoundsUpdate, setBounds, setChild, setPickMask, setUpdateHandler
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, getBounds, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
dataChanged, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedGroup

public SharedGroup()
The default constructor

Method Detail

markBoundsDirty

protected void markBoundsDirty()
Mark this node as having dirty bounds due to one of it's children having their bounds changed.

Overrides:
markBoundsDirty in class Group

updateBounds

protected void updateBounds()
Update this node's bounds and then call the parent to update it's bounds. Used to propogate bounds changes from the leaves of the tree to the root. A node implementation may decide when and where to tell the parent(s)s that updates are ready.

Overrides:
updateBounds in class Group

setParent

protected void setParent(Node p)
                  throws AlreadyParentedException,
                         InvalidNodeTypeException
Specify this nodes parent, overridden to provide behaviour that appends the node to the list rather than replacing it. The parent must be a group node in this case.

Overrides:
setParent in class Node
Parameters:
p - The new parent instance to add to the list
Throws:
AlreadyParentedException - There is a valid parent already set
InvalidNodeTypeException - Not a group node

removeParent

protected void removeParent(Node p)
Remove a parent from this shared group. Since setParent() cannot be used to remove a parent from the graph, you'll need to use this method to remove the parent.

Overrides:
removeParent in class Node
Parameters:
p - The new parent instance to remove from the list

getParent

public Node getParent()
Overridden to always return the current first parent in the list.

Overrides:
getParent in class Node
Returns:
parent[0] if there are any

numParents

public int numParents()
Request the number of parents this node currently contains

Returns:
a positive number

getParents

public void getParents(Node[] parents)
Get the listing of the number of parents that this node currently has. The provided array must be at least big enough to copy all the values into it.

Parameters:
parents - An array to copy the parent listing into

setLive

protected void setLive(boolean state)
Notification that this object is live now.

Overrides:
setLive in class Group
Parameters:
state - true if this should be marked as live now

checkForCyclicParent

protected void checkForCyclicParent(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. If not, then the code will find the parent of this class and invoke this same method on the parent.

Overrides:
checkForCyclicParent in class Node
Parameters:
child - The reference to check against this class
Throws:
CyclicSceneGraphStructureException - Equal parent and child

Aviatrix3D
2.0 Dev

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