Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class SharedGroup2D

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.Node
          extended by org.j3d.aviatrix3d.Node2D
              extended by org.j3d.aviatrix3d.Group2D
                  extended by org.j3d.aviatrix3d.SharedGroup2D
All Implemented Interfaces:
GroupPickTarget, PickableObject, PickTarget, Cullable, GroupCullable

public class SharedGroup2D
extends Group2D

A grouping 2D 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 Node2D to provide the shared functionality.

Internationalisation Resource Names

Version:
$Revision: 2.6 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Group2D
childList, cullList, 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_TIMING_ERR_PROP, updateHandler
 
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
SharedGroup2D()
          The default constructor
 
Method Summary
protected  void checkForCyclicParent(SceneGraphObject child)
          Check to see if this node is the same reference as the passed node.
 Cullable getCullableParent()
          Get the parent cullable of this instance.
 Node getParent()
          Overridden to always return the current first parent in the list.
 void getParents(Node2D[] parents)
          Get the listing of the number of parents that this node currently has.
 boolean hasMultipleParents()
          Check to see if this cullable is mulitparented.
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.
 void setLive(Node caller, boolean state)
          Overloaded version of the notification that this object's liveness state has changed.
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.Group2D
addChild, checkForCyclicChild, checkPickMask, getAllChildren, getChild, getCullableChildren, getPickableBounds, getPickableChild, getPickableChildren, getPickMask, getPickTargetType, indexOfChild, numChildren, numCullableChildren, numPickableChildren, 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, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.GroupCullable
getBounds
 

Constructor Detail

SharedGroup2D

public SharedGroup2D()
The default constructor

Method Detail

hasMultipleParents

public boolean hasMultipleParents()
Check to see if this cullable is mulitparented. If it is, then that will cause problems for code that needs to know information like the transformation to the root of the scene graph.

Specified by:
hasMultipleParents in interface GroupCullable
Overrides:
hasMultipleParents in class Group2D
Returns:
true if there are multiple parents

getCullableParent

public Cullable getCullableParent()
Get the parent cullable of this instance. If this node has multiple direct parents, then this should return null.

Specified by:
getCullableParent in interface GroupCullable
Overrides:
getCullableParent in class Group2D
Returns:
The parent instance or null if none

setLive

public void setLive(Node caller,
                    boolean state)
Overloaded version of the notification that this object's liveness state has changed. We overload with the caller so that for shared

Parameters:
caller - The node calling us with the state changes
state - true if this should be marked as live now

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 Group2D

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 Group2D

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

setLive

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

Overrides:
setLive in class Group2D
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

numParents

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

Returns:
a positive number

getParents

public void getParents(Node2D[] 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

Aviatrix3D
2.1.0

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