Package 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
,Primitive
,SharedGroup
,Switch
,TransformGroup
,ViewSpecificGroup
The Group node object is a general-purpose grouping node. Group
nodes have exactly one parent and an arbitrary number of children
that are rendered in an unspecified order (or in parallel). Null
children are allowed; no operation is performed on a null child
node. Operations on Group node objects include adding, removing,
and enumerating the children of the Group node. The subclasses of
Group node add additional semantics.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Specifies that this Group node allows adding new children.static final int
Specifies that this Group node allows reading its children.static final int
Specifies that this Group node allows writing its children.static final int
Specifies that this Group node allows reading its collision Boundsstatic final int
Specifies that this Group node allows writing its collision BoundsFields 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_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Appends the specified child node to this group node's list of children.cloneNode
(boolean forceDuplicate) Used to create a new instance of the node.Returns an Enumeration object of this group node's list of children.boolean
Returns the collision target state.getChild
(int index) Retrieves the child node at the specified index in this group node's list of children.Returns the collision bounding object of this node.int
indexOfChild
(Node child) Retrieves the index of the specified child node in this group node's list of children.void
insertChild
(Node child, int index) Inserts the specified child node in this group node's list of children at the specified index.void
moveTo
(BranchGroup branchGroup) Moves the specified branch group node from its existing location to the end of this group node's list of children.int
Returns a count of this group node's children.void
Removes all children from this Group node.void
removeChild
(int index) Removes the child node at the specified index from this group node's list of children.void
removeChild
(Node child) Removes the specified child node from this group node's list of children.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
Replaces the child node at the specified index in this group node's list of children with the specified child.void
setCollisionBounds
(Bounds bounds) Sets the collision bounds of a node.Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
-
Field Details
-
ALLOW_CHILDREN_READ
public static final int ALLOW_CHILDREN_READSpecifies that this Group node allows reading its children.- See Also:
-
ALLOW_CHILDREN_WRITE
public static final int ALLOW_CHILDREN_WRITESpecifies that this Group node allows writing its children.- See Also:
-
ALLOW_CHILDREN_EXTEND
public static final int ALLOW_CHILDREN_EXTENDSpecifies that this Group node allows adding new children.- See Also:
-
ALLOW_COLLISION_BOUNDS_READ
public static final int ALLOW_COLLISION_BOUNDS_READSpecifies that this Group node allows reading its collision Bounds- See Also:
-
ALLOW_COLLISION_BOUNDS_WRITE
public static final int ALLOW_COLLISION_BOUNDS_WRITESpecifies that this Group node allows writing its collision Bounds- See Also:
-
-
Constructor Details
-
Group
public Group()Constructs a Group node with default parameters. The default values are as follows:-
collision bounds : null
alternate collision target : false
-
-
Method Details
-
setCollisionBounds
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
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
Replaces the child node at the specified index in this group node's list of children with the specified child.- Parameters:
child
- the new childindex
- which child to replace. Theindex
must be a value greater than or equal to 0 and less thannumChildren()
.- Throws:
CapabilityNotSetException
- if the appropriate capability is not set and this group node is part of live or compiled scene graphRestrictedAccessException
- if this group node is part of live or compiled scene graph and the child node being set is not a BranchGroup nodeMultipleParentException
- ifchild
has already been added as a child of another group nodeIndexOutOfBoundsException
- ifindex
is invalid
-
insertChild
Inserts the specified child node in this group node's list of children at the specified index.- Parameters:
child
- the new childindex
- at which location to insert. Theindex
must be a value greater than or equal to 0 and less than or equal tonumChildren()
.- Throws:
CapabilityNotSetException
- if the appropriate capability is not set and this group node is part of live or compiled scene graphRestrictedAccessException
- if this group node is part of live or compiled scene graph and the child node being inserted is not a BranchGroup nodeMultipleParentException
- ifchild
has already been added as a child of another group node.IndexOutOfBoundsException
- ifindex
is invalid.
-
removeChild
public void removeChild(int index) Removes the child node at the specified index from this group node's list of children.- Parameters:
index
- which child to remove. Theindex
must be a value greater than or equal to 0 and less thannumChildren()
.- Throws:
CapabilityNotSetException
- if the appropriate capability is not set and this group node is part of live or compiled scene graphRestrictedAccessException
- if this group node is part of live or compiled scene graph and the child node being removed is not a BranchGroup nodeIndexOutOfBoundsException
- ifindex
is invalid.
-
getChild
Retrieves the child node at the specified index in this group node's list of children.- 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 thannumChildren()
. - Throws:
CapabilityNotSetException
- if the appropriate capability is not set and this group node is part of live or compiled scene graphIndexOutOfBoundsException
- ifindex
is invalid.
-
getAllChildren
Returns an Enumeration object of this group node's list of 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
Appends the specified child node to this group 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 graphRestrictedAccessException
- if this group node is part of live or compiled scene graph and the child node being added is not a BranchGroup nodeMultipleParentException
- ifchild
has already been added as a child of another group node.
-
moveTo
Moves the specified branch group node from its existing location to the end of this group 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 int numChildren()Returns a count of this group node's 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
-
indexOfChild
Retrieves the index of the specified child node in this group node's list of children.- Parameters:
child
- the child node to be looked up.- Returns:
- the index of the specified child node; returns -1 if the object is not in the list.
- Throws:
CapabilityNotSetException
- if the appropriate capability is not set and this group node is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
removeChild
Removes the specified child node from this group node's list of children. If the specified object is not in the list, the list is not modified.- Parameters:
child
- the child node to be removed.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if this group node is part of live or compiled scene graph and the child node being removed is not a BranchGroup node- Since:
- Java 3D 1.3
-
removeAllChildren
public void removeAllChildren()Removes all children from this Group node.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphRestrictedAccessException
- if this group node is part of live or compiled scene graph and any of the children being removed are not BranchGroup nodes- Since:
- Java 3D 1.3
-
setAlternateCollisionTarget
public 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:
-
getAlternateCollisionTarget
public boolean getAlternateCollisionTarget()Returns the collision target state.- Returns:
- Indicates whether this Group node can be the target of a collision.
-
cloneNode
Used to create a new instance of the node. This routine is called bycloneTree
to duplicate the current node.
-