public class AWT2Geometry extends Object
| Modifier and Type | Method and Description |
|---|---|
static AffineTransform |
toAffineTransform(AffineTransform t)
Converts an AWT
AffineTransform into a GEF
AffineTransform |
static Line |
toLine(Line2D l)
|
static Path |
toPath(Path2D p)
|
static Point |
toPoint(Point2D p)
|
static Point[] |
toPoints(Point2D[] pts)
|
static Rectangle |
toRectangle(Rectangle2D r)
Converts an AWT
Rectangle2D into a GEF Rectangle. |
static RoundedRectangle |
toRoundedRectangle(RoundRectangle2D r)
Converts an AWT
RoundRectangle2D into a GEF
RoundedRectangle. |
public static AffineTransform toAffineTransform(AffineTransform t)
AffineTransform into a GEF
AffineTransformt - the AffineTransform to transformAffineTransform representing an identical
transformationpublic static final Line toLine(Line2D l)
l - the Line2D to convertLine, which is constructed by using the start (
Line2D.getP1()) and end (Line2D.getP2()) points
of the passed-in Line2Dpublic static final Rectangle toRectangle(Rectangle2D r)
Converts an AWT Rectangle2D into a GEF Rectangle. Note
that the new Rectangle is simply constructed by using the values
of the passed-in Rectangle2D, not compensating the fact that the
width and height of a rectangle are interpreted differently in Java2D and
GEF.
In Java2D, the width and height of a Rectangle2D are oversized by
exactly 1, i.e. the right and bottom edges of a Rectangle2D are
not regarded to belong to the visual object.
If you wish to retain this interpretation, you have to modify the
resulting GEF Rectangle object as follows:
rectangle.shrink(0, 0, 1, 1);
(see also AbstractRectangleBasedGeometry.shrink(double, double, double, double),
AbstractRectangleBasedGeometry.getShrinked(double, double, double, double))
r - the Rectangle2D to convertRectangle, which is constructed using the x, y,
width, and height values of the passed-in Rectangle2D.public static RoundedRectangle toRoundedRectangle(RoundRectangle2D r)
Converts an AWT RoundRectangle2D into a GEF
RoundedRectangle. Note that the new RoundedRectangle is
simply constructed by using the values of the passed-in
RoundRectangle2D, not compensating the fact that the width and
height of a rectangle are interpreted differently in Java2D and GEF.
In Java2D, the width and height of a RoundRectangle2D are
oversized by exactly 1, i.e. the right and bottom edges of a
RoundRectangle2D are not regarded to belong to the visual object.
If you wish to retain this interpretation, you have to modify the
resulting GEF RoundedRectangle object as follows:
roundedRectangle.shrink(0, 0, 1, 1);
(see also AbstractRectangleBasedGeometry.shrink(double, double, double, double)
, AbstractRectangleBasedGeometry.getShrinked(double, double, double, double))
r - the RoundRectangle2D to convertRoundedRectangle, which is constructed using the x,
y, width, height, arcWidth, and arcHeight values of the passed in
RoundRectangle2DCopyright (c) 2014 itemis AG, and others. All rights reserved.