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, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_WEIGHT, ICON_HEIGHT, ICON_IMAGE, ICON_OFFSET_X, ICON_OFFSET_Y, ICON_OPACITY, ICON_WIDTH, LINECAP, LINEJOIN, MAJOR_Z_INDEX, MITERLIMIT, MODIFIER, OBJECT_Z_INDEX, OFFSET, OPACITY, REAL_WIDTH, REPEAT_IMAGE, REPEAT_IMAGE_ALIGN, REPEAT_IMAGE_HEIGHT, REPEAT_IMAGE_OFFSET, REPEAT_IMAGE_OPACITY, REPEAT_IMAGE_PHASE, REPEAT_IMAGE_SPACING, REPEAT_IMAGE_WIDTH, TEXT, TEXT_ANCHOR_HORIZONTAL, TEXT_ANCHOR_VERTICAL, TEXT_COLOR, TEXT_HALO_COLOR, TEXT_HALO_OPACITY, TEXT_HALO_RADIUS, TEXT_OFFSET, TEXT_OFFSET_X, TEXT_OFFSET_Y, TEXT_OPACITY, 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(Environment env,
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(Environment env, Color defaultTextColor, boolean defaultAnnotate) throws IllegalArgumentException
c
and the
default text color defaultTextColor
env
- the environmentdefaultTextColor
- 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 osm
protected String toStringImpl()