|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.draw2d.FigureUtilities
org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities
public class FigureUtilities
A set of methods that are useful when manipulating figures. These are often used in the paint routines or locators of IFigure implementors to do complex geometry calculations that may be common across different parts of a hierarchy.
Constructor Summary | |
---|---|
FigureUtilities()
|
Method Summary | |
---|---|
static java.lang.Integer |
colorToInteger(Color c)
Method colorToInteger. |
static Rectangle |
getAnchorableFigureBounds(IFigure figure)
Calculates the anchorable figure bounds. |
static Point |
getLocation(int pos,
Dimension dim,
Rectangle constraint)
Return the location within the supplied constraint of an object of dimension dim according to the alignment parameter. |
static Point |
getLocation(int pos,
Rectangle topos,
Rectangle constraint)
Return the location within the supplied constraint the supplied rectangle requires to be positioned according to the alignment parameter pos. |
static Color |
integerToColor(java.lang.Integer i)
Method integerToColor. |
static RGB |
integerToRGB(java.lang.Integer color)
Method integerToRGB converts from an Integer to an RGB representation |
static void |
paintGridWithStyle(Graphics g,
IFigure f,
Point origin,
int distanceX,
int distanceY,
int lineStyle,
int[] dashes)
Helper method to paint a grid. |
static java.lang.Integer |
RGBToInteger(RGB rgb)
Method RGBToInteger converts from an RGB to an Integer representation |
Methods inherited from class org.eclipse.draw2d.FigureUtilities |
---|
darker, findCommonAncestor, getFontMetrics, getGC, getRoot, getStringDimension, getStringExtents, getTextDimension, getTextExtents, getTextExtents, getTextWidth, isAncestor, lighter, makeGhostShape, mixColors, mixColors, paintEtchedBorder, paintEtchedBorder, paintGrid, setFont |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FigureUtilities()
Method Detail |
---|
public static java.lang.Integer colorToInteger(Color c)
c
-
public static Color integerToColor(java.lang.Integer i)
i
-
public static java.lang.Integer RGBToInteger(RGB rgb)
rgb
-
public static RGB integerToRGB(java.lang.Integer color)
color
-
public static Point getLocation(int pos, Rectangle topos, Rectangle constraint)
NW-----N------NE | | W NS/EW E | | SW-----S------SE
pos
- a geographic PositionConstant (N,E,W,S,NW,NW,NS,EW)topos
- the rectangle to be (re)positioned.constraint
- the containing bounds.
public static Point getLocation(int pos, Dimension dim, Rectangle constraint)
pos
- a geographic PositionConstant (N,E,W,S,NW,NW,NS,EW)dim
- some dimension.constraint
- the containing bounds.
getLocation(int, Rectangle, Rectangle)
public static void paintGridWithStyle(Graphics g, IFigure f, Point origin, int distanceX, int distanceY, int lineStyle, int[] dashes)
g
- The Graphics object to be used for paintingf
- The figure in which the grid is to be paintedorigin
- Any point where the grid lines are expected to intersectdistanceX
- Distance between vertical grid lines; if 0 or less, vertical grid
lines will not be drawndistanceY
- Distance between horizontal grid lines; if 0 or less, horizontal
grid lines will not be drawnlineStyle
- Line style to be used for painting the grid linesdashes
- Dash pattern to be used for the grid line (ignored if lineStyle != LINE_CUSTOM)public static Rectangle getAnchorableFigureBounds(IFigure figure)
IOvalAnchorableFigure
and IPolygonAnchorableFigure
interfaces. The latter interface is more popular because any figure can be approximated
with line segments including ellipse. Therefore, we need to check first if it's an
ellipse like figure and then if it's some kind of a polygon.
figure
- the figure
Rectangle
of the anchorable part of the figure
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.