|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.vergil.toolbox.SnapConstraint
public class SnapConstraint
This constraint ensures that a point is a multiple of a constant that defaults to 5.0.
Red (johnr) |
Red (eal) |
Field Summary | |
---|---|
private static double |
_defaultResolution
The default resolution globally. |
private double |
_resolution
The resolution for this instance. |
Constructor Summary | |
---|---|
SnapConstraint()
Construct a new instance of a snap constraint. |
Method Summary | |
---|---|
double[] |
constrain(double[] point)
Modify the specified point to snap to grid using the local resolution. |
double[] |
constrain(double x,
double y)
Modify the specified point to snap to grid using the local resolution. |
void |
constrain(java.awt.geom.Point2D point)
Modify the specified point to snap to grid using the local resolution. |
static double[] |
constrainPoint(double[] point)
Modify the specified point to snap to grid using the global default resolution. |
static double[] |
constrainPoint(double x,
double y)
Modify the specified point to snap to grid using the global default resolution. |
static java.awt.geom.Point2D |
constrainPoint(java.awt.geom.Point2D point)
Modify the specified point to snap to grid using the global default resolution. |
void |
setResolution(double resolution)
Set the resolution for this instance. |
boolean |
snapped()
Return true to indicate that this does snap to grid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static double _defaultResolution
private double _resolution
Constructor Detail |
---|
public SnapConstraint()
Method Detail |
---|
public void constrain(java.awt.geom.Point2D point)
constrain
in interface PointConstraint
point
- The point to modify.public double[] constrain(double[] point)
point
- The point to modify (a dimension 2 array).
public double[] constrain(double x, double y)
x
- The x dimension of the point to modify.y
- The y dimension of the point to modify.
public static java.awt.geom.Point2D constrainPoint(java.awt.geom.Point2D point)
point
- The point to modify.
public static double[] constrainPoint(double[] point)
point
- The point to modify (a dimension 2 array).
public static double[] constrainPoint(double x, double y)
x
- The x dimension of the point to modify.y
- The y dimension of the point to modify.
public boolean snapped()
snapped
in interface PointConstraint
public void setResolution(double resolution)
resolution
- The new resolution.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |