|
||||||||||
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.ZTransformGroup | +--edu.umd.cs.jazz.ZConstraintGroup | +--edu.umd.cs.jazz.ZStickyGroup
ZStickyGroup is a constraint group that moves its children inversely to the camera view, so that the children stay visually on the same place on the screen, even as the camera view changes. There are two types of sticky constraints:
The simplest way to make an object sticky is to use the static makeSticky() method. Alternatively, an application can make one manually by creating a constraint group over a sub-tree that should be sticky. The following code creates a sticky rectangle using this node.
ZRectangle rect; ZVisualLeaf leaf; ZStickyGroup sticky; rect = new ZRectangle(0, 0, 50, 50); leaf = new ZVisualLeaf(rect); sticky = new ZStickyGroup(camera, leaf); layer.addChild(sticky);
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 int |
constraintType_DEFAULT
|
static int |
STICKY
The type for a Sticky constraint |
static double |
stickyPointX_DEFAULT
|
static double |
stickyPointY_DEFAULT
|
static int |
STICKYZ
The type for a Sticky Z constraint |
Fields inherited from class edu.umd.cs.jazz.ZConstraintGroup |
camera |
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 | |
ZStickyGroup()
Constructs a new sticky group. |
|
ZStickyGroup(ZCamera camera)
Constructs a new sticky group with a specified camera. |
|
ZStickyGroup(ZCamera camera,
ZNode child)
Constructs a new sticky group with a specified camera that decorates the specified child. |
|
ZStickyGroup(ZNode child)
Constructs a new sticky group that decorates the specified child. |
Method Summary | |
java.awt.geom.AffineTransform |
computeStickyTransform()
Computes the Sticky constraint that defines the child to not move even as the camera view changes. |
protected java.awt.geom.AffineTransform |
computeStickyZTransform()
Computes the Sticky Z constraint that defines the child to keep a constant magnification even as the camera magnification changes. |
java.awt.geom.AffineTransform |
computeTransform()
Computes the constraint that defines the child to not move even as the camera view changes. |
java.lang.String |
dump()
Generate a string that represents this object for debugging. |
int |
getConstraintType()
Determine the type of constraint that this node implements. |
java.awt.Dimension |
getStickyPoint()
Returns a Dimension specifying a point on the sticky object that remains fixed as the scene is zoomed (for StickyZ only). |
static ZStickyGroup |
makeSticky(ZNode node,
ZCamera camera,
int constraintType)
Make the specified node sticky by adding a sticky node above the specified node. |
static void |
makeUnSticky(ZNode node)
Make the specified node unsticky. |
void |
setConstraintType(int constraintType)
Set the type of constraint that this node implements. |
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 |
setStickyPoint(double x,
double y)
Specifies a point on the unit square of the sticky object that will remain fixed when the scene is zoomed (for StickyZ only). |
void |
writeObject(ZObjectOutputStream out)
Write out all of this object's state. |
Methods inherited from class edu.umd.cs.jazz.ZConstraintGroup |
finalize, getCamera, init, setCamera, updateObjectReferences, updateTransform, writeObjectRecurse |
Methods inherited from class edu.umd.cs.jazz.ZTransformGroup |
addTransformListener, animate, animate, animate, animate, computeBounds, computeInverseTransform, computeScale, concatenate, duplicateObject, getInverseTransform, getLocalToGlobalTransform, getMatrix, getRotation, getScale, getTransform, getTransformReference, getTranslateX, getTranslateY, getTranslation, lerp, pick, position, position, preConcatenate, removeTransformListener, render, repaint, repaint, rotate, rotate, rotate, rotate, scale, scale, scale, scale, setRotation, setRotation, setRotation, setRotation, setScale, setScale, setScale, setScale, setTransform, setTransform, setTranslateX, setTranslateY, setTranslation, setTranslation, transform, transform, translate, translate |
Methods inherited from class edu.umd.cs.jazz.ZNode |
addClientProperty, addNodeListener, editor, getClientProperty, getGlobalBounds, getGlobalToLocalTransform, getParent, getRoot, globalToLocal, globalToLocal, hasNodeListener, isAncestorOf, isDescendentOf, isFindable, isPickable, isSavable, isSelectable, localToGlobal, localToGlobal, lower, lowerTo, percolateEventUpSceneGraph, putClientProperty, raise, raiseTo, remove, repaint, reparent, replaceWith, setEditorFactory, setFindable, setParent, setPickable, setSavable, setSelectable, updateBounds, 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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STICKY
public static final int STICKYZ
public static double stickyPointX_DEFAULT
public static double stickyPointY_DEFAULT
public static int constraintType_DEFAULT
Constructor Detail |
public ZStickyGroup()
public ZStickyGroup(ZCamera camera)
camera
- The camera the node is related to.public ZStickyGroup(ZNode child)
child
- The child that should go directly below this node.public ZStickyGroup(ZCamera camera, ZNode child)
camera
- The camera the node is related to.child
- The child that should go directly below this node.Method Detail |
public static ZStickyGroup makeSticky(ZNode node, ZCamera camera, int constraintType)
ZGroup.setHasOneChild(boolean)
.
If the node has a transform decorator, then the sticky node is added above the transform node.
node
- The node to make stickycamera
- The camera that the node is sticky relative toconstraintType
- The constraint type for this node (STICKY or STICKYZ).public static void makeUnSticky(ZNode node)
ZNode
.node
- The node to make unstickypublic void setStickyPoint(double x, double y)
x
- X coordinate of the sticky point of the sticky object.y
- Y coordinate of the sticky point of the sticky object.public java.awt.Dimension getStickyPoint()
public void setConstraintType(int constraintType)
constraintType
- The constraint type for this node.public int getConstraintType()
public java.awt.geom.AffineTransform computeTransform()
computeTransform
in class ZConstraintGroup
public java.awt.geom.AffineTransform computeStickyTransform()
protected java.awt.geom.AffineTransform computeStickyZTransform()
public java.lang.String dump()
dump
in class ZTransformGroup
ZDebug.dump(edu.umd.cs.jazz.ZNode)
public void writeObject(ZObjectOutputStream out) throws java.io.IOException
writeObject
in class ZConstraintGroup
out
- The stream that this object writes intopublic void setState(java.lang.String fieldType, java.lang.String fieldName, java.lang.Object fieldValue)
setState
in class ZConstraintGroup
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 |