gov.nasa.worldwind.render
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Nested Class Summary | |
|---|---|
static class |
MultiLineTextRenderer.WordIteratorHTML
Iterates through words from an HTML text line. |
| Field Summary | |
|---|---|
static int |
ALIGN_CENTER
|
static int |
ALIGN_LEFT
|
static int |
ALIGN_RIGHT
|
static String |
EFFECT_NONE
|
static String |
EFFECT_OUTLINE
|
static String |
EFFECT_SHADOW
|
| Constructor Summary | |
|---|---|
MultiLineTextRenderer(Font font)
|
|
MultiLineTextRenderer(com.sun.opengl.util.j2d.TextRenderer textRenderer)
|
|
| Method Summary | |
|---|---|
static boolean |
containsHTML(String text)
Return true if the text contains some sgml tags. |
void |
draw(String text,
int x,
int y)
Draw a multi-line text string with bounding rectangle top starting at the y position. |
void |
draw(String text,
int x,
int y,
int textLineHeight)
Draw a multi-line text string with bounding rectangle top starting at the y position. |
void |
draw(String text,
int x,
int y,
int textLineHeight,
String effect)
Draw a multi-line text string with bounding rectangle top starting at the y position. |
void |
draw(String text,
int x,
int y,
String effect)
Draw a multi-line text string with bounding rectangle top starting at the y position. |
void |
drawHTML(String text,
double x,
double y,
TextRendererCache renderers)
Draw a multi-line html text string with bounding rectangle top starting at the y position. |
static String |
getAttributeFromTagHTML(String text,
String attributeName)
Extract an attribute value from a HTML tag string. |
Color |
getBackColor()
Get the background color used for EFFECT_SHADOW and EFFECT_OUTLINE. |
Rectangle |
getBounds(String text)
Returns the bounding rectangle for a multi-line string. |
Rectangle |
getBoundsHTML(String text,
TextRendererCache renderers)
Returns the bounding rectangle for a multi-line html string. |
int |
getLineHeight()
Get the current line height in pixels. |
int |
getLineSpacing()
Get the current line spacing height in pixels. |
Color |
getLinkColor()
Get the current link color. |
double |
getMaxLineHeight(com.sun.opengl.util.j2d.TextRenderer tr)
Get the maximum line height for the given text renderer. |
int |
getTextAlign()
Get the current text alignment. |
Color |
getTextColor()
Get the current text color. |
com.sun.opengl.util.j2d.TextRenderer |
getTextRenderer()
Get the current TextRenderer. |
void |
pick(String text,
int x,
int y,
int textLineHeight,
DrawContext dc,
PickSupport pickSupport,
Object refObject,
Position refPosition)
Draw text with unique colors word bounding rectangles and add each as a pickable object to the provided PickSupport instance. |
void |
pickHTML(String text,
int x,
int y,
TextRendererCache renderers,
DrawContext dc,
PickSupport pickSupport,
Object refObject,
Position refPosition)
Draw text with unique colors word bounding rectangles and add each as a pickable object to the provided PickSupport instance. |
static String |
processLineBreaksHTML(String text)
Remove new line characters then replace BR and P tags with appropriate new lines. |
static String |
removeTagsHTML(String text)
Remove all HTML tags from a text string. |
void |
setBackColor(Color color)
Set the background color used for EFFECT_SHADOW and EFFECT_OUTLINE. |
void |
setContinuationString(String s)
Set the character string appended at the end of text truncated during a wrap operation when exceeding the given height limit. |
void |
setLineHeight(int height)
Set the current line height in pixels. |
void |
setLineSpacing(int height)
Set the current line spacing height in pixels. |
void |
setLinkColor(Color color)
Set the link color. |
void |
setTextAlign(int align)
Set the current text alignment. |
void |
setTextColor(Color color)
Set the text renderer color. |
String |
wrap(String text,
int width,
int height)
Add 'new line' characters inside a string so that it's bounding rectangle tries not to exceed the given dimension width. |
String |
wrapHTML(String text,
double width,
double height,
TextRendererCache renderers)
Add 'new line' characters inside an html text string so that it's bounding rectangle tries not to exceed the given dimension width. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ALIGN_CENTER
public static final int ALIGN_LEFT
public static final int ALIGN_RIGHT
public static final String EFFECT_NONE
public static final String EFFECT_OUTLINE
public static final String EFFECT_SHADOW
| Constructor Detail |
|---|
public MultiLineTextRenderer(Font font)
public MultiLineTextRenderer(com.sun.opengl.util.j2d.TextRenderer textRenderer)
| Method Detail |
|---|
public static boolean containsHTML(String text)
text - The text string to evaluate.
public void draw(String text, int x, int y)
Uses the current line height.
text - the multi-line text to draw.x - the x position for top left corner of text rectangle.y - the y position for top left corner of the text rectangle.public void draw(String text, int x, int y, int textLineHeight)
Uses the given line height.
text - the multi-line text to draw.x - the x position for top left corner of text rectangle.y - the y position for top left corner of the text rectangle.textLineHeight - the line height in pixels.public void draw(String text, int x, int y, int textLineHeight, String effect)
Uses the given line height and effect.
text - the multi-line text to draw.x - the x position for top left corner of text rectangle.y - the y position for top left corner of the text rectangle.textLineHeight - the line height in pixels.effect - the effect to use for the text rendering. Can be one of EFFECT_NONE,
EFFECT_SHADOW or EFFECT_OUTLINE.public void draw(String text, int x, int y, String effect)
Uses the current line height and the given effect.
text - the multi-line text to draw.x - the x position for top left corner of text rectangle.y - the y position for top left corner of the text rectangle.effect - the effect to use for the text rendering. Can be one of EFFECT_NONE,
EFFECT_SHADOW or EFFECT_OUTLINE.public void drawHTML(String text, double x, double y, TextRendererCache renderers)
text - the multi-line text to drawx - the x position for top left corner of text rectangley - the y position for top left corner of the text rectanglerenderers - a TextRendererCache instance.public static String getAttributeFromTagHTML(String text, String attributeName)
text - the HTML tage string.attributeName - the attribute name.
public Color getBackColor()
public Rectangle getBounds(String text)
Note that the X component of the rectangle is the number of lines found in the text and the Y component of the rectangle is the max line height encountered.
Note too that this method will automatically set the current line height to the max height found.
text - the multi-line text to evaluate.
public Rectangle getBoundsHTML(String text, TextRendererCache renderers)
text - the multi-line html text to evaluate.renderers - a TextRendererCache instance.
public int getLineHeight()
public int getLineSpacing()
public Color getLinkColor()
public double getMaxLineHeight(com.sun.opengl.util.j2d.TextRenderer tr)
tr - the TextRenderer.
public int getTextAlign()
ALIGN_LEFT the default,
ALIGN_CENTER or ALIGN_RIGHT.
public Color getTextColor()
public com.sun.opengl.util.j2d.TextRenderer getTextRenderer()
public void pick(String text, int x, int y, int textLineHeight, DrawContext dc, PickSupport pickSupport, Object refObject, Position refPosition)
text - the multi-line text to draw.x - the x position for top left corner of text rectangle.y - the y position for top left corner of the text rectangle.textLineHeight - the line height in pixels.dc - the current DrawContext.pickSupport - the PickSupport instance to be used.refObject - the user reference object associated with every picked word.refPosition - the user reference Position associated with every picked word.public void pickHTML(String text, int x, int y, TextRendererCache renderers, DrawContext dc, PickSupport pickSupport, Object refObject, Position refPosition)
text - the multi-line text to draw.x - the x position for top left corner of text rectangle.y - the y position for top left corner of the text rectangle.renderers - a TextRendererCache instance.dc - the current DrawContext.pickSupport - the PickSupport instance to be used.refObject - the user reference object associated with every picked word.refPosition - the user reference Position associated with every picked word.public static String processLineBreaksHTML(String text)
text - The html text string to process.
public static String removeTagsHTML(String text)
text - the string to filter.
public void setBackColor(Color color)
color - the color to use when drawing shadow or outline.public void setContinuationString(String s)
s - the continuation character string.public void setLineHeight(int height)
height - the current line height in pixels.public void setLineSpacing(int height)
height - the line spacing height in pixels.public void setLinkColor(Color color)
color - the color to use when drawing hyperlinks.public void setTextAlign(int align)
ALIGN_LEFT the default,
ALIGN_CENTER or ALIGN_RIGHT.
align - the current text alignment.public void setTextColor(Color color)
color - the color to use when drawing text.public String wrap(String text, int width, int height)
If the dimension height is more than zero, the text will be truncated accordingly and the continuation string will be appended to the last line.
Note that words will not be split and at least one word will be used per line so the longest word defines the final width of the bounding rectangle. Each line is trimmed of leading and trailing spaces.
text - the text string to wrapwidth - the maximum width in pixels the text can occupy.height - if not zero, the maximum height in pixels the text can occupy.
public String wrapHTML(String text, double width, double height, TextRendererCache renderers)
If the dimension height is more than zero, the text will be truncated accordingly and the continuation string will be appended to the last line.
Note that words will not be split and at least one word will be used per line so the longest word defines the final width of the bounding rectangle. Each line is trimmed of leading and trailing spaces.
text - the html text string to wrapwidth - the maximum width in pixels one text line can occupy.height - if not zero, the maximum height the text can occupy.renderers - a TextRendererCache instance.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||