edu.umd.cs.piccolox.util
Class PNodeLocator

java.lang.Object
  extended by edu.umd.cs.piccolox.util.PLocator
      extended by edu.umd.cs.piccolox.util.PNodeLocator
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PBoundsLocator

public class PNodeLocator
extends PLocator

PNodeLocator provides an abstraction for locating points on a node. Points are located in the local corrdinate system of the node. The default behavior is to locate the center point of the nodes bounds. The node where the point is located is stored internal to this locator (as an instance varriable). If you want to use the same locator to locate center points on many different nodes you will need to call setNode() before asking for each location.

Version:
1.0
Author:
Jesse Grosjean
See Also:
Serialized Form

Field Summary
protected  PNode node
          Node being located by this locator.
 
Constructor Summary
PNodeLocator(PNode node)
          Constructs a locator responsible for locating the given node.
 
Method Summary
 PNode getNode()
          Returns the node being located by this locator.
 double locateX()
          Locates the left of the target node's bounds.
 double locateY()
          Locates the top of the target node's bounds.
 void setNode(PNode node)
          Changes the node being located by this locator.
 
Methods inherited from class edu.umd.cs.piccolox.util.PLocator
locatePoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

node

protected PNode node
Node being located by this locator.

Constructor Detail

PNodeLocator

public PNodeLocator(PNode node)
Constructs a locator responsible for locating the given node.

Parameters:
node - node to be located
Method Detail

getNode

public PNode getNode()
Returns the node being located by this locator.

Returns:
node being located by this locator

setNode

public void setNode(PNode node)
Changes the node being located by this locator.

Parameters:
node - new node to have this locator locate.

locateX

public double locateX()
Locates the left of the target node's bounds.

Specified by:
locateX in class PLocator
Returns:
left of target node's bounds

locateY

public double locateY()
Locates the top of the target node's bounds.

Specified by:
locateY in class PLocator
Returns:
top of target node's bounds


Copyright © 1995-2010 Piccolo2D. All Rights Reserved.