|
JHotDraw 7.5.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@NotNull public interface Constrainer
A constrainer constrains editing operations performed by
Tool
s and
Handle
s on a DrawingView
.
Constrainer
objects are associated to DrawingView
's.
Constrainers can draw themselves onto the drawing view to visualize the constraints that they impose. Typically by drawing a grid of some kind.
Strategy
Editing can be constrained by a constrainer which is associated to a
drawing view.
Context: DrawingView
; Strategy: Constrainer
.
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-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |