Class OrderedGroup
- Direct Known Subclasses:
DecalGroup
When the child index order array is non-null, it must be the same
length as the number of children. Every entry in the array must
have a unique value between 0 and numChildren-1
(i.e.,
there must be no duplicate values and no missing indices). The
order that the child indices appear in the child index order array
determines the order in which the children are rendered. The child
at childIndexOrder[0]
is rendered first, followed by
childIndexOrder[1]
, and so on, with the child at
childIndexOrder[numChildren-1]
rendered
last.
The child index order array only affects rendering. List operations that refer to a child by index, such as getChild(index), will not be altered by the entries in this array. They will get, enumerate, add, remove, etc., the children based on the actual index in the group node. However, some of the list operations, such as addChild, removeChild, etc., will update the child index order array as a result of their operation. For example, removeChild will remove the entry in the child index order array corresponding to the removed child's index and adjust the remaining entries accordingly. See the documentation for these methods for more details.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Specifies that this OrderedGroup node allows reading its child index order information.static final int
Specifies that this OrderedGroup node allows writing its child index order information.Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE
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_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.void
Appends the specified child node to this group node's list of children, and sets the child index order array to the specified array.cloneNode
(boolean forceDuplicate) Used to create a new instance of the node.int[]
Retrieves the current childIndexOrder array.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.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
setChildIndexOrder
(int[] childIndexOrder) Sets the childIndexOrder array.Methods inherited from class javax.media.j3d.Group
getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, indexOfChild, numChildren, setAlternateCollisionTarget, setChild, setCollisionBounds
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_CHILD_INDEX_ORDER_READ
public static final int ALLOW_CHILD_INDEX_ORDER_READSpecifies that this OrderedGroup node allows reading its child index order information.- Since:
- Java 3D 1.3
- See Also:
-
ALLOW_CHILD_INDEX_ORDER_WRITE
public static final int ALLOW_CHILD_INDEX_ORDER_WRITESpecifies that this OrderedGroup node allows writing its child index order information.- Since:
- Java 3D 1.3
- See Also:
-
-
Constructor Details
-
OrderedGroup
public OrderedGroup()Constructs and initializes a new OrderedGroup node object. The childIndexOrder array is initialized to null, meaning that its children are rendered in increasing index order.
-
-
Method Details
-
setChildIndexOrder
public void setChildIndexOrder(int[] childIndexOrder) Sets the childIndexOrder array. If the specified array is null, this node's childIndexOrder array is set to null. Its children will then be rendered in increasing index order. If the specified array is not null, the entire array is copied to this node's childIndexOrder array. In this case, the length of the array must be equal to the number of children in this group, and every entry in the array must have a unique value between 0 andnumChildren-1
(i.e., there must be no duplicate values and no missing indices).- Parameters:
childIndexOrder
- the array that is copied into this node's child index order array; this can be null- Throws:
IllegalArgumentException
- if the specified array is non-null and any of the following are true:childIndexOrder.length != numChildren
;childIndexOrder[
i] invalid input: '<' 0
, for i in[0, numChildren-1]
;childIndexOrder[
i] >= numChildren
, for i in[0, numChildren-1]
;childIndexOrder[
i] == childIndexOrder[
j]
, for i,j in[0, numChildren-1]
, i!=
j;
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getChildIndexOrder
public int[] getChildIndexOrder()Retrieves the current childIndexOrder array.- Returns:
- a copy of this node's childIndexOrder array; this can be null.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
addChild
Appends the specified child node to this group node's list of children, and sets the child index order array to the specified array. If the specified array is null, this node's childIndexOrder array is set to null. Its children will then be rendered in increasing index order. If the specified array is not null, the entire array is copied to this node's childIndexOrder array. In this case, the length of the array must be equal to the number of children in this group after the new child has been added, and every entry in the array must have a unique value between 0 andnumChildren-1
(i.e., there must be no duplicate values and no missing indices).- Parameters:
child
- the child to add to this node's list of childrenchildIndexOrder
- the array that is copied into this node's child index order array; this can be null- 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.IllegalArgumentException
- if the specified array is non-null and any of the following are true:childIndexOrder.length != numChildren
;childIndexOrder[
i] invalid input: '<' 0
, for i in[0, numChildren-1]
;childIndexOrder[
i] >= numChildren
, for i in[0, numChildren-1]
;childIndexOrder[
i] == childIndexOrder[
j]
, for i,j in[0, numChildren-1]
, i!=
j;
- Since:
- Java 3D 1.3
-
addChild
Appends the specified child node to this group node's list of children.If the current child index order array is non-null, the array is increased in size by one element, and a new element containing the index of the new child is added to the end of the array. Thus, this new child will be rendered last.
- Overrides:
addChild
in classGroup
- 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.- Since:
- Java 3D 1.3
-
insertChild
Inserts the specified child node in this group node's list of children at the specified index. This method is only supported when the child index order array is null.- Overrides:
insertChild
in classGroup
- 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.IllegalStateException
- if the childIndexOrder array is not null.- Since:
- Java 3D 1.3
-
removeChild
public void removeChild(int index) Removes the child node at the specified index from this group node's list of children.If the current child index order array is non-null, the element containing the removed child's index will be removed from the child index order array, and the array will be reduced in size by one element. If the child removed was not the last child in the Group, the values of the child index order array will be updated to reflect the indices that were renumbered. More formally, each child whose index in the Group node was greater than the removed element (before removal) will have its index decremented by one.
- Overrides:
removeChild
in classGroup
- 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.- Since:
- Java 3D 1.3
-
moveTo
Moves the specified branch group node from its existing location to the end of this group node's list of children.If the current child index order array is non-null, the array is increased in size by one element, and a new element containing the index of the new child is added to the end of the array. Thus, this new child will be rendered last.
- Overrides:
moveTo
in classGroup
- 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- 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.If the current child index order array is non-null, the element containing the removed child's index will be removed from the child index order array, and the array will be reduced in size by one element. If the child removed was not the last child in the Group, the values of the child index order array will be updated to reflect the indices that were renumbered. More formally, each child whose index in the Group node was greater than the removed element (before removal) will have its index decremented by one.
- Overrides:
removeChild
in classGroup
- 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.If the current child index order array is non-null, then it is set to a zero-length array (the empty set). Note that a zero-length child index order array is not the same as a null array in that as new elements are added, the child index order array will grow and will be used instead of the Group's natural child order.
- Overrides:
removeAllChildren
in classGroup
- 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
-
cloneNode
Used to create a new instance of the node. This routine is called bycloneTree
to duplicate the current node.
-