|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.util.ZSceneGraphPath
ZSceneGraphPath represents a unique path in a scene graph from a top-level camera to a terminal node. The path is typically used in event handlers to determine what object is under the mouse pointer, and what camera(s) that object was rendered within. The path is typically generated by ZDrawingSurface.pick(int, int)
. The terminal node can be a node or visual component, but is typically a visual component, or null. One exception to this is that if a group's children are not pickable than the group itself will be the terminal object if one if its children was actually picked. Also, cameras are not picked as objects, and thus do not typically appear as a terminal object.
The path also encapsulates a transform, indicating the composited transform from the top-level camera to the terminal object, possibly going through zero or more internal cameras. Even when the terminal object is null, the transform contains the complete transform through all the cameras that the mouse pointer is over (for pick operations).
The path also holds a list of the cameras traversed by the path. As with the transform, even if the terminal object is null, the camea list contains all the cameras the mouse pointer is over (for pick operations).
NOTE: As of Jazz 1.1 getNode()
does not return null but instead returns the bottom camera node on the picked path when no object is picked. getObject()
should be used instead to determine if an object has been picked. Consequently, getObject()
returns null when no object has been picked. Because getObject()
returns a ZSceneGraphObject
, applications can use getNode()
to obtain the lowest picked node once the application has determined that an object has been picked. Note also that screenToGlobal(java.awt.geom.Point2D)
and screenToGlobal(java.awt.geom.Rectangle2D)
now convert to global coordinates in the lowest camera. However, this is only likely to affect an application if it uses internal cameras.
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.
ZDrawingSurface.pick(int, int)
, Serialized FormConstructor Summary | |
ZSceneGraphPath() Constructs a new ZSceneGraphPath. |
Method Summary | |
double |
cameraToScreen(java.awt.geom.Dimension2D dimension, ZCamera camera) Converts the specified dimension from camera coordinates to the coordinate system of the screen, if the camera appears on the current path. |
double |
cameraToScreen(java.awt.geom.Point2D pt, ZCamera camera) Converts the specified point from camera coordinates to the coordinate system of the screen, if the camera appears on the current path. |
double |
cameraToScreen(java.awt.geom.Rectangle2D rect, ZCamera camera) Converts the specified rectangle from camera coordinates to the coordinate system of the screen, if the camera appears on the current path. |
ZCamera |
getCamera() Returns the nearest ZCamera to the picked object. |
ZCamera |
getCamera(int i) Returns the i'th camera between the root and the terminal object. |
boolean |
getCameraFound() Internal method. |
java.awt.geom.AffineTransform |
getCameraTransform() Returns the camera transform for this path. |
java.awt.geom.AffineTransform |
getCameraTransform(ZCamera camera) Returns the camera transform for this camera in this path. |
ZNode |
getNode() Returns the nearest ZNode to the picked object. |
int |
getNumCameras() Returns the number of internal cameras between the root and the terminal object. |
int |
getNumParents() Returns the number of internal ZSceneGraphObjects between the root and the terminal object. |
ZSceneGraphObject |
getObject() Returns the terminal object in the path. |
ZSceneGraphObject |
getParent(int i) Returns the i'th scene graph object between the root and the terminal object. |
ZRoot |
getRoot() Returns the root node for this path. |
ZCamera |
getTopCamera() Returns the top-level camera in the path. |
ZNode |
getTopCameraNode() Returns the node associated with the top-level camera in the path. |
java.awt.geom.AffineTransform |
getTransform() Returns the transform for this path. |
void |
pop(ZSceneGraphObject sgo) Removes a node (and any nodes after it) from the list of parent nodes. |
void |
popCamera(ZCamera camera) Removes a camera (and any cameras after it) from the list of camera nodes. |
void |
popTransformer(ZTransformable transformer) Removes a transformer (and any transformers after it) from the list of transformer nodes. |
void |
processMouseEvent(ZMouseEvent e) Percolate this mouse event up the scene graph path until the event is consumed or the top of the path is reached |
void |
push(ZSceneGraphObject sgo) Adds a node to the end of the list of parent nodes. |
void |
pushCamera(ZCamera camera) Adds a node to the end of the list of camera nodes. |
void |
pushTransformer(ZTransformable transformer) Internal method. |
void |
screenToCamera(java.awt.geom.Dimension2D aDimension) Converts the specified dimension from screen coordinates to the coordinate system of the bottom camera. |
void |
screenToCamera(java.awt.geom.Dimension2D aDimension, ZCamera aCamera) Converts the specified dimension from screen coordinates to the coordinate system of the specified camera. |
double |
screenToCamera(java.awt.geom.Point2D pt) Converts the specified point from screen coordinates to the local coordinate system of the bottom camera in this path. |
double |
screenToCamera(java.awt.geom.Point2D pt, ZCamera camera) Converts the specified point from screen coordinates to the local coordinate system of the specified camera, if the camera appears on the current path. |
double |
screenToCamera(java.awt.geom.Rectangle2D rect) Converts the specified point from screen coordinates to the local coordinate system of the bottom camera in this path. |
double |
screenToCamera(java.awt.geom.Rectangle2D rect, ZCamera camera) Converts the specified point from screen coordinates to the local coordinate system of the specified camera, if the camera appears on the current path. |
void |
screenToGlobal(java.awt.geom.Dimension2D aDimension) Converts the specified dimension from screen coordinates to global coordinates through the bottom camera, ie. |
void |
screenToGlobal(java.awt.geom.Point2D pt) Converts the specified point from screen coordinates to global coordinates through the bottom camera, ie. |
void |
screenToGlobal(java.awt.geom.Rectangle2D rect) Converts the specified point from screen coordinates to global coordinates through the bottom camera, ie. |
void |
screenToLocal(java.awt.geom.Dimension2D aDimension) Converts the specified dimension from screen coordinates to the local coordinate system of the terminal scene graph object in this path. |
void |
screenToLocal(java.awt.geom.Point2D pt) Converts the specified point from screen coordinates to the local coordinate system of the terminal scene graph object in this path. |
void |
screenToLocal(java.awt.geom.Rectangle2D rect) Converts the specified rectangle from screen coordinates to the local coordinate system of the terminal scene graph object in this path. |
void |
setCameraFound(boolean cf) Internal method. |
void |
setCameraTransform(java.awt.geom.AffineTransform tm) Sets the camera transform of the bottom camera for this path. |
void |
setObject(ZSceneGraphObject object) Sets the terminal object in the path. |
void |
setRoot(ZRoot root) Sets the root node for this path. |
void |
setTopCamera(ZCamera camera) Sets the top-level camera in the path. |
void |
setTopCameraNode(ZNode node) Sets the node associated with the top-level camera in the path. |
void |
setTransform(java.awt.geom.AffineTransform tm) Sets the transform for this path. |
java.lang.String |
toString() Returns a string description of this path useful for debugging. |
void |
trimCamerasToSize() Trims the capacity of the array that stores the cameras to the actual number of points. |
void |
trimToSize() Trims the capacity of the array that stores the parents list points to the actual number of points. |
void |
trimTransformersToSize() Trims the capacity of the array that stores the transformers to the actual number of points. |
void |
updateTransform() Update the path's transform. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ZSceneGraphPath()
Method Detail |
public ZSceneGraphObject getObject()
public void setObject(ZSceneGraphObject object)
public ZNode getTopCameraNode()
public void setTopCameraNode(ZNode node)
public ZCamera getTopCamera()
public void setTopCamera(ZCamera camera)
public ZNode getNode()
getObject()
should be used instead to determine if an object has been picked.
public ZCamera getCamera()
public ZRoot getRoot()
public void setRoot(ZRoot root)
public java.awt.geom.AffineTransform getTransform()
public void setTransform(java.awt.geom.AffineTransform tm)
tm
- The new transformpublic java.awt.geom.AffineTransform getCameraTransform()
public java.awt.geom.AffineTransform getCameraTransform(ZCamera camera)
public void setCameraTransform(java.awt.geom.AffineTransform tm)
tm
- The new camera transformpublic void screenToGlobal(java.awt.geom.Point2D pt)
pt
- The pt to be transformedpublic void screenToGlobal(java.awt.geom.Dimension2D aDimension)
NOTE: Dimension2D's are abstract. When creating a new Dimension2D for use with Jazz we recoment that you use edu.umd.cs.util.ZDimension instead of java.awt.Dimension. ZDimension uses doubles internally, while java.awt.Dimension uses integers.
aDimension
- The dimension to be transformedpublic void screenToGlobal(java.awt.geom.Rectangle2D rect)
rect
- The rect to be transformedpublic double screenToCamera(java.awt.geom.Point2D pt)
pt
- The point to be transformedpublic void screenToCamera(java.awt.geom.Dimension2D aDimension)
NOTE: Dimension2D's are abstract. When creating a new Dimension2D for use with Jazz we recoment that you use edu.umd.cs.util.ZDimension instead of java.awt.Dimension. ZDimension uses doubles internally, while java.awt.Dimension uses integers.
aDimension
- The dimension to be transformedpublic double screenToCamera(java.awt.geom.Rectangle2D rect)
rect
- The rect to be transformedpublic double screenToCamera(java.awt.geom.Point2D pt, ZCamera camera)
pt
- The point to be transformedcamera
- The camera for which the point is transformedpublic void screenToCamera(java.awt.geom.Dimension2D aDimension, ZCamera aCamera)
NOTE: Dimension2D's are abstract. When creating a new Dimension2D for use with Jazz we recoment that you use edu.umd.cs.util.ZDimension instead of java.awt.Dimension. ZDimension uses doubles internally, while java.awt.Dimension uses integers.
aDimension
- The dimension to be transformedaCamera
- The camera for which the point is transformedpublic double screenToCamera(java.awt.geom.Rectangle2D rect, ZCamera camera)
rect
- The rect to be transformedcamera
- The camera for which the point is transformedpublic double cameraToScreen(java.awt.geom.Point2D pt, ZCamera camera)
pt
- The point to be transformedcamera
- The camera for which the point is transformedpublic double cameraToScreen(java.awt.geom.Dimension2D dimension, ZCamera camera)
dimension
- The dimension to be transformedcamera
- The camera for which the point is transformedpublic double cameraToScreen(java.awt.geom.Rectangle2D rect, ZCamera camera)
rect
- The rectangle to be transformedcamera
- The camera for which the point is transformedpublic void screenToLocal(java.awt.geom.Point2D pt)
pt
- The pt to be transformedpublic void screenToLocal(java.awt.geom.Dimension2D aDimension)
NOTE: Dimension2D's are abstract. When creating a new Dimension2D for use with Jazz we recoment that you use edu.umd.cs.util.ZDimension instead of java.awt.Dimension. ZDimension uses doubles internally, while java.awt.Dimension uses integers.
aDimension
- The dimension to be transformedpublic void screenToLocal(java.awt.geom.Rectangle2D rect)
rect
- The rect to be transformedpublic int getNumParents()
public ZSceneGraphObject getParent(int i)
i
- The index of the path element to returnpublic void push(ZSceneGraphObject sgo)
sgo
- The scene graph object to be added to the pathpublic void pop(ZSceneGraphObject sgo)
sgo
- The scene graph object to be removed from the pathpublic void trimToSize()
public int getNumCameras()
public ZCamera getCamera(int i)
i
- The index of the camera to returnpublic void pushCamera(ZCamera camera)
camera
- The camera to be added to the pathpublic void popCamera(ZCamera camera)
camera
- The camera to be removed from the pathpublic void trimCamerasToSize()
public void pushTransformer(ZTransformable transformer)
transformer
- The transformer to be added to the pathpublic void popTransformer(ZTransformable transformer)
transformer
- The transformer to be removed from the pathpublic void processMouseEvent(ZMouseEvent e)
public void trimTransformersToSize()
public void setCameraFound(boolean cf)
public boolean getCameraFound()
public void updateTransform()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |