CH.ifa.draw.standard
Class GridConstrainer

java.lang.Object
  extended by CH.ifa.draw.standard.GridConstrainer
All Implemented Interfaces:
PointConstrainer, java.io.Serializable

public class GridConstrainer
extends java.lang.Object
implements PointConstrainer, java.io.Serializable

Constrains a point such that it falls on a grid.

See Also:
DrawingView, Serialized Form

Constructor Summary
GridConstrainer(int x, int y)
           
 
Method Summary
 java.awt.Point constrainPoint(java.awt.Point p)
          Constrains the given point.
 int getStepX()
          Gets the x offset to move an object.
 int getStepY()
          Gets the y offset to move an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridConstrainer

public GridConstrainer(int x,
                       int y)
Method Detail

constrainPoint

public java.awt.Point constrainPoint(java.awt.Point p)
Constrains the given point.

Specified by:
constrainPoint in interface PointConstrainer
Returns:
constrained point.

getStepX

public int getStepX()
Gets the x offset to move an object.

Specified by:
getStepX in interface PointConstrainer

getStepY

public int getStepY()
Gets the y offset to move an object.

Specified by:
getStepY in interface PointConstrainer