|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ZScenegraphObject is the base class for all objects in the jazz scenegraph. It
has no purpose other than providing a common superclass for ZNode and
ZVisualComponent.
Coordinate Systems
Application developers should understand the three coordinates systems (global, local, window)
that exist in Jazz. Local bounds are each objects own coordinate system. It starts at 0,0 and
are un-modified by any transformation and encompasses the width and height of the object.
Global coorinates are an objects local coordinates modified by any applicable transforms. There is
one set of global coordinates and they may also be referred to as the global space. The last type of
coordinates are those that map directly to a java component. They originate at the top-left corner and
increase as you progress down and to the right.
// Create a basic Jazz scene
JComponent component = buildScene(container);
// Extract the basic elements of the scenegraph
ZCamera camera = surface.getCamera();
ZNode layer = (ZNode)camera.getPaintStartPoints().firstElement();
ZRectangle rect = new ZRectangle(10, 10, 50, 50);
ZNode node = new ZNode(rect);
The rectangle exists in local coordinates at 10, 10. It's width and height are both 50. The bounding
box of this object in local coordinates is 10, 10, 60, 60. Since there are no transforms applied to
this object, it's global coords are the same as it's local coordinates. And, since there is no translation
applied to the camera, the window coordinates are the same as the global coordinates. The rectangle will
appear on the component at 10, 10 and have a width and height of 50. Now, if the node's transform is modified by translation:
node.getTransform().translate(100, 100);
The rectangle's local coordiantes are unchanged. The local coordinates are transformed by the node's
transform to produce the global coordinates. Since there is still no transformation
applied to the camera, the window coordinates are the same as the global coordinates.
The rectangle will appear on the component at 110, 110 and have a width and height of 50.
Now, if the node's transform is modified by scale:
node.getTransform().scale(2);
The rectangle's local coordiantes are unchanged. The local coordinates are transformed by the node's
transform to produce the global coordinates (scale first, then translated). Since there is still
no transformation applied to the camera, the window coordinates are the same as the global coordinates.
The rectangle will appear on the component at 120, 120 and have a width and height of 100.
Now, if the camera is translated
camera.getCamaraTransform().translate(-100, -100);
The rectangle's local coordiantes are unchanged. The local coordinates are transformed by the node's
transform to produce the global coordinates (scale first, then translated). The window coordinates are
procuded by applying the cameras transform to the global coordinates.
The rectangle will appear on the component at 120, 120 and have a width and height of 100.
ZNode,
ZVisualComponent| Method Summary | |
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)
|
ZNode |
findNode()
Used to find the containing object in the scenegraph hierarchy. |
void |
setVisualComponent(ZVisualComponent child)
Set the visual component. |
void |
transformChanged(java.awt.geom.AffineTransform origTransform)
Internal method used to notify a node that its transform has changed |
void |
updateBounds()
Notifies the object that it must update it's bounds. |
void |
updateChildBounds()
Notifies an object that it must update it's bounds and request that any children it has update their bounds as well. |
void |
updateVolatility()
Internal method used to compute whether a node is volatile based on its children. |
| Method Detail |
public void damage()
ZNode.damage()public void damage(boolean boundsChanged)
public void updateBounds()
public void updateChildBounds()
public void setVisualComponent(ZVisualComponent child)
vc - The new visual componentpublic ZNode findNode()
public void updateVolatility()
public void transformChanged(java.awt.geom.AffineTransform origTransform)
origTransform - The value of the original transform (before it was changed)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||