|
JHotDraw 7.0.9 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.draw.GridConstrainer
public class GridConstrainer
Constrains a point such that it falls on a grid.
Constructor Summary | |
---|---|
GridConstrainer(double width,
double height)
Creates a new instance. |
Method Summary | |
---|---|
java.awt.geom.Point2D.Double |
constrainPoint(java.awt.geom.Point2D.Double p)
Constrains the given point. |
java.awt.geom.Point2D.Double |
constrainPoint(java.awt.geom.Point2D.Double p,
Direction dir)
Constrains the given point towards the specified direction. |
void |
draw(java.awt.Graphics2D g,
DrawingView view)
Draws the constrainer grid for the specified drawing view. |
double |
getHeight()
|
double |
getWidth()
|
boolean |
isVisible()
Returns true if the Constrainer grid is visible. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GridConstrainer(double width, double height)
width
- The width of a grid cell.height
- The height of a grid cell.Method Detail |
---|
public double getWidth()
public double getHeight()
public java.awt.geom.Point2D.Double constrainPoint(java.awt.geom.Point2D.Double p)
Constrainer
constrainPoint
in interface Constrainer
p
- A point on the drawing.
public java.awt.geom.Point2D.Double constrainPoint(java.awt.geom.Point2D.Double p, Direction dir)
Constrainer
constrainPoint
in interface Constrainer
p
- A point on the drawing.dir
- A direction.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isVisible()
Constrainer
isVisible
in interface Constrainer
public void draw(java.awt.Graphics2D g, DrawingView view)
Constrainer
draw
in interface Constrainer
|
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |