public final class CanvasUtilities
extends java.lang.Object
Red |
Modifier and Type | Field and Description |
---|---|
static double |
EAST
double representation of EAST: 0 degrees
|
static double |
NORTH
double representation of NORTH: -90 degrees (-PI/2)
|
static double |
NORTHEAST
double representation of NORTHEAST: -45 degrees (PI/4)
|
static double |
NORTHWEST
double representation of NORTHWEST: -135 degrees (-PI*3/4)
|
static double |
SOUTH
double representation of SOUTH: 90 degrees (PI/2)
|
static double |
SOUTHEAST
double representation of SOUTHEAST: 45 degrees (PI/4)
|
static double |
SOUTHWEST
double representation of SOUTHWEST: 135 degrees (PI*3/4)
|
static double |
WEST
double representation of WEST: 180 degrees (PI)
|
Modifier and Type | Method and Description |
---|---|
static java.awt.Shape |
clone(java.awt.Shape s)
Deprecated.
Use ShapeUtilities.cloneShape() instead
|
static java.awt.geom.Rectangle2D |
computeCompositeBounds(java.util.Iterator i)
Compute a composite bounding box.
|
static java.awt.Shape |
computeCompositeShape(java.util.Iterator i)
Compute a composite shape.
|
static java.awt.geom.AffineTransform |
computeFitTransform(java.awt.geom.RectangularShape r,
java.awt.geom.RectangularShape s)
Get the transform that will make the first
rectangle change fit within the second, while preserving the shape.
|
static java.awt.geom.Rectangle2D |
computeSiteBounds(java.util.Iterator i)
Compute the bounding box of a set of connectors.
|
static java.awt.geom.AffineTransform |
computeTransform(java.awt.geom.RectangularShape r,
java.awt.geom.RectangularShape s)
Get the transform that will make the first
rectangle change into the second.
|
static java.awt.geom.Point2D |
getCenterPoint(Figure f)
Return the point at the center of a figure.
|
static java.awt.geom.Point2D |
getCenterPoint(Figure f,
TransformContext root)
Return the point at the center of a figure, in the
given transform context.
|
static java.awt.geom.Point2D |
getCenterPoint(java.awt.geom.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 java.awt.geom.Point2D |
getLocation(java.awt.geom.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(java.awt.geom.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(java.util.Iterator i,
java.awt.geom.Rectangle2D region)
Return the first figure that is hit by the given region.
|
static Figure |
pick(java.util.Iterator i,
java.awt.geom.Rectangle2D region,
Filter filter)
Return the first figure that is hit by the given region.
|
static java.util.Iterator |
pickIter(java.util.Iterator i,
java.awt.geom.Rectangle2D region)
Return an iterator over the figures hit by the given region.
|
static int |
reverseDirection(int direction)
Reverse a direction flag.
|
static java.awt.Shape |
transform(java.awt.geom.RectangularShape r,
java.awt.geom.AffineTransform at)
Deprecated.
Use diva.util.java2d.ShapeUtilities.transformRectangle()
or diva.util.java2d.ShapeUtilities.transformRectangularShape()
|
static java.awt.Shape |
transform(java.awt.Shape s,
java.awt.geom.AffineTransform at)
Deprecated.
Use ShapeUtilities.transformModify()
|
static java.awt.geom.Point2D |
transformInto(java.awt.geom.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 java.awt.geom.Point2D |
translate(java.awt.geom.Point2D.Double p,
double distance,
int direction)
Translate a point the given distance in the direction given
by the flag.
|
static java.awt.geom.Point2D |
translate(java.awt.geom.Point2D.Float p,
double distance,
int direction)
Translate a point the given distance in the direction given
by the flag.
|
static java.awt.geom.Point2D |
translate(java.awt.geom.Point2D p,
double distance,
int direction)
Translate a point the given distance in the direction given
by the flag.
|
static java.awt.Shape |
translate(java.awt.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.
|
public static final double WEST
public static final double NORTH
public static final double EAST
public static final double SOUTH
public static final double NORTHWEST
public static final double NORTHEAST
public static final double SOUTHWEST
public static final double SOUTHEAST
@Deprecated public static java.awt.Shape clone(java.awt.Shape s)
public static java.awt.Shape computeCompositeShape(java.util.Iterator i)
public static java.awt.geom.Rectangle2D computeSiteBounds(java.util.Iterator i)
public static java.awt.geom.Rectangle2D computeCompositeBounds(java.util.Iterator i)
public static java.awt.geom.AffineTransform computeTransform(java.awt.geom.RectangularShape r, java.awt.geom.RectangularShape s)
public static java.awt.geom.AffineTransform computeFitTransform(java.awt.geom.RectangularShape r, java.awt.geom.RectangularShape s)
public static java.awt.geom.Point2D getCenterPoint(java.awt.geom.Rectangle2D r)
public static java.awt.geom.Point2D getCenterPoint(Figure f)
public static java.awt.geom.Point2D getCenterPoint(Figure f, TransformContext root)
public static int getDirection(double angle)
public static double getNormal(int direction)
public static java.awt.geom.Point2D getLocation(java.awt.geom.Rectangle2D r, int location)
public static boolean isOrthogonal(java.awt.geom.AffineTransform at)
public static double moduloAngle(double angle)
public static Figure pick(java.util.Iterator i, java.awt.geom.Rectangle2D region)
i
- An iterator over figuresregion
- A rectangle which represents the pick or hit regionpublic static Figure pick(java.util.Iterator i, java.awt.geom.Rectangle2D region, Filter filter)
i
- An iterator over figuresregion
- A rectangle which represents the pick or hit regionpublic static java.util.Iterator pickIter(java.util.Iterator i, java.awt.geom.Rectangle2D region)
i
- An iterator over figuresregion
- A rectangle which represents the pick or hit regionpublic static int reverseDirection(int direction)
@Deprecated public static java.awt.Shape transform(java.awt.geom.RectangularShape r, java.awt.geom.AffineTransform at)
@Deprecated public static java.awt.Shape transform(java.awt.Shape s, java.awt.geom.AffineTransform at)
@Deprecated public static java.awt.geom.Point2D transformInto(java.awt.geom.Point2D p, TransformContext local, TransformContext root)
public static void translate(Figure f, double distance, int direction)
public static java.awt.geom.Point2D translate(java.awt.geom.Point2D p, double distance, int direction)
public static java.awt.geom.Point2D translate(java.awt.geom.Point2D.Double p, double distance, int direction)
public static java.awt.geom.Point2D translate(java.awt.geom.Point2D.Float p, double distance, int direction)
@Deprecated public static java.awt.Shape translate(java.awt.Shape s, double x, double y)
public static void translateTo(Figure f, double x, double y)