public class GFFigureUtil
extends java.lang.Object
Constructor and Description |
---|
GFFigureUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Boolean |
containsPointInEllipse(org.eclipse.draw2d.geometry.Rectangle r,
int x,
int y)
Returns if the given point is contained in the ellipse defined by the
bounding rectangle.
|
static java.lang.Boolean |
containsPointInLine(int x1,
int y1,
int x2,
int y2,
int x,
int y,
int lineWidth)
Returns if the given point is contained in this line.
|
static java.lang.Boolean |
containsPointInPolygon(org.eclipse.draw2d.geometry.PointList points,
int x,
int y)
Returns if the given point is contained in this polygon.
|
static java.lang.Boolean |
containsPointInPolyline(org.eclipse.draw2d.geometry.PointList points,
int x,
int y,
int lineWidth)
Returns if the given point is contained in this polyline.
|
static void |
drawRichText(org.eclipse.draw2d.Graphics g,
java.lang.String draw,
int x,
int y,
IConfigurationProviderInternal configurationProvider,
AbstractText text) |
static org.eclipse.draw2d.geometry.PointList |
getAdjustedPointList(org.eclipse.draw2d.geometry.PointList points,
double zoom,
double lw)
Returns a new instance of the input point-list, which is adjusted
regarding the given zoom-factor and line-width.
|
static org.eclipse.draw2d.geometry.Rectangle |
getAdjustedRectangle(org.eclipse.draw2d.geometry.Rectangle rectangle,
double zoom,
int lw)
Returns a new instance of the input rectangle zoomed by the zoom-level
and shrinked by the half line-width.
|
static Path |
getBezierPath(java.util.List<BezierPoint> origPoints,
boolean isClosed)
Returns a path which draws a bezier-curve through the given
bezier-point-list.
|
static org.eclipse.draw2d.geometry.Rectangle |
getPathBounds(Path path)
Returns the rectangular bounds of a given Path.
|
static org.eclipse.draw2d.geometry.PointList |
getPointList(Polyline polyline)
Returns a draw2d point-list of the given polygon model-element.
|
static org.eclipse.draw2d.geometry.PointList |
getTranslatedPointList(org.eclipse.draw2d.geometry.PointList points,
int dx,
int dy)
Returns a new PointList, which results from translating the given
PointList.
|
static boolean |
hasBezierDistance(java.util.List<BezierPoint> points)
Returns true, if at least one of the points in the list has a
bezier-distance != 0.
|
static void |
paintColorFlow(IResourceRegistryHolder registryHolder,
org.eclipse.draw2d.geometry.Rectangle rectangle,
org.eclipse.draw2d.Graphics graphics,
GradientColoredArea coloredArea,
double zoom,
boolean vertical)
Fills a given rectangle with a gradient color-flow on the given Graphics.
|
public static void paintColorFlow(IResourceRegistryHolder registryHolder, org.eclipse.draw2d.geometry.Rectangle rectangle, org.eclipse.draw2d.Graphics graphics, GradientColoredArea coloredArea, double zoom, boolean vertical)
Example: The parameters [Color.red, Color.yellow, Color.green] and [0, 20, 80] would result in a filled rectangle, where the top 20% are flow from red to yellow and the next 80% flow from yellow to green.
registryHolder
- To get the
IResourceRegistry.getSwtColor(int, int, int)
.rectangle
- The rectangle, which to fill with the gradient color-flow.graphics
- The Graphics, on which to fill the rectangle.coloredArea
- The area of the rectangle and the colors used for filling.zoom
- The current zoom-levelvertical
- If true, fills the area vertically, otherwise horizontallypublic static java.lang.Boolean containsPointInEllipse(org.eclipse.draw2d.geometry.Rectangle r, int x, int y)
r
- The bounding-rectangle of the ellipse.x
- The x-coordinate of the point to check.y
- The y-coordinate of the point to check.public static java.lang.Boolean containsPointInLine(int x1, int y1, int x2, int y2, int x, int y, int lineWidth)
x1
- The x-coordinate of the start-point of the line.y1
- The y-coordinate of the start-point of the line.x2
- The x-coordinate of the end-point of the line.y2
- The y-coordinate of the end-point of the line.x
- The x-coordinate of the point to check.y
- The y-coordinate of the point to check.lineWidth
- The width of the line.public static java.lang.Boolean containsPointInPolyline(org.eclipse.draw2d.geometry.PointList points, int x, int y, int lineWidth)
points
- The points of the polyline.x
- The x-coordinate of the point to check.y
- The y-coordinate of the point to check.lineWidth
- The width of the line.public static java.lang.Boolean containsPointInPolygon(org.eclipse.draw2d.geometry.PointList points, int x, int y)
points
- The points of the polygon.x
- The x-coordinate of the point to check.y
- The y-coordinate of the point to check.public static org.eclipse.draw2d.geometry.PointList getPointList(Polyline polyline)
polyline
- The polygon model-element for which to return the draw2d
point-list.public static org.eclipse.draw2d.geometry.Rectangle getPathBounds(Path path)
path
- The Path for which to return the bounds.public static org.eclipse.draw2d.geometry.Rectangle getAdjustedRectangle(org.eclipse.draw2d.geometry.Rectangle rectangle, double zoom, int lw)
rectangle
- The rectangle to zoom and shrink.zoom
- The zoom-level to use.lw
- The line-width to use.public static org.eclipse.draw2d.geometry.PointList getAdjustedPointList(org.eclipse.draw2d.geometry.PointList points, double zoom, double lw)
points
- The point-list which to adjust.zoom
- The zoom-factor by which to zoom all points.lw
- The line-width, which to consider when translating towards the
center.public static org.eclipse.draw2d.geometry.PointList getTranslatedPointList(org.eclipse.draw2d.geometry.PointList points, int dx, int dy)
points
- The PointList, which is used as source for translation. It is
not changed.dx
- The x-value to translate.dy
- The y-value to translate.public static Path getBezierPath(java.util.List<BezierPoint> origPoints, boolean isClosed)
origPoints
- The bezier-points through which to draw the bezier-curve.isClosed
- If true, then the path will be closed, so that the
bezier-curve ends at the start-point. Note, that the result is
different to a path with the same start/end point but where
isClosed is false, because in that case there is no rounded
corner at the start/end point.public static boolean hasBezierDistance(java.util.List<BezierPoint> points)
points
- The points, which bezier-distances to check.public static void drawRichText(org.eclipse.draw2d.Graphics g, java.lang.String draw, int x, int y, IConfigurationProviderInternal configurationProvider, AbstractText text)