|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.horstmann.violet.framework.Grid
public class Grid
A grid to which points and rectangles can be "snapped". The snapping operation moves a point to the nearest grid point.
| Constructor Summary | |
|---|---|
Grid()
Constructs a grid with no grid points. |
|
| Method Summary | |
|---|---|
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D bounds)
Draws this grid inside a rectangle. |
void |
setGrid(double x,
double y)
Sets the grid point distances in x- and y-direction |
void |
snap(java.awt.geom.Point2D p)
Snaps a point to the nearest grid point |
void |
snap(java.awt.geom.Rectangle2D r)
Snaps a rectangle to the nearest grid points |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Grid()
| Method Detail |
|---|
public void setGrid(double x,
double y)
x - the grid point distance in x-directiony - the grid point distance in y-direction
public void draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D bounds)
g2 - the graphics contextbounds - the bounding rectanglepublic void snap(java.awt.geom.Point2D p)
p - the point to snap. After the call, the
coordinates of p are changed so that p falls on the grid.public void snap(java.awt.geom.Rectangle2D r)
r - the rectangle to snap. After the call, the
coordinates of r are changed so that all of its corners
falls on the grid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||