edu.umd.cs.piccolo.util
Class PPickPath

java.lang.Object
  extended by edu.umd.cs.piccolo.util.PPickPath
All Implemented Interfaces:
PInputEventListener, java.util.EventListener

public class PPickPath
extends java.lang.Object
implements PInputEventListener

PPickPath represents a ordered list of nodes that have been picked. The topmost ancestor node is the first node in the list (and should be a camera), the bottommost child node is at the end of the list. It is this bottom node that is given first chance to handle events, and that any active event handlers usually manipulate.

Note that because of layers (which can be picked by multiple camera's) the ordered list of nodes in a pick path do not all share a parent child relationship with the nodes in the list next to them. This means that the normal localToGlobal methods don't work when trying to transform geometry up and down the pick path, instead you should use the pick paths canvasToLocal methods to get the mouse event points into your local coord system.

Note that PInputEvent wraps most of the useful PPickPath methods, so often you can use a PInputEvent directly instead of having to access its pick path.

Version:
1.0
Author:
Jesse Grosjean
See Also:
PInputEvent

Field Summary
static PPickPath CURRENT_PICK_PATH
           
 
Constructor Summary
PPickPath(PCamera aCamera, PBounds aScreenPickBounds)
           
 
Method Summary
 boolean acceptsNode(PNode node)
           
 java.awt.geom.Dimension2D canvasToLocal(java.awt.geom.Dimension2D canvasDimension, PNode nodeOnPath)
          Convert the given dimension from the canvas coordinates, down through the pick path (and through any camera view transforms applied to the path) to the local coordinates of the given node.
 java.awt.geom.Point2D canvasToLocal(java.awt.geom.Point2D canvasPoint, PNode nodeOnPath)
          Convert the given point from the canvas coordinates, down through the pick path (and through any camera view transforms applied to the path) to the local coordinates of the given node.
 java.awt.geom.Rectangle2D canvasToLocal(java.awt.geom.Rectangle2D canvasRectangle, PNode nodeOnPath)
          Convert the given rectangle from the canvas coordinates, down through the pick path (and through any camera view transforms applied to the path) to the local coordinates of the given node.
 PCamera getBottomCamera()
          Get the bottom camera on the pick path.
 PStack getNodeStackReference()
           
 PAffineTransform getPathTransformTo(PNode nodeOnPath)
           
 PBounds getPickBounds()
           
 PNode getPickedNode()
          Get the bottom node on the pick path node stack.
 double getScale()
           
 PCamera getTopCamera()
          Get the top camera on the pick path.
 PNode nextPickedNode()
          Return the next node that will be picked after the current picked node.
 void popNode(PNode aNode)
           
 void popTransform(PAffineTransform aTransform)
           
 void processEvent(PInputEvent aEvent, int type)
           
 void pushNode(PNode aNode)
           
 void pushTransform(PAffineTransform aTransform)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_PICK_PATH

public static PPickPath CURRENT_PICK_PATH
Constructor Detail

PPickPath

public PPickPath(PCamera aCamera,
                 PBounds aScreenPickBounds)
Method Detail

getPickBounds

public PBounds getPickBounds()

acceptsNode

public boolean acceptsNode(PNode node)

pushNode

public void pushNode(PNode aNode)

popNode

public void popNode(PNode aNode)

getPickedNode

public PNode getPickedNode()
Get the bottom node on the pick path node stack. That is the last node to be picked.


nextPickedNode

public PNode nextPickedNode()
Return the next node that will be picked after the current picked node. For instance of you have two overlaping children nodes then the topmost child will always be picked first, use this method to find the covered child. Return null when no more nodes will be picked.


getTopCamera

public PCamera getTopCamera()
Get the top camera on the pick path. This is the camera that originated the pick action.


getBottomCamera

public PCamera getBottomCamera()
Get the bottom camera on the pick path. This may be different then the top camera if internal cameras are in use.


getNodeStackReference

public PStack getNodeStackReference()

getScale

public double getScale()

pushTransform

public void pushTransform(PAffineTransform aTransform)

popTransform

public void popTransform(PAffineTransform aTransform)

getPathTransformTo

public PAffineTransform getPathTransformTo(PNode nodeOnPath)

processEvent

public void processEvent(PInputEvent aEvent,
                         int type)
Specified by:
processEvent in interface PInputEventListener

canvasToLocal

public java.awt.geom.Point2D canvasToLocal(java.awt.geom.Point2D canvasPoint,
                                           PNode nodeOnPath)
Convert the given point from the canvas coordinates, down through the pick path (and through any camera view transforms applied to the path) to the local coordinates of the given node.


canvasToLocal

public java.awt.geom.Dimension2D canvasToLocal(java.awt.geom.Dimension2D canvasDimension,
                                               PNode nodeOnPath)
Convert the given dimension from the canvas coordinates, down through the pick path (and through any camera view transforms applied to the path) to the local coordinates of the given node.


canvasToLocal

public java.awt.geom.Rectangle2D canvasToLocal(java.awt.geom.Rectangle2D canvasRectangle,
                                               PNode nodeOnPath)
Convert the given rectangle from the canvas coordinates, down through the pick path (and through any camera view transforms applied to the path) to the local coordinates of the given node.



Copyright 2005 by University of Maryland, College Park, MD 20742, USA All rights reserved.

Web Accessibility