|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.omGraphics.awt.AbstractShapeDecoration com.bbn.openmap.omGraphics.awt.TextShapeDecoration
public class TextShapeDecoration
A ShapeDecoration that draws a text along a path
Field Summary | |
---|---|
static int |
BACKWARD
Orientation for the shape text decoration: use reverse poly direction |
static int |
BASELINE
Baseline vertical alignment |
static int |
BOTTOM
Bottom vertical alignment |
static int |
BOTTOM_TO_TOP
Orientation for the shape text decoration: force bottom to top |
static int |
CENTER
Center vertical alignment |
static int |
FOLLOW_POLY
Text will follow the poly instead of being written on the segment from begin to end of the poly, also allow text to be uncomplete. |
static int |
FORWARD
Orientation for the shape text decoration: use poly direction |
static int |
LEFT_TO_RIGHT
Orientation for the shape text decoration: force left to right |
static int |
MOST_READABLE
Orientation for the shape text decoration: occidental reading use |
static int |
RIGHT_TO_LEFT
Orientation for the shape text decoration: force right to left |
static int |
TOP
Top vertical alignment |
static int |
TOP_TO_BOTTOM
Orientation for the shape text decoration: force top to bottom |
Fields inherited from interface com.bbn.openmap.omGraphics.awt.ShapeDecoration |
---|
LEFT, RIGHT |
Constructor Summary | |
---|---|
TextShapeDecoration(java.lang.String text)
Constructor. |
|
TextShapeDecoration(java.lang.String text,
java.awt.Font font,
int orientation,
int verticalAlignment)
Constructor. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g,
java.awt.geom.Point2D[] points,
boolean complete)
Draws the text along the polyline |
static void |
drawAngledString(java.awt.Graphics g,
java.lang.String text,
int x,
int y,
double angle)
Draws the text from a starting point with an angle |
protected void |
drawFollow(java.awt.Graphics g,
java.awt.geom.Point2D[] pts,
boolean reverse)
Draws the text character per character to follow the polyline |
java.awt.Font |
getFont()
Returns the font. |
java.lang.String |
getText()
Returns the text. |
int |
getVerticalAlignment()
Returns the verticalAlignment. |
protected boolean |
needToReverse(int x1,
int y1,
int x2,
int y2)
Returns true if the polyline need to be reverted for the text to be drawn with the specified orientation. |
void |
setFont(java.awt.Font font)
Sets the font. |
void |
setText(java.lang.String text)
Sets the text. |
void |
setVerticalAlignment(int verticalAlignment)
Sets the verticalAlignment. |
Methods inherited from class com.bbn.openmap.omGraphics.awt.AbstractShapeDecoration |
---|
getLength, getOrientation, getPaint, getStroke, getWidth, restoreGraphics, revert, setGraphics, setLength, setOrientation, setPaint, setStroke, setWidth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BASELINE
public static final int CENTER
public static final int TOP
public static final int BOTTOM
public static final int FORWARD
public static final int BACKWARD
public static final int LEFT_TO_RIGHT
public static final int RIGHT_TO_LEFT
public static final int TOP_TO_BOTTOM
public static final int BOTTOM_TO_TOP
public static final int MOST_READABLE
public static final int FOLLOW_POLY
Constructor Detail |
---|
public TextShapeDecoration(java.lang.String text, java.awt.Font font, int orientation, int verticalAlignment)
text
- font
- orientation
- verticalAlignment
- public TextShapeDecoration(java.lang.String text)
text
- Method Detail |
---|
public void draw(java.awt.Graphics g, java.awt.geom.Point2D[] points, boolean complete)
points
- the polylinecomplete
- true if the polyline length equals the
decoration lengthShapeDecoration.draw(Graphics,
Point2D[], boolean)
protected boolean needToReverse(int x1, int y1, int x2, int y2)
x1
- starting point x coordinatey1
- starting point y coordinatex2
- ending point x coordinatey2
- ending point y coordinate
protected void drawFollow(java.awt.Graphics g, java.awt.geom.Point2D[] pts, boolean reverse)
g
- pts
- reverse
- public static void drawAngledString(java.awt.Graphics g, java.lang.String text, int x, int y, double angle)
g
- text
- x
- y
- angle
- public java.awt.Font getFont()
public java.lang.String getText()
public void setFont(java.awt.Font font)
font
- The font to setpublic void setText(java.lang.String text)
text
- The text to setpublic int getVerticalAlignment()
public void setVerticalAlignment(int verticalAlignment)
verticalAlignment
- The verticalAlignment to set (TOP, CENTER,
BASELINE, BOTTOM)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |