|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.ZSceneGraphObject | +--edu.umd.cs.jazz.ZNode | +--edu.umd.cs.jazz.ZGroup | +--edu.umd.cs.jazz.ZFadeGroup
ZFadeGroup is a group node that controls transparency and fading of its sub-tree. Inserting a fade node into the tree lets you control transparency and minimum/maximum magnification of all its descendants. If this node is rendered below its minimum magnification, or above its maximum magnification, it and its children will not be rendered. The node and its subtree will be smoothly faded out as the minimum or maximum magnification is approached.
Four types of fading have been implemented, selected with the setFadeType method:
CAMERA_MAG fades a node on camera magnification.
COMPOSITE_MAG fades on composite camera magnification.
ABSOLUTE_SCREEN_SIZE fades on absolute screen size in pixels.
PERCENT_OF_CAMERA fades on percentage of the camera size.
ZSceneGraphEditor
provides a convenience mechanism to locate, create
and manage nodes of this type.
Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.
Field Summary | |
static short |
ABSOLUTE_SCREEN_SIZE
FadeType: Fade on absolute screen size in pixels. |
static double |
alpha_DEFAULT
|
static short |
CAMERA_MAG
FadeType: Fade on camera magnification. |
static short |
COMPOSITE_MAG
FadeType: Fade on composite magnification. |
static double |
fadeRange_DEFAULT
|
static short |
fadeType_DEFAULT
|
static double |
maxMag_DEFAULT
|
static double |
minMag_DEFAULT
|
static short |
PERCENT_OF_CAMERA
FadeType: Fade on percentage of camera size. |
Fields inherited from class edu.umd.cs.jazz.ZGroup |
children, childrenFindable_DEFAULT, childrenPickable_DEFAULT, hasOneChild_DEFAULT |
Fields inherited from class edu.umd.cs.jazz.ZNode |
findable_DEFAULT, pickable_DEFAULT, savable_DEFAULT, selectable_DEFAULT |
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
bounds, listenerList, volatileBounds, volatileBounds_DEFAULT |
Constructor Summary | |
ZFadeGroup()
Constructs a new empty fade group node. |
|
ZFadeGroup(ZNode child)
Constructs a new fade group node with the specified node as a child of the new group. |
Method Summary | |
double |
getAlpha()
Get the alpha value (opacity) for this node. |
protected java.awt.Composite |
getComposite(java.awt.Composite currentComposite,
double metric)
Internal method to compute and access an alpha Composite given the current rendering composite, and the current metric. |
double |
getFadeRange()
Returns the current fade range of this node. |
int |
getFadeType()
Determine the type of fading that this node implements. |
double |
getMaxMag()
Get the maximum magnification for this node, as defined by the fade type. |
double |
getMinMag()
Get the minimumn magnification for this node, as defined by the fade type. |
boolean |
isVisible(double metric)
Internal method: determines if this fade node is visible at the specified magnification. |
boolean |
isVisible(ZSceneGraphPath path)
Determines if this fade node is visible. |
boolean |
pick(java.awt.geom.Rectangle2D rect,
ZSceneGraphPath path)
Returns the first object under the specified rectangle (if there is one) in the subtree rooted with this as searched in reverse (front-to-back) order. |
void |
render(ZRenderContext renderContext)
Renders this node which results in the node's visual component getting rendered, followed by its children getting rendered. |
void |
setAlpha(double alpha)
Set the alpha value (opacity) for this node. |
void |
setFadeRange(double fadeRange)
Sets the percentage of magnification change over which an object is faded in or out as it reaches its minimum or maximum magnification. |
void |
setFadeType(short aFadeType)
Set the type of fading that this node implements. |
void |
setMaxMag(double maxMag)
Set the maximumn magnification for this node. |
void |
setMinMag(double minMag)
Set the minimumn magnification for this node. |
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 |
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 |
Methods inherited from class edu.umd.cs.jazz.ZNode |
addClientProperty, addNodeListener, editor, getClientProperty, getGlobalBounds, getGlobalToLocalTransform, getLocalToGlobalTransform, getParent, getRoot, globalToLocal, globalToLocal, hasNodeListener, isAncestorOf, isDescendentOf, isFindable, isPickable, isSavable, isSelectable, localToGlobal, localToGlobal, lower, lowerTo, percolateEventUpSceneGraph, putClientProperty, raise, raiseTo, remove, repaint, repaint, repaint, reparent, replaceWith, setEditorFactory, setFindable, setParent, setPickable, setSavable, setSelectable, updateBounds, updateObjectReferences, writeReplace |
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
addMouseListener, addMouseMotionListener, clone, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getListenerList, hasLisenerOfType, hasMouseListener, processMouseEvent, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, setVolatileBounds |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final short CAMERA_MAG
public static final short COMPOSITE_MAG
public static final short ABSOLUTE_SCREEN_SIZE
public static final short PERCENT_OF_CAMERA
public static final short fadeType_DEFAULT
public static final double alpha_DEFAULT
public static final double minMag_DEFAULT
public static final double maxMag_DEFAULT
public static final double fadeRange_DEFAULT
Constructor Detail |
public ZFadeGroup()
public ZFadeGroup(ZNode child)
child
- Child of the new group node.Method Detail |
public double getAlpha()
public void setAlpha(double alpha)
alpha
- The new alpha value for this node.public double getMinMag()
public void setMinMag(double minMag)
If fade type is CAMERA_MAG, then minMag is the minimum magnification for this
node.
If fade type is COMPOSITE_MAG, then minMag is the minimum composite
magnification for this node.
if fade type is ABSOLUTE_SCREEN_SIZE, then minMag is the minimum size of the
node in pixels.
if fade type is PERCENT_OF_CAMERA, then minMag is the minimum size, as a
percentage of the camera size.
minMag
- The new minimumn magnification for this node.public double getMaxMag()
public void setMaxMag(double maxMag)
If fade type is CAMERA_MAG, then maxMag is the maximum magnification for this
node.
If fade type is COMPOSITE_MAG, then maxMag is the maximum composite
magnification for this node.
if fade type is ABSOLUTE_SCREEN_SIZE, then maxMag is the maximum size of the
node in pixels.
if fade type is PERCENT_OF_CAMERA, then maxMag is the maximum size, as a
percentage of the camera size.
maxMag
- The new maximumn magnification for this node.public void setFadeRange(double fadeRange)
fadeRange
- the new fade range [0, 1]public double getFadeRange()
setFadeRange(double)
public void setFadeType(short aFadeType)
fadeType
- The fade type for this node.public int getFadeType()
public boolean isVisible(ZSceneGraphPath path)
path
- A scenegraph path.public boolean isVisible(double metric)
metric
- The magnification, as defined by fade type.protected java.awt.Composite getComposite(java.awt.Composite currentComposite, double metric)
currentComposite
- The composite in the current render contextcurrentMag
- The metric of the current rendering camerapublic void render(ZRenderContext renderContext)
The transform, clip, and composite will be set appropriately when this object is rendered. It is up to this object to restore the transform, clip, and composite of the Graphics2D if this node changes any of them. However, the color, font, and stroke are unspecified by Jazz. This object should set those things if they are used, but they do not need to be restored.
render
in class ZGroup
renderContext
- The graphics context to use for rendering.public boolean pick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath path)
If childrenPickable is false, then this will never return a child as the picked node. Instead, this node will be returned if any children are picked, or if this node's visual component is picked. Else, it will return null.
pick
in class ZGroup
rect
- Coordinates of pick rectangle in local coordinatespath
- The path through the scenegraph to the picked node. Modified by this call.ZDrawingSurface.pick(int, int)
public void writeObject(ZObjectOutputStream out) throws java.io.IOException
writeObject
in interface ZSerializable
writeObject
in class ZGroup
out
- The stream that this object writes intopublic void writeObjectRecurse(ZObjectOutputStream out) throws java.io.IOException
writeObjectRecurse
in interface ZSerializable
writeObjectRecurse
in class ZGroup
out
- The stream that this object writes intopublic void setState(java.lang.String fieldType, java.lang.String fieldName, java.lang.Object fieldValue)
setState
in interface ZSerializable
setState
in class ZGroup
fieldType
- The fully qualified type of the fieldfieldName
- The name of the fieldfieldValue
- The value of the field
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |