public class Geometry2AWT
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.awt.geom.AffineTransform |
toAWTAffineTransform(AffineTransform t)
Converts a GEF
AffineTransform into an AWT
AffineTransform . |
static java.awt.geom.Line2D.Double |
toAWTLine(Line l)
Converts a GEF
Line into an AWT Line2D . |
static java.awt.geom.Path2D.Double |
toAWTPath(Path p)
Converts a
Path into an equivalent AWT Path2D . |
static java.awt.geom.Point2D.Double |
toAWTPoint(Point p)
|
static java.awt.geom.Point2D.Double[] |
toAWTPoints(Point[] pts)
Converts a given array of GEF
Point s into an array of AWT
Point2D s with double precision (
Point2D.Double ). |
static java.awt.geom.Rectangle2D.Double |
toAWTRectangle(Rectangle r)
Converts a GEF
Rectangle into an AWT Rectangle2D . |
static java.awt.geom.RoundRectangle2D.Double |
toAWTRoundRectangle(RoundedRectangle r)
Converts a GEF
RoundedRectangle into an AWT
RoundRectangle2D . |
public static java.awt.geom.AffineTransform toAWTAffineTransform(AffineTransform t)
AffineTransform
into an AWT
AffineTransform
.t
- the AffineTransform
to transformAffineTransform
representing an
identical transformationpublic static java.awt.geom.Line2D.Double toAWTLine(Line l)
Line
into an AWT Line2D
.l
- the Line
to transformLine2D
, which is constructed by using the start (
BezierCurve.getP1()
) and end (BezierCurve.getP2()
)
Point
s of the passed-in Line
public static java.awt.geom.Path2D.Double toAWTPath(Path p)
Path
into an equivalent AWT Path2D
.p
- the Path
to convertPathIterator
representing the same pathpublic static final java.awt.geom.Point2D.Double toAWTPoint(Point p)
public static java.awt.geom.Point2D.Double[] toAWTPoints(Point[] pts)
Point
s into an array of AWT
Point2D
s with double precision (
Point2D.Double
).public static final java.awt.geom.Rectangle2D.Double toAWTRectangle(Rectangle r)
Converts a GEF Rectangle
into an AWT Rectangle2D
. Note
that the new Rectangle2D
is simply constructed by using the
values of the passed-in Rectangle
, 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
passed-in Rectangle
object as follows:
rectangle2d = Geometry2AWT.toAWTRectangle(rectangle.getExpanded(0, 0, 1, 1));
(see also AbstractRectangleBasedGeometry.getExpanded(double, double, double, double)
)
public static java.awt.geom.RoundRectangle2D.Double toAWTRoundRectangle(RoundedRectangle r)
Converts a GEF RoundedRectangle
into an AWT
RoundRectangle2D
. Note that the new RoundRectangle2D
is
simply constructed by using the values of the passed in
RoundedRectangle
, 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
passed-in RoundedRectangle
object as follows:
roundRectangle2d = Geometry2AWT.toAWTRoundRectangle(roundedRectangle.getExpanded(0, 0, 1, 1));
(see also
AbstractRectangleBasedGeometry.getExpanded(double, double, double, double)
)
r
- the RoundedRectangle
to convertRoundRectangle2D
, which is constructed using the x,
y, width, height, arcWidth, and arcHeight values of the passed in
RoundedRectangle
Copyright (c) 2014 itemis AG, and others. All rights reserved.