|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.umd.cs.jazz.scenegraph.ZNode
ZNode is the provides basic containment hierarchies. It maintains a bag of zero or more child nodes. The ZNode may also exhibit a visual appearance if it contains a ZVisualComponent in it's visualComponent slot. In discussion/comments, node is used interchangeably with ZNode.
ZVisualComponent| Field Summary | |
protected float |
alpha
The alpha value that will be applied to the composite field (multiplicitivly) of the graphics2D during paint. |
static float |
alpha_DEFAULT
|
protected boolean |
cacheVolatile
Cached volatility computation |
protected java.util.Vector |
cameras
All the cameras explicitly looking onto the scene graph rooted in this node. |
protected java.util.Vector |
children
This children nodes (sub-nodes) |
protected boolean |
compBoundsDirty
True if globalCompBounds is out of date and needs to be recomputed |
static boolean |
compBoundsDirty_DEFAULT
|
protected ZBounds |
globalBounds
The region (currently a rectangle) in the global space occupied by the intersection of this nodes VC and the global bounds of this nodes children |
protected boolean |
globalBoundsDirty
True if globalBounds is out of date and needs to be recomputed |
static boolean |
globalBoundsDirty_DEFAULT
|
protected ZBounds |
globalCompBounds
The region (currently a rectangle) in the global space occupied by the of this nodes VC |
protected boolean |
hidden
True if hidden (not rendered or picked) |
static boolean |
hidden_DEFAULT
|
protected boolean |
isVolatile
True if this node is specifically set to be volatile |
protected float |
maxMag
This field is checked at render time. |
static float |
maxMag_DEFAULT
|
protected float |
minMag
This field is checked at render time. |
static float |
minMag_DEFAULT
|
protected ZNode |
parent
This nodes parent |
protected java.util.Vector |
properties
|
protected boolean |
save
True if this node should be saved |
static boolean |
save_DEFAULT
|
protected ZTransform |
transform
The transform applied to this node and by inheritance all of it's children as well. |
protected ZVisualComponent |
visualComponent
The visual content of this node. |
| Constructor Summary | |
ZNode()
Constructs a new ZNode. |
|
ZNode(ZNode node)
Constructs a new ZNode that is a copy of the specified node (i.e., a "copy constructor"). |
|
ZNode(ZVisualComponent vc)
Constructs a new Znode with the specified visual component. |
|
| Method Summary | |
void |
addChild(ZNode child)
Adds a child to the node. |
void |
addProperty(java.lang.String key,
java.lang.Object value)
Add a new property to this node. |
void |
addProperty(ZProperty newProp)
Add a new property to this node. |
protected void |
clearVisualComponent()
Removes a child from the node. |
java.lang.Object |
clone()
Duplicates the current node by using the copy constructor. |
protected void |
computeGlobalBounds()
Recomputes and caches the bounds for this node. |
protected void |
computeGlobalCompBounds()
Recomputes and caches the bounds for the nodes visual component. |
java.awt.geom.AffineTransform |
computeGlobalCoordinateFrame()
Return the preConcatenation of transforms that exist between this node and the rootNode This node's transform IS included. |
protected java.awt.Composite |
createComposite(java.awt.Composite currentComposite,
float currentMag)
|
void |
damage()
Damage causes the portions of the surfaces that this object appears in to be marked as needing to be repainted. |
void |
damage(boolean boundsChanged)
Damage causes the portions of the surfaces that this object appears in to be marked as needing to be repainted. |
java.util.Vector |
findAllCameras()
Returns a list of all the cameras that look on to this node. |
java.util.Vector |
findCameras()
Returns a list of cameras that look directly at this node or any of it's parents. |
ZNode |
findNode()
A utility function that supports finding the node that references a particular visual component. |
int |
findNodes(ZFindFilter filter,
java.util.Vector nodes)
Return the list of nodes that are accepted by the specified filter in the subtree rooted with this. |
ZRootNode |
findRoot()
Traverse the tree, find the root node, and return it. |
ZVisualComponent |
findVisualComponent(java.lang.Class type)
Traverse the list of visual components, and return the first one that is of the specified Class, or null if none. |
float |
getAlpha()
Get the alpha value (transparency) for this node. |
java.util.Vector |
getCameras()
Returns this node's list of cameras. |
java.util.Vector |
getChildren()
Return the node's children. |
ZBounds |
getCompBounds()
Return the bounds of this node's visual component transformed by this node's transform. |
ZBounds |
getGlobalBounds()
Return the bounds of the union of all descendents including the node's visual component. |
ZBounds |
getGlobalCompBounds()
Returns the bounds (in global coords) for this nodes visual component. |
boolean |
getHidden()
Get the value of hidden. |
float |
getMaxMag()
Get the maximum magnification for this node. |
float |
getMinMag()
Get the minimumn magnification for this node. |
java.util.Vector |
getObjs(java.awt.geom.Rectangle2D bounds)
Returns the children within the specified bounds |
ZNode |
getParent()
Get the node's parent. |
java.util.Vector |
getProperties()
Get all the properties that this node has. |
java.lang.Object |
getProperty(java.lang.String key)
Get the property with the specified key. |
boolean |
getSave()
Determine if this node gets saved when written out. |
java.util.Vector |
getSelectedChildren()
Return a vector containing all of the nodes in the subgraph rooted at this node (including this node) that are currently selected. |
ZTransform |
getTransform()
Get the nodes transform. |
ZVisualComponent |
getVisualComponent()
Returns the visual component. |
protected void |
helpFindAllCameras(java.util.Vector result)
|
boolean |
isAncestor(ZNode queryNode)
Method to determine if node is ancenstor of queryNode. |
boolean |
isDescendent(ZNode queryNode)
Method to determine if node is a descendent of queryNode. |
boolean |
isHidden()
Get the value of hidden. |
boolean |
isVolatile()
Determines if this node is volatile. |
void |
lower()
Demotes this child one position to backwards in the node's children list. |
void |
lower(ZNode child)
Lowers this child to the back of the node's children list. |
protected void |
lowerInternal()
|
void |
lowerTo(ZNode afterNode)
Moves this child to an exact position in the node's children list. |
protected void |
lowerToInternal(ZNode afterNode)
|
void |
paint(ZRenderContext renderContext)
Paints the associated visual component and children of this node. |
ZNode |
pick(java.awt.geom.Rectangle2D rect,
float mag)
Returns the first object under the specified rectangle (if there is one) as searched in reverse (front-to-back) order. |
void |
raise()
Advances this child one position to forwards in node's children list. |
void |
raise(ZNode child)
Raises this child to the front of the node's children list. |
protected void |
raiseInternal()
|
void |
raiseTo(ZNode afterNode)
Moves this child to an exact position in the node's children list. |
protected void |
raiseToInternal(ZNode afterNode)
|
void |
removeChild(ZNode child)
Removes a child from the node. |
void |
reparent(ZNode newParent)
Move this node in the hierarchy, and update its transform so that its global position does not change. |
void |
selectAll(ZCamera camera)
Select this node's visual component. |
void |
setAlpha(float alpha)
set the alpha value (transparency) for this node. |
void |
setHidden(boolean h)
Set the value of hidden. |
void |
setMaxMag(float v)
Set the maximum magnification for this node. |
void |
setMinMag(float v)
set the minimumn magnification for this node. |
protected void |
setParent(ZNode parent)
Used internally to set a node's parent. |
void |
setSave(boolean s)
Specify if this node should be saved. |
void |
setState(java.lang.String fieldType,
java.lang.String fieldName,
java.lang.Object fieldValue)
Set some state of this object as it gets read back in. |
void |
setTransform(ZTransform v)
Set the nodes transform. |
void |
setVisualComponent(ZVisualComponent vc)
Set the visual component. |
void |
setVolatile(boolean v)
Specifies that this node is volatile. |
void |
swap(ZNode replacement)
Swaps this node out of the scenegraph tree, and replaces it with the specified replacement node. |
void |
unselectAll()
Un-Select this node's visual component. |
void |
updateBounds()
Request this node to recompute its bounds. |
void |
updateChildBounds()
Implementation of inherited interface method. |
void |
updateGlobalBounds()
Notifies the node that its cached bounds are no longer valid. |
void |
updateGlobalCompBounds()
Notifies the node that the cached bounds for its visual component are no longer valid. |
void |
updateVolatility()
Internal method to compute and cache the volatility of a node, to recursively call the parents to compute volatility. |
void |
writeObject(ZObjectOutputStream out)
Write out all of this object's state. |
void |
writeObjectRecurse(ZObjectOutputStream out)
Specify which objects this object references in order to write out the scenegraph properly |
ZSerializable |
writeReplace()
Node doesn't get written out if save property is false |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final float alpha_DEFAULT
public static final boolean compBoundsDirty_DEFAULT
public static final boolean globalBoundsDirty_DEFAULT
public static final boolean hidden_DEFAULT
public static final float minMag_DEFAULT
public static final float maxMag_DEFAULT
public static final boolean save_DEFAULT
protected ZNode parent
protected java.util.Vector children
protected ZVisualComponent visualComponent
protected transient java.util.Vector cameras
protected ZTransform transform
protected transient ZBounds globalBounds
protected transient ZBounds globalCompBounds
protected float alpha
protected float minMag
protected float maxMag
protected boolean compBoundsDirty
protected boolean globalBoundsDirty
protected boolean hidden
protected boolean isVolatile
protected boolean save
protected boolean cacheVolatile
protected java.util.Vector properties
| Constructor Detail |
public ZNode()
public ZNode(ZVisualComponent vc)
public ZNode(ZNode node)
| Method Detail |
public java.lang.Object clone()
ZNode(ZNode)public void addChild(ZNode child)
child - is the child that gets added to this.ZSurface.restore()public void removeChild(ZNode child)
child - is the child that is removed.ZSurface.restore()public java.util.Vector getChildren()
public void reparent(ZNode newParent)
newParent - the node that this node will be put underpublic void swap(ZNode replacement)
If this was a paint start point for any cameras, then it will be removed from those camera lists, and the replacement will be added to those cameras in the same position as this node was.
replacement - the new node that replaces the current node in the scenegraph tree.public void raise(ZNode child)
child - public void lower(ZNode child)
child - public void raise()
child - public void raiseTo(ZNode afterNode)
child - public void lower()
child - public void lowerTo(ZNode afterNode)
child -
protected void raiseInternal()
throws ZOperationNotAllowedException
protected void raiseToInternal(ZNode afterNode)
throws ZOperationNotAllowedException
protected void lowerInternal()
throws ZOperationNotAllowedException
protected void lowerToInternal(ZNode afterNode)
throws ZOperationNotAllowedException
public java.util.Vector getCameras()
findCameras(),
findAllCameras()public java.util.Vector findCameras()
getCameras()public java.util.Vector findAllCameras()
getCameras()protected void helpFindAllCameras(java.util.Vector result)
public boolean isVolatile()
setVolatile(boolean), or if its visual component or any of its descendants are volatile.
Volatile objects are those objects that change regularly, such as an object
that is animated, or one whose rendering depends on its context. For instance,
a selection marker ZSelectionDecorator is always one-pixel thick, and thus its bounds
depend on the current magnification.
setVolatile(boolean)public void setVolatile(boolean v)
v - the new specification of whether this node is volatile.isVolatile()public void updateVolatility()
setVolatile(boolean),
isVolatile()public float getAlpha()
public void setAlpha(float alpha)
public boolean getHidden()
public boolean isHidden()
public void setHidden(boolean h)
h - Value of hidden.public boolean getSave()
public void setSave(boolean s)
s - true if node should be savedpublic ZTransform getTransform()
public void setTransform(ZTransform v)
public ZVisualComponent getVisualComponent()
public void setVisualComponent(ZVisualComponent vc)
vc - The new visual componentprotected void clearVisualComponent()
protected void setParent(ZNode parent)
throws ZOperationNotAllowedException
parent - public ZNode getParent()
addChild(ZNode)public float getMinMag()
public void setMinMag(float v)
v - The new minimumn magnification for this node.public float getMaxMag()
public void setMaxMag(float v)
v - The new maximum magnification for this node.public java.util.Vector getSelectedChildren()
protected java.awt.Composite createComposite(java.awt.Composite currentComposite,
float currentMag)
public void paint(ZRenderContext renderContext)
The node makes the guarantee that before anything is rendered, the transform, clip, and composite of the Graphics2D will be set properly. However, the color, font, and stroke are unset, and the visual component must set those things as needed. The visual components that are painted are not obligated to restore any aspect of the Graphics2D state.
renderContext - The graphics context to use for rendering.ZVisualComponent.paint(ZRenderContext)
public ZNode pick(java.awt.geom.Rectangle2D rect,
float mag)
rect - Coordinates of pick rectangle in camera coordinates.mag - The magnification of the camera being picked within.ZVisualComponent.isPickable()
public int findNodes(ZFindFilter filter,
java.util.Vector nodes)
filter - The filter that decides whether or not to include individual nodes in the find listnodes - the accumulation vector (results will be place here).ZVisualComponent.isFindable(),
ZFindFilterpublic ZNode findNode()
ZVisualComponent.findNode()public ZRootNode findRoot()
ZRootNodepublic ZVisualComponent findVisualComponent(java.lang.Class type)
type - the object class to look for.public void damage()
If this object is visible in multiple places on a surface because the surface has more than one camera where each camera can see this object, then this call to damage causes all of those places to be marked as needing to be repainted. A single call to that surface's restore method will cause all of those damaged areas to be repainted.
If this object is visible within multiple surfaces, then this call to damage causes those places that this object is visible on each surface to be marked as needing to be repainted. The restore method of each surface must be called in order to repaint the damaged area associated with this object.
Important note : There are two proper uses of damage.
damage(boolean).
ZSurface.restore(),
damage(boolean)public void damage(boolean boundsChanged)
If this object is visible in multiple places on a surface because the surface has more than one camera where each camera can see this object, then this call to damage causes all of those places to be marked as needing to be repainted. A single call to that surface's restore method will cause all of those damaged areas to be repainted.
If this object is visible within multiple surfaces, then this call to damage causes those places that this object is visible on each surface to be marked as needing to be repainted. The restore method of each surface must be called in order to repaint the damaged area associated with this object.
Important note : There are two proper uses of damage.
damage().
ZSurface.restore(),
damage()public void updateChildBounds()
ZScenegraphObject,
ZScenegraphObject.updateChildBounds()public void updateBounds()
This method invalidates the cached values for both the globalBounds and globalCompBounds. GlobalCompBounds consists of the bounding rectangle containing this nodes visual components. GlobalBounds consists of the bounding rectangle containing the globalCompBounds and all of this nodes descendents globalBounds. For a discussion on coordinate systems and bounds see ZScenegraphObject.
ZScenegraphObject,
ZScenegraphObject.updateBounds(),
updateGlobalCompBounds(),
updateGlobalBounds()public void updateGlobalCompBounds()
ZScenegraphObjectprotected void computeGlobalCompBounds()
ZScenegraphObjectpublic ZBounds getGlobalCompBounds()
ZScenegraphObject,
updateGlobalCompBounds(),
computeGlobalCompBounds()public ZBounds getCompBounds()
public void updateGlobalBounds()
ZScenegraphObjectprotected void computeGlobalBounds()
ZScenegraphObjectpublic ZBounds getGlobalBounds()
ZScenegraphObject,
updateGlobalBounds(),
computeGlobalBounds()public java.awt.geom.AffineTransform computeGlobalCoordinateFrame()
public java.util.Vector getObjs(java.awt.geom.Rectangle2D bounds)
public boolean isDescendent(ZNode queryNode)
queryNode - a possible ancenstor of nodepublic boolean isAncestor(ZNode queryNode)
queryNode - a possible descendent of nodepublic void selectAll(ZCamera camera)
public void unselectAll()
public void addProperty(java.lang.String key,
java.lang.Object value)
key - The key to the new property.value - The value of the new property.public void addProperty(ZProperty newProp)
property - The new property.public java.lang.Object getProperty(java.lang.String key)
public java.util.Vector getProperties()
public void writeObject(ZObjectOutputStream out)
throws java.io.IOException
out - The stream that this object writes into
public void writeObjectRecurse(ZObjectOutputStream out)
throws java.io.IOException
out - The stream that this object writes into
public void setState(java.lang.String fieldType,
java.lang.String fieldName,
java.lang.Object fieldValue)
fieldType - The fully qualified type of the fieldfieldName - The name of the fieldfieldValue - The value of the fieldpublic ZSerializable writeReplace()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||