public class Geometry2SWT
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static org.eclipse.swt.graphics.PathData |
toSWTPathData(Path p)
Converts the given path into an SWT
PathData representation. |
static org.eclipse.swt.graphics.Point |
toSWTPoint(Point p)
Creates a new SWT
Point from this
Point. |
static int[] |
toSWTPointArray(Line l)
Returns an integer array of dimension 4, whose values represent the
integer-based coordinates of this
Line 's start and end point. |
static int[] |
toSWTPointArray(Polygon p)
|
static int[] |
toSWTPointArray(Polyline p)
|
static org.eclipse.swt.graphics.Rectangle |
toSWTRectangle(Rectangle r)
Converts a
Rectangle into an
Rectangle . |
static org.eclipse.swt.graphics.Region |
toSWTRegion(Region r)
Constructs a new
Region that covers the
same area as this Region . |
static org.eclipse.swt.graphics.Region |
toSWTRegion(Ring r)
Constructs a new
Region from this
Ring . |
public static final org.eclipse.swt.graphics.PathData toSWTPathData(Path p)
PathData
representation.p
- the Path
to convertPathData
representing this path.public static final org.eclipse.swt.graphics.Point toSWTPoint(Point p)
Point
from this
Point.p
- the Point
to convertpublic static final int[] toSWTPointArray(Line l)
Line
's start and end point.l
- the Line
to convertpublic static final int[] toSWTPointArray(Polygon p)
Returns an integer array, which represents the sequence of coordinates of
the Point
s that make up this Polygon
. The x and y
coordinate values are transfered to integer values by either applying
Math.floor(double)
or Math.ceil(double)
to them,
dependent on their relative position to the centroid of this
Polygon
(see AbstractPointListBasedGeometry.getCentroid()
).
If the x coordinate of a Point
is smaller than the x coordinate
of the centroid, then the x coordinate of that Point
is rounded
down. Otherwise it is rounded up. Accordingly, if the y coordinate of a
Point
is smaller than the y coordinate of the centroid, it is
rounded down. Otherwise, it is rounded up.
public static final int[] toSWTPointArray(Polyline p)
Returns an integer array, which represents the sequence of coordinates of
the Point
s that make up this Polyline
. The x and y
coordinate values are transfered to integer values by either applying
Math.floor(double)
or Math.ceil(double)
to them,
dependent on their relative position to the centroid of this
Polyline
(see AbstractPointListBasedGeometry.getCentroid()
).
If the x coordinate of a Point
is smaller than the x coordinate
of the centroid, then the x coordinate of that Point
is rounded
down. Otherwise it is rounded up. Accordingly, if the y coordinate of a
Point
is smaller than the y coordinate of the centroid, it is
rounded down. Otherwise, it is rounded up.
public static final org.eclipse.swt.graphics.Rectangle toSWTRectangle(Rectangle r)
public static final org.eclipse.swt.graphics.Region toSWTRegion(Region r)
Copyright (c) 2014 itemis AG, and others. All rights reserved.