Class Geometry2SWT
- java.lang.Object
-
- org.eclipse.gef.geometry.convert.swt.Geometry2SWT
-
public class Geometry2SWT extends java.lang.ObjectUtility 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 PathDatatoSWTPathData(Path p)Converts the given path into an SWTPathDatarepresentation.static PointtoSWTPoint(Point p)Creates a new SWTPointfrom 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 RectangletoSWTRectangle(Rectangle r)static RegiontoSWTRegion(Region r)static RegiontoSWTRegion(Ring r)
-
-
-
Method Detail
-
toSWTPathData
public static final PathData toSWTPathData(Path p)
Converts the given path into an SWTPathDatarepresentation.
-
toSWTPoint
public static final Point toSWTPoint(Point p)
Creates a new SWTPointfrom this Point.- Parameters:
p- thePointto 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- theLineto 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
Points 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
Pointis smaller than the x coordinate of the centroid, then the x coordinate of thatPointis rounded down. Otherwise it is rounded up. Accordingly, if the y coordinate of aPointis 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
Points 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
Pointis smaller than the x coordinate of the centroid, then the x coordinate of thatPointis rounded down. Otherwise it is rounded up. Accordingly, if the y coordinate of aPointis smaller than the y coordinate of the centroid, it is rounded down. Otherwise, it is rounded up.
-
-