Jazz API Documentation

edu.umd.cs.jazz.util
Class ZSceneGraphPath

java.lang.Object
  |
  +--edu.umd.cs.jazz.util.ZSceneGraphPath
All Implemented Interfaces:
java.io.Serializable

public final class ZSceneGraphPath
extends java.lang.Object
implements java.io.Serializable

ZSceneGraphPath represents a unique path in a scene graph from a top-level camera to a terminal node. The class also encapsulates a transform, indicating the composited transform from the top-level camera to the leaf, possibly going through zero or more internal cameras. ZSceneGraphPath objects are generated by the Jazz pick methods.

See Also:
ZDrawingSurface.pick(int, int), Serialized Form

Constructor Summary
ZSceneGraphPath()
           
 
Method Summary
 ZCamera getCamera()
          Returns the nearest ZCamera to the picked object.
 ZNode getNode()
          Returns the nearest ZNode to the picked 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 push(ZSceneGraphObject sgo)
          Adds a node to the end of the list of parent nodes.
 void screenToGlobal(java.awt.geom.Point2D pt)
          Converts the specified point from screen coordinates to global coordinates through the top-level camera of this path.
 void screenToGlobal(java.awt.geom.Rectangle2D rect)
          Converts the specified rectangle from screen coordinates to global coordinates through the top-level camera of 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 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 trimToSize()
          Trims the capacity of the array that stores the parents list points to the actual number of points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZSceneGraphPath

public ZSceneGraphPath()
Method Detail

getObject

public ZSceneGraphObject getObject()
Returns the terminal object in the path. This is either a ZVisualComponent or a ZNode.

setObject

public void setObject(ZSceneGraphObject object)
Sets the terminal object in the path.

getTopCameraNode

public ZNode getTopCameraNode()
Returns the node associated with the top-level camera in the path. Even if the path is empty, this node is guaranteed to be st.

setTopCameraNode

public void setTopCameraNode(ZNode node)
Sets the node associated with the top-level camera in the path.

getTopCamera

public ZCamera getTopCamera()
Returns the top-level camera in the path. This is the first camera that the object was picked within. Even if the path is empty, this camera is guaranteed to be set.

setTopCamera

public void setTopCamera(ZCamera camera)
Sets the top-level camera in the path.

getNode

public ZNode getNode()
Returns the nearest ZNode to the picked object. If the picked object is a ZNode, this simply returns that object. If the picked object is a ZVisualComponent, this returns the ZNode parent of the component.
Returns:
the node.

getCamera

public ZCamera getCamera()
Returns the nearest ZCamera to the picked object. That is, this returns the last camera on the path. If the path is empty, it returns the top-level camera.
Returns:
the camera.

getRoot

public ZRoot getRoot()
Returns the root node for this path.

setRoot

public void setRoot(ZRoot root)
Sets the root node for this path.

getTransform

public java.awt.geom.AffineTransform getTransform()
Returns the transform for this path. This is formed by compositing the all the transforms of the scene graph objects in this path. This resulting transform represents the local coordinate system of the terminal element of this path. If the path is empty, then the transform just contains the top-level camera view transform

setTransform

public void setTransform(java.awt.geom.AffineTransform tm)
Sets the transform for this path.

screenToGlobal

public void screenToGlobal(java.awt.geom.Point2D pt)
Converts the specified point from screen coordinates to global coordinates through the top-level camera of this path.
Parameters:
pt - The pt to be transformed

screenToGlobal

public void screenToGlobal(java.awt.geom.Rectangle2D rect)
Converts the specified rectangle from screen coordinates to global coordinates through the top-level camera of this path.
Parameters:
rect - The rect to be transformed

screenToLocal

public 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.
Parameters:
pt - The pt to be transformed

screenToLocal

public 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.
Parameters:
rect - The rect to be transformed

getNumParents

public int getNumParents()
Returns the number of internal ZSceneGraphObjects between the root and the terminal object.

getParent

public ZSceneGraphObject getParent(int i)
Returns the i'th scene graph object between the root and the terminal object. The parent at position to 0 is closest to the root, and the parent at the last position is closest to the terminal object.
Parameters:
i - The index of the path element to return
Returns:
The scene graph object

push

public void push(ZSceneGraphObject sgo)
Adds a node to the end of the list of parent nodes. This is used during picking by ZNodes and ZVisualComponents to construct a path from the root to the picked object.
Parameters:
sgo - The scene graph object to be added to the path

pop

public void pop(ZSceneGraphObject sgo)
Removes a node (and any nodes after it) from the list of parent nodes. This is used during picking by ZNodes and ZVisualComponents to construct a path from the root to the picked object.
Parameters:
sgo - The scene graph object to be removed from the path

trimToSize

public void trimToSize()
Trims the capacity of the array that stores the parents list points to the actual number of points. Normally, the parents list arrays can be slightly larger than the number of points in the parents list. An application can use this operation to minimize the storage of a parents list.

toString

public java.lang.String toString()
Returns a string description of this path useful for debugging.
Overrides:
toString in class java.lang.Object
Returns:
the string

Jazz API Documentation