|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.util.PPickPath
public class PPickPath
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.
PInputEvent
Field Summary | |
---|---|
static PPickPath |
CURRENT_PICK_PATH
Global pick path. |
Constructor Summary | |
---|---|
PPickPath(PCamera camera,
PBounds aScreenPickBounds)
Creates a pick pack originating from the provided camera and with the given screen pick bounds. |
Method Summary | |
---|---|
boolean |
acceptsNode(PNode node)
Determines if the passed node has been excluded from being a member of the pickpath. |
Dimension2D |
canvasToLocal(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. |
Point2D |
canvasToLocal(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. |
Rectangle2D |
canvasToLocal(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()
Returns a reference to the node stack. |
PAffineTransform |
getPathTransformTo(PNode nodeOnPath)
Calculates the context at which the given node is being interacted with. |
PBounds |
getPickBounds()
Returns the bounds of the entire PickPath taken as a whole. |
PNode |
getPickedNode()
Get the bottom node on the pick path node stack. |
double |
getScale()
Returns the resulting scale of applying the transforms of the entire pick path. |
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 node)
Removes the topmost node from the node stack. |
void |
popTransform(PAffineTransform transform)
Pops the top most transform from the pick path. |
void |
processEvent(PInputEvent event,
int eventType)
Process Events - Give each node in the pick path, starting at the bottom most one, a chance to handle the event. |
void |
pushNode(PNode node)
Pushes the provided node to the top of the pick path. |
void |
pushTransform(PAffineTransform transform)
Adds the transform to the pick path's transform. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static PPickPath CURRENT_PICK_PATH
Constructor Detail |
---|
public PPickPath(PCamera camera, PBounds aScreenPickBounds)
camera
- camera from which the pickpath originatesaScreenPickBounds
- bounds of pick areaMethod Detail |
---|
public PBounds getPickBounds()
public boolean acceptsNode(PNode node)
node
- node being tested
public void pushNode(PNode node)
node
- node to be added to the pick pathpublic void popNode(PNode node)
node
- completely unused in this method, but is passed in so that
subclasses may be informed of it.public PNode getPickedNode()
public PNode nextPickedNode()
public PCamera getTopCamera()
public PCamera getBottomCamera()
public PStack getNodeStackReference()
public double getScale()
public void pushTransform(PAffineTransform transform)
transform
- transform to be added to applied to the pickpath.public void popTransform(PAffineTransform transform)
transform
- unused in this methodpublic PAffineTransform getPathTransformTo(PNode nodeOnPath)
nodeOnPath
- a node currently on the pick path. An exception will be
thrown if the node cannot be found.
public void processEvent(PInputEvent event, int eventType)
processEvent
in interface PInputEventListener
event
- event to be processedeventType
- the type of event being processedpublic Point2D canvasToLocal(Point2D canvasPoint, PNode nodeOnPath)
canvasPoint
- point to be transformednodeOnPath
- node into which the point is to be transformed
iteratively through the pick path
public Dimension2D canvasToLocal(Dimension2D canvasDimension, PNode nodeOnPath)
canvasDimension
- dimension to be transformednodeOnPath
- node into which the dimension is to be transformed
iteratively through the stack
public Rectangle2D canvasToLocal(Rectangle2D canvasRectangle, PNode nodeOnPath)
canvasRectangle
- rectangle to be transformednodeOnPath
- node into which the rectangle is to be transformed
iteratively through the stack
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |