| 
JHotDraw 7.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Constrainer
Interface to constrain points and figures on a Drawing. This can be used to implement different kinds of grids.
| Method Summary | |
|---|---|
 void | 
addChangeListener(javax.swing.event.ChangeListener listener)
Adds a change listener.  | 
 double | 
constrainAngle(double angle)
Constrains the given angle (in radians).  | 
 java.awt.geom.Point2D.Double | 
constrainPoint(java.awt.geom.Point2D.Double p)
Constrains the placement of a point towards the closest constraint in any direction.  | 
 java.awt.geom.Rectangle2D.Double | 
constrainRectangle(java.awt.geom.Rectangle2D.Double r)
Constrains the placement of a rectangle towards the closest constrainment in any direction.  | 
 void | 
draw(java.awt.Graphics2D g,
     DrawingView view)
Draws the constrainer grid for the specified drawing view.  | 
 void | 
removeChangeListener(javax.swing.event.ChangeListener listener)
Removes a change listener.  | 
 double | 
rotateAngle(double angle,
            RotationDirection dir)
Moves the given angle (in radians) to the closest constrained orientation in the specified direction.  | 
 java.awt.geom.Point2D.Double | 
translatePoint(java.awt.geom.Point2D.Double p,
               TranslationDirection dir)
Moves a point to the closest constrained location in the specified direction.  | 
 java.awt.geom.Rectangle2D.Double | 
translateRectangle(java.awt.geom.Rectangle2D.Double r,
                   TranslationDirection dir)
Moves a rectangle to the closest constrained location in the specified direction.  | 
| Method Detail | 
|---|
java.awt.geom.Point2D.Double constrainPoint(java.awt.geom.Point2D.Double p)
This method changes the point which is passed as a parameter.
p - A point on the drawing.
java.awt.geom.Point2D.Double translatePoint(java.awt.geom.Point2D.Double p,
                                            TranslationDirection dir)
This method changes the point which is passed as a parameter.
p - A point on the drawing.dir - A direction.
java.awt.geom.Rectangle2D.Double constrainRectangle(java.awt.geom.Rectangle2D.Double r)
This method changes the location of the rectangle which is passed as a parameter. This method does not change the size of the rectangle.
r - A rectangle on the drawing.
java.awt.geom.Rectangle2D.Double translateRectangle(java.awt.geom.Rectangle2D.Double r,
                                                    TranslationDirection dir)
This method changes the location of the rectangle which is passed as a parameter. This method only performs a translation - it does not change the size of the rectangle.
r - A rectangle on the drawing.dir - A direction.
double constrainAngle(double angle)
angle - The angle (in radians).
double rotateAngle(double angle,
                   RotationDirection dir)
angle - The angle (in radians).
void draw(java.awt.Graphics2D g,
          DrawingView view)
void addChangeListener(javax.swing.event.ChangeListener listener)
void removeChangeListener(javax.swing.event.ChangeListener listener)
  | 
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 | ||||||||