javax.media.j3d
Class Group

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.Node
              |
              +--javax.media.j3d.Group
Direct Known Subclasses:
BranchGroup, OrderedGroup, SharedGroup, Switch, TransformGroup

public class Group
extends Node

Group object.


Field Summary
static int ALLOW_CHILDREN_EXTEND
          Specifies that this Group node allows adding new children.
static int ALLOW_CHILDREN_READ
          Specifies that this Group node allows reading its children.
static int ALLOW_CHILDREN_WRITE
          Specifies that this Group node allows writing its children.
static int ALLOW_COLLISION_BOUNDS_READ
          Specifies that this Group node allows reading its collision Bounds
static int ALLOW_COLLISION_BOUNDS_WRITE
          Specifies that this Group node allows writing its collision Bounds
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_PICK, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
Group()
          Constructs a Group node with default parameters.
 
Method Summary
 void addChild(Node child)
          Appends the specified child to this node's list of children.
 Node cloneNode(boolean forceDuplicate)
          Used to create a new instance of the node.
 void duplicateNode(Node originalNode, boolean forceDuplicate)
          Copies all node information from originalNode into the current node.
 java.util.Enumeration getAllChildren()
          Returns an Enumeration object of all children.
 boolean getAlternateCollisionTarget()
          Returns the collision target state.
 Node getChild(int index)
          Returns the node's index selected child.
 Bounds getCollisionBounds()
          Returns the collision bounding object of this node.
 void insertChild(Node child, int index)
          Inserts the node's specified child at the specified index location.
 void moveTo(BranchGroup branchGroup)
          Moves the specified branch group node from its existing location to the end of this node's list of children.
 int numChildren()
          Returns a count of this nodes' children.
 void removeChild(int index)
          Removes the node's child at the specified index location.
 void setAlternateCollisionTarget(boolean target)
          Causes this Group node to be reported as the collision target when collision is being used and this node or any of its children is in a collision.
 void setChild(Node child, int index)
          Replaces the node's specified child with the child provided.
 void setCollisionBounds(Bounds bounds)
          Sets the collision bounds of a node.
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, getBounds, getBoundsAutoCompute, getCollidable, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_CHILDREN_READ

public static final int ALLOW_CHILDREN_READ
Specifies that this Group node allows reading its children.

ALLOW_CHILDREN_WRITE

public static final int ALLOW_CHILDREN_WRITE
Specifies that this Group node allows writing its children.

ALLOW_CHILDREN_EXTEND

public static final int ALLOW_CHILDREN_EXTEND
Specifies that this Group node allows adding new children.

ALLOW_COLLISION_BOUNDS_READ

public static final int ALLOW_COLLISION_BOUNDS_READ
Specifies that this Group node allows reading its collision Bounds

ALLOW_COLLISION_BOUNDS_WRITE

public static final int ALLOW_COLLISION_BOUNDS_WRITE
Specifies that this Group node allows writing its collision Bounds
Constructor Detail

Group

public Group()
Constructs a Group node with default parameters. The default values are as follows:
Method Detail

setCollisionBounds

public final void setCollisionBounds(Bounds bounds)
Sets the collision bounds of a node.
Parameters:
bounds - the collision bounding object for a node
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getCollisionBounds

public final Bounds getCollisionBounds()
Returns the collision bounding object of this node.
Returns:
the node's collision bounding object
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setChild

public final void setChild(Node child,
                           int index)
Replaces the node's specified child with the child provided.
Parameters:
child - the new child
index - which child to replace. The 'index' must be a value greater than or equal to 0 and less than numChildren().
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph
RestrictedAccessException - if this group node is part of live or compiled scene graph and the child node being set is not a BranchGroup node
MultipleParentException - if 'child' has already been added as a child of another group node.
ArrayIndexOutOfBoundsException - if 'index' was invalid.

insertChild

public final void insertChild(Node child,
                              int index)
Inserts the node's specified child at the specified index location.
Parameters:
child - the new child
index - at which location to insert. The 'index' must be a value greater than or equal to 0 and less than numChildren().
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph
RestrictedAccessException - if this group node is part of live or compiled scene graph and the child node being inserted is not a BranchGroup node
MultipleParentException - if 'child' has already been added as a child of another group node.
ArrayIndexOutOfBoundsException - if 'index' was invalid.

removeChild

public final void removeChild(int index)
Removes the node's child at the specified index location.
Parameters:
index - which child to remove. The 'index' must be a value greater than or equal to 0 and less than numChildren().
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph
RestrictedAccessException - if this group node is part of live or compiled scene graph and the child node being removed is not a BranchGroup node
ArrayIndexOutOfBoundsException - if 'index' was invalid.

getChild

public final Node getChild(int index)
Returns the node's index selected child.
Parameters:
index - which child to return.
Returns:
the children at location index. The 'index' must be a value greater than or equal to 0 and less than numChildren().
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph
ArrayIndexOutOfBoundsException - if 'index' was invalid.

getAllChildren

public final java.util.Enumeration getAllChildren()
Returns an Enumeration object of all children.
Returns:
an Enumeration object of all the children
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph

addChild

public final void addChild(Node child)
Appends the specified child to this node's list of children.
Parameters:
child - the child to add to this node's list of children
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph
RestrictedAccessException - if this group node is part of live or compiled scene graph and the child node being added is not a BranchGroup node
MultipleParentException - if 'child' has already been added as a child of another group node.

moveTo

public final void moveTo(BranchGroup branchGroup)
Moves the specified branch group node from its existing location to the end of this node's list of children.
Parameters:
branchGroup - the branch group node to move to this node's list of children
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph

numChildren

public final int numChildren()
Returns a count of this nodes' children.
Returns:
the number of children descendant from this node.
Throws:
CapabilityNotSetException - if the appropriate capability is not set and this group node is part of live or compiled scene graph

setAlternateCollisionTarget

public final void setAlternateCollisionTarget(boolean target)
Causes this Group node to be reported as the collision target when collision is being used and this node or any of its children is in a collision. The default value is false. For collision with USE_GEOMETRY set, the collision traverser will check the geometry of all the Group node's leaf descendants; for collision with USE_BOUNDS set, the collision traverser will only check the bounds at this Group node. In both cases, if there is a collision, this Group node will be reported as the colliding object in the SceneGraphPath. This reporting is done regardless of whether ENABLE_COLLISION_REPORTING is set for this group node (setting alternate collision target to true implies collision reporting).
Parameters:
target - Indicates whether this Group node can be the target of a collision.
See Also:
WakeupOnCollisionEntry, WakeupOnCollisionMovement, WakeupOnCollisionExit

getAlternateCollisionTarget

public final boolean getAlternateCollisionTarget()
Returns the collision target state.
Returns:
Indicates whether this Group node can be the target of a collision.

cloneNode

public Node cloneNode(boolean forceDuplicate)
Used to create a new instance of the node. This routine is called by cloneTree to duplicate the current node.
Overrides:
cloneNode in class Node
Parameters:
forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.
See Also:
Node.cloneTree(), Node.cloneNode(boolean), Node.duplicateNode(javax.media.j3d.Node, boolean), NodeComponent.setDuplicateOnCloneTree(boolean)

duplicateNode

public void duplicateNode(Node originalNode,
                          boolean forceDuplicate)
Copies all node information from originalNode into the current node. This method is called from the cloneNode method which is, in turn, called by the cloneTree method.

For any NodeComponent objects contained by the object being duplicated, each NodeComponent object's duplicateOnCloneTree value is used to determine whether the NodeComponent should be duplicated in the new node or if just a reference to the current node should be placed in the new node. This flag can be overridden by setting the forceDuplicate parameter in the cloneTree method to true.

Overrides:
duplicateNode in class Node
Parameters:
originalNode - the original node to duplicate.
forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.
See Also:
cloneNode(boolean), Node.duplicateNode(javax.media.j3d.Node, boolean), Node.cloneTree(), NodeComponent.setDuplicateOnCloneTree(boolean)