Class Geometry2SWT
- java.lang.Object
-
- org.eclipse.gef.geometry.convert.swt.Geometry2SWT
-
public class Geometry2SWT extends java.lang.Object
Utility class to support conversions between GEF's geometry API and SWT's geometry classes.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PathData
toSWTPathData(Path p)
Converts the given path into an SWTPathData
representation.static Point
toSWTPoint(Point p)
Creates a new SWTPoint
from this Point.static int[]
toSWTPointArray(Line l)
Returns an integer array of dimension 4, whose values represent the integer-based coordinates of thisLine
's start and end point.static int[]
toSWTPointArray(Polygon p)
static int[]
toSWTPointArray(Polyline p)
static Rectangle
toSWTRectangle(Rectangle r)
static Region
toSWTRegion(Region r)
static Region
toSWTRegion(Ring r)
-
-
-
Method Detail
-
toSWTPathData
public static final PathData toSWTPathData(Path p)
Converts the given path into an SWTPathData
representation.
-
toSWTPoint
public static final Point toSWTPoint(Point p)
Creates a new SWTPoint
from this Point.- Parameters:
p
- thePoint
to convert- Returns:
- A new SWT Point
-
toSWTPointArray
public static final int[] toSWTPointArray(Line l)
Returns an integer array of dimension 4, whose values represent the integer-based coordinates of thisLine
's start and end point.- Parameters:
l
- theLine
to convert- Returns:
- an array containing integer values, which are obtained by casting x1, y1, x2, y2
-
toSWTPointArray
public static final int[] toSWTPointArray(Polygon p)
Returns an integer array, which represents the sequence of coordinates of the
Point
s that make up thisPolygon
. The x and y coordinate values are transfered to integer values by either applyingMath.floor(double)
orMath.ceil(double)
to them, dependent on their relative position to the centroid of thisPolygon
(seeAbstractPointListBasedGeometry.getCentroid()
).If the x coordinate of a
Point
is smaller than the x coordinate of the centroid, then the x coordinate of thatPoint
is rounded down. Otherwise it is rounded up. Accordingly, if the y coordinate of aPoint
is smaller than the y coordinate of the centroid, it is rounded down. Otherwise, it is rounded up.
-
toSWTPointArray
public static final int[] toSWTPointArray(Polyline p)
Returns an integer array, which represents the sequence of coordinates of the
Point
s that make up thisPolyline
. The x and y coordinate values are transfered to integer values by either applyingMath.floor(double)
orMath.ceil(double)
to them, dependent on their relative position to the centroid of thisPolyline
(seeAbstractPointListBasedGeometry.getCentroid()
).If the x coordinate of a
Point
is smaller than the x coordinate of the centroid, then the x coordinate of thatPoint
is rounded down. Otherwise it is rounded up. Accordingly, if the y coordinate of aPoint
is smaller than the y coordinate of the centroid, it is rounded down. Otherwise, it is rounded up.
-
-