|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.canvas.CanvasUtilities
public final class CanvasUtilities
A collection of canvas utilities. These utilities perform useful functions related to the structural aspects of diva.canvas that do not properly belong in any one class. Some of them perform utility geometric functions that are not available in the Java 2D API, while others accept iterators over Figures or Shapes and compute a useful composite result.
Method Summary | |
---|---|
static Shape |
clone(Shape s)
Deprecated. Use ShapeUtilities.cloneShape() instead |
static Rectangle2D |
computeCompositeBounds(Iterator i)
Compute a composite bounding box. |
static Shape |
computeCompositeShape(Iterator i)
Compute a composite shape. |
static AffineTransform |
computeFitTransform(RectangularShape r,
RectangularShape s)
Get the transform that will make the first rectangle change fit within the second, while preserving the shape. |
static Rectangle2D |
computeSiteBounds(Iterator i)
Compute the bounding box of a set of connectors. |
static AffineTransform |
computeTransform(RectangularShape r,
RectangularShape s)
Get the transform that will make the first rectangle change into the second. |
static Point2D |
getCenterPoint(Figure f)
Return the point at the center of a figure. |
static Point2D |
getCenterPoint(Figure f,
TransformContext root)
Return the point at the center of a figure, in the given transform context. |
static Point2D |
getCenterPoint(Rectangle2D r)
Return the point at the center of a Rectangle. |
static int |
getDirection(double angle)
Return the closest direction from SwingConstants, based on the given angle. |
static Point2D |
getLocation(Rectangle2D r,
int location)
Get the point on the given rectangular shape indicated by the location flag. |
static double |
getNormal(int direction)
Return an angle in radians, given a direction from SwingConstants. |
static boolean |
isOrthogonal(AffineTransform at)
Return true if the given transform maps a rectangle to a rectangle. |
static double |
moduloAngle(double angle)
Return the angle between -PI and PI that corresponds to the given angle. |
static Figure |
pick(Iterator i,
Rectangle2D region)
Return the first figure that is hit by the given region. |
static Figure |
pick(Iterator i,
Rectangle2D region,
Filter filter)
Return the first figure that is hit by the given region. |
static Iterator |
pickIter(Iterator i,
Rectangle2D region)
Return an iterator over the figures hit by the given region. |
static int |
reverseDirection(int direction)
Reverse a direction flag. |
static Shape |
transform(RectangularShape r,
AffineTransform at)
Deprecated. Use diva.util.java2d.ShapeUtilities.transformRectangle() or diva.util.java2d.ShapeUtilities.transformRectangularShape() |
static Shape |
transform(Shape s,
AffineTransform at)
Deprecated. Use ShapeUtilities.transformModify() |
static Point2D |
transformInto(Point2D p,
TransformContext local,
TransformContext root)
Deprecated. Use local.getTransform(root) instead. |
static void |
translate(Figure f,
double distance,
int direction)
Translate a figure the given distance in the direction given by the flag. |
static Point2D |
translate(Point2D.Double p,
double distance,
int direction)
Translate a point the given distance in the direction given by the flag. |
static Point2D |
translate(Point2D.Float p,
double distance,
int direction)
Translate a point the given distance in the direction given by the flag. |
static Point2D |
translate(Point2D p,
double distance,
int direction)
Translate a point the given distance in the direction given by the flag. |
static Shape |
translate(Shape s,
double x,
double y)
Deprecated. Use ShapeUtilities.translateModify() |
static void |
translateTo(Figure f,
double x,
double y)
Move a figure so that its origin is located at the given coordinates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Shape clone(Shape s)
public static Shape computeCompositeShape(Iterator i)
public static Rectangle2D computeSiteBounds(Iterator i)
public static Rectangle2D computeCompositeBounds(Iterator i)
public static AffineTransform computeTransform(RectangularShape r, RectangularShape s)
public static AffineTransform computeFitTransform(RectangularShape r, RectangularShape s)
public static Point2D getCenterPoint(Rectangle2D r)
public static Point2D getCenterPoint(Figure f)
public static Point2D getCenterPoint(Figure f, TransformContext root)
public static int getDirection(double angle)
public static double getNormal(int direction)
public static Point2D getLocation(Rectangle2D r, int location)
public static boolean isOrthogonal(AffineTransform at)
public static double moduloAngle(double angle)
public static Figure pick(Iterator i, Rectangle2D region)
i
- An iterator over figuresregion
- A rectangle which represents the pick or hit region
public static Figure pick(Iterator i, Rectangle2D region, Filter filter)
i
- An iterator over figuresregion
- A rectangle which represents the pick or hit region
public static Iterator pickIter(Iterator i, Rectangle2D region)
i
- An iterator over figuresregion
- A rectangle which represents the pick or hit region
public static int reverseDirection(int direction)
public static Shape transform(RectangularShape r, AffineTransform at)
public static Shape transform(Shape s, AffineTransform at)
public static Point2D transformInto(Point2D p, TransformContext local, TransformContext root)
public static void translate(Figure f, double distance, int direction)
public static Point2D translate(Point2D p, double distance, int direction)
public static Point2D translate(Point2D.Double p, double distance, int direction)
public static Point2D translate(Point2D.Float p, double distance, int direction)
public static Shape translate(Shape s, double x, double y)
public static void translateTo(Figure f, double x, double y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |