|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectus.zuercher.gpx2map.plotter.label.Label
public class Label
Label represents a text label for a marker.
| Field Summary | |
|---|---|
private Rectangle |
area
The location of the label's rectangle in its current position. |
private Color |
color
The label's color. |
private int |
distance
The distance from the marker's center to the text. |
private Font |
font
The label's font. |
private int |
height
Height of the rectangle containing the rendered label text. |
private String |
label
The label's text. |
private Point |
marker
The location of the center of the label's marker. |
private LabelPosition |
position
The label's current position relative to the marker. |
private LabelPosition |
preferredPosition
The label's preferred location relative to the marker. |
private byte[][] |
textAlphaRasters
A byte[] containing the 8-bit alpha levels for a rectangle that contains the rendered label text. |
private int |
width
Width of the rectangle containing the rendered label text. |
| Constructor Summary | |
|---|---|
Label(String label,
Point marker,
int distance,
Font font,
Color color,
Rectangle imageBounds)
Construct a new Label. |
|
| Method Summary | |
|---|---|
private Rectangle |
computeLocation(LabelPosition position)
Compute a rectangle that bounds the rendered label text when drawn at the given position. |
private LabelPosition |
computePreferredPosition(Rectangle imageBounds)
Compute the preferred position of this label. |
List<Pixel> |
getPixels()
Returns a list of Pixel objects representing the rendered label
text in its final position. |
LabelPosition |
getPosition()
Returns the label's current position. |
LabelPosition |
getPreferredPosition()
Returns the label's preferred position. |
Rectangle |
getRectangle()
Returns the label's bounding rectangle. |
private byte[][] |
renderText()
Generate a two-dimensional byte array of alpha values for the label text. |
void |
setPosition(LabelPosition position)
Set the label's current position. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final String label
private final Font font
private final Color color
private final Point marker
private final int distance
marker's center to the text.
private final byte[][] textAlphaRasters
private final int width
private final int height
private final LabelPosition preferredPosition
private LabelPosition position
private Rectangle area
current position.
| Constructor Detail |
|---|
public Label(String label,
Point marker,
int distance,
Font font,
Color color,
Rectangle imageBounds)
label - label textmarker - marker locationdistance - text distance from markerfont - text fontcolor - text colorimageBounds - image sizecomputePreferredPosition(Rectangle)| Method Detail |
|---|
public LabelPosition getPosition()
public LabelPosition getPreferredPosition()
public void setPosition(LabelPosition position)
getRectangle().
position - label's new position.public Rectangle getRectangle()
public List<Pixel> getPixels()
Pixel objects representing the rendered label
text in its final position.
Pixel objects representing the rendered label.private byte[][] renderText()
private LabelPosition computePreferredPosition(Rectangle imageBounds)
LabelPosition.getPreferredOrder(). The first
position given in that array that does not cause the label to be
clipped by the image bounds is returned.
imageBounds - the cropping rectangle that represents the final
image
private Rectangle computeLocation(LabelPosition position)
position - a label position
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||