JHotDraw 7.0.9

org.jhotdraw.draw
Interface Constrainer

All Known Implementing Classes:
GridConstrainer

public interface Constrainer

Interface to constrain a Point2D.Double. This can be used to implement different kinds of grids.

Version:
3.0 2007-04-29 Method constrainPoint(Point2D.Double, Direction) added.
2.1 2006-07-03 Method isVisible() added.
2.0 2006-01-17 Changed to support double precision coordinates.
1.0 2004-03-14 Created.
Author:
Werner Randelshofer

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.
 boolean isVisible()
          Returns true if the Constrainer grid is visible.
 

Method Detail

constrainPoint

java.awt.geom.Point2D.Double constrainPoint(java.awt.geom.Point2D.Double p)
Constrains the given point. This method changes the point which is passed as a parameter.

Parameters:
p - A point on the drawing.
Returns:
The closest constrained point.

constrainPoint

java.awt.geom.Point2D.Double constrainPoint(java.awt.geom.Point2D.Double p,
                                            Direction dir)
Constrains the given point towards the specified direction. This method changes the point which is passed as a parameter.

Parameters:
p - A point on the drawing.
dir - A direction.
Returns:
The closest constrained point in the specified direction.

isVisible

boolean isVisible()
Returns true if the Constrainer grid is visible.


draw

void draw(java.awt.Graphics2D g,
          DrawingView view)
Draws the constrainer grid for the specified drawing view.


Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.