public class BoxTextElement extends StyleElement
Modifier and Type | Class and Description |
---|---|
static interface |
BoxTextElement.BoxProvider
Something that provides us with a
BoxTextElement.BoxProviderResult |
static class |
BoxTextElement.BoxProviderResult
A box rectangle with a flag if it is temporary.
|
static class |
BoxTextElement.HorizontalTextAlignment
MapCSS text-anchor-horizontal
|
static class |
BoxTextElement.SimpleBoxProvider
A
BoxTextElement.BoxProvider that always returns the same non-temporary rectangle |
static class |
BoxTextElement.VerticalTextAlignment
MapCSS text-anchor-vertical
|
Modifier and Type | Field and Description |
---|---|
protected java.awt.Rectangle |
box |
protected BoxTextElement.BoxProvider |
boxProvider |
private static java.awt.Color |
defaultTextColorCache
Caches the default text color from the preferences.
|
BoxTextElement.HorizontalTextAlignment |
hAlign
The
BoxTextElement.HorizontalTextAlignment for this text. |
static BoxTextElement |
SIMPLE_NODE_TEXT_ELEMSTYLE
The default style a simple node should use for it's text
|
TextLabel |
text
The text this element should display.
|
BoxTextElement.VerticalTextAlignment |
vAlign
The
BoxTextElement.VerticalTextAlignment for this text. |
static java.awt.Rectangle |
ZERO_BOX
A rectangle with size 0x0
|
defaultSelectedHandling, ICON_HEIGHT_IDX, ICON_IMAGE_IDX, ICON_OFFSET_X_IDX, ICON_OFFSET_Y_IDX, ICON_OPACITY_IDX, ICON_WIDTH_IDX, isModifier, majorZIndex, objectZIndex, zIndex
COLOR, DASHES, DASHES_BACKGROUND_COLOR, DASHES_BACKGROUND_OPACITY, DASHES_OFFSET, FILL_COLOR, FILL_EXTENT, FILL_EXTENT_THRESHOLD, 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_ROTATION, 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, WAY_DIRECTION_ARROWS, WIDTH, Z_INDEX
Constructor and Description |
---|
BoxTextElement(Cascade c,
TextLabel text,
BoxTextElement.BoxProvider boxProvider,
java.awt.Rectangle box,
BoxTextElement.HorizontalTextAlignment hAlign,
BoxTextElement.VerticalTextAlignment vAlign)
Create a new
BoxTextElement |
Modifier and Type | Method and Description |
---|---|
static BoxTextElement |
create(Environment env,
BoxTextElement.BoxProvider boxProvider)
Create a new
BoxTextElement with a dynamic box |
static BoxTextElement |
create(Environment env,
BoxTextElement.BoxProvider boxProvider,
java.awt.Rectangle box)
Create a new
BoxTextElement with a boxprovider and a box. |
static BoxTextElement |
create(Environment env,
java.awt.Rectangle box)
Create a new
BoxTextElement with a fixed box |
boolean |
equals(java.lang.Object obj) |
java.awt.Rectangle |
getBox()
Get the box in which the content should be drawn.
|
int |
hashCode() |
private static void |
initDefaultParameters() |
void |
paintPrimitive(OsmPrimitive osm,
MapPaintSettings settings,
StyledMapRenderer painter,
boolean selected,
boolean outermember,
boolean member)
draws a primitive
|
java.lang.String |
toString() |
getFont, getWidth, isProperLineStyle
public static final java.awt.Rectangle ZERO_BOX
public static final BoxTextElement SIMPLE_NODE_TEXT_ELEMSTYLE
private static volatile java.awt.Color defaultTextColorCache
protected BoxTextElement.BoxProvider boxProvider
protected java.awt.Rectangle box
public BoxTextElement.HorizontalTextAlignment hAlign
BoxTextElement.HorizontalTextAlignment
for this text.public BoxTextElement.VerticalTextAlignment vAlign
BoxTextElement.VerticalTextAlignment
for this text.public BoxTextElement(Cascade c, TextLabel text, BoxTextElement.BoxProvider boxProvider, java.awt.Rectangle box, BoxTextElement.HorizontalTextAlignment hAlign, BoxTextElement.VerticalTextAlignment vAlign)
BoxTextElement
c
- The current cascadetext
- The text to displayboxProvider
- The box provider to usebox
- The initial box to use.hAlign
- The BoxTextElement.HorizontalTextAlignment
vAlign
- The BoxTextElement.VerticalTextAlignment
public static BoxTextElement create(Environment env, BoxTextElement.BoxProvider boxProvider)
BoxTextElement
with a dynamic boxenv
- The MapCSS environmentboxProvider
- The box provider that computes the box.BoxTextElement
or null
if the creation failed.public static BoxTextElement create(Environment env, java.awt.Rectangle box)
BoxTextElement
with a fixed boxenv
- The MapCSS environmentbox
- The boxBoxTextElement
or null
if the creation failed.public static BoxTextElement create(Environment env, BoxTextElement.BoxProvider boxProvider, java.awt.Rectangle box)
BoxTextElement
with a boxprovider and a box.env
- The MapCSS environmentboxProvider
- The box provider.box
- The box. Only considered if boxProvider is null.BoxTextElement
or null
if the creation failed.public java.awt.Rectangle getBox()
private static void initDefaultParameters()
public void paintPrimitive(OsmPrimitive osm, MapPaintSettings settings, StyledMapRenderer painter, boolean selected, boolean outermember, boolean member)
StyleElement
paintPrimitive
in class StyleElement
osm
- primitive to drawsettings
- paint settingspainter
- painterselected
- true, if primitive is selectedoutermember
- true, if primitive is not selected and outer member of a selected multipolygon relationmember
- true, if primitive is not selected and member of a selected relationpublic boolean equals(java.lang.Object obj)
equals
in class StyleElement
public int hashCode()
hashCode
in class StyleElement
public java.lang.String toString()
toString
in class StyleElement