public class TextElement extends Object implements StyleKeys
| Modifier and Type | Field and Description |
|---|---|
static LabelCompositionStrategy |
AUTO_LABEL_COMPOSITION_STRATEGY |
Color |
color |
Font |
font
the font to be used when rendering
|
Color |
haloColor |
Float |
haloRadius |
LabelCompositionStrategy |
labelCompositionStrategy
the strategy for building the actual label value for a given a
OsmPrimitive. |
int |
xOffset |
int |
yOffset |
COLOR, DASHES, DASHES_BACKGROUND_COLOR, DASHES_BACKGROUND_OPACITY, DASHES_OFFSET, FILL_COLOR, FILL_IMAGE, FILL_OPACITY, ICON_HEIGHT_IDX, ICON_IMAGE, ICON_IMAGE_IDX, ICON_OPACITY_IDX, ICON_WIDTH_IDX, MODIFIER, OBJECT_Z_INDEX, OFFSET, OPACITY, REAL_WIDTH, REPEAT_IMAGE, REPEAT_IMAGE_ALIGN, REPEAT_IMAGE_OFFSET, REPEAT_IMAGE_PHASE, REPEAT_IMAGE_SPACING, TEXT, TEXT_POSITION, WIDTH, Z_INDEX| Constructor and Description |
|---|
TextElement(LabelCompositionStrategy strategy,
Font font,
int xOffset,
int yOffset,
Color color,
Float haloRadius,
Color haloColor)
Creates a new text element
|
TextElement(TextElement other)
Copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected static LabelCompositionStrategy |
buildLabelCompositionStrategy(Cascade c,
boolean defaultAnnotate)
Derives a suitable label composition strategy from the style properties in
c. |
static TextElement |
create(Cascade c,
Color defaultTextColor,
boolean defaultAnnotate)
Builds a text element from style properties in
c and the
default text color defaultTextColor |
boolean |
equals(Object obj) |
String |
getString(OsmPrimitive osm)
Replies the label to be rendered for the primitive
osm. |
int |
hashCode() |
String |
toString() |
protected String |
toStringImpl() |
public static final LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY
public LabelCompositionStrategy labelCompositionStrategy
OsmPrimitive.
Check for null before accessing.public int xOffset
public int yOffset
public Float haloRadius
public TextElement(LabelCompositionStrategy strategy, Font font, int xOffset, int yOffset, Color color, Float haloRadius, Color haloColor)
strategy - the strategy indicating how the text is composed for a specific OsmPrimitive to be rendered.
If null, no label is rendered.font - the font to be used. Must not be null.xOffset - yOffset - color - the color to be used. Must not be nullhaloRadius - haloColor - public TextElement(TextElement other)
other - the other element.protected static LabelCompositionStrategy buildLabelCompositionStrategy(Cascade c, boolean defaultAnnotate)
c.c - the style propertiespublic static TextElement create(Cascade c, Color defaultTextColor, boolean defaultAnnotate) throws IllegalArgumentException
c and the
default text color defaultTextColorc - the style propertiesdefaultTextColor - the default text color. Must not be null.defaultAnnotate - true, if a text label shall be rendered by default, even if the style sheet
doesn't include respective style declarationsIllegalArgumentException - thrown if defaultTextColor is nullpublic String getString(OsmPrimitive osm)
osm.osm - the OSM objectosm is null or if no label can be
derived for osmprotected String toStringImpl()