Class TextElement
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement
-
- org.openstreetmap.josm.gui.mappaint.styleelement.TextElement
-
- All Implemented Interfaces:
StyleKeys
public class TextElement extends StyleElement
The text that is drawn for a way/area. It may be drawn along the outline or onto the way.- Since:
- 11722
-
-
Field Summary
Fields Modifier and Type Field Description private PositionForAreaStrategylabelPositionStrategyThe position strategy for this text label.private TextLabeltext-
Fields inherited from class org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement
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
-
Fields inherited from interface org.openstreetmap.josm.gui.mappaint.StyleKeys
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_POSITION, 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, TEXT_ROTATION, WAY_DIRECTION_ARROWS, WIDTH, Z_INDEX
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTextElement(Cascade c, TextLabel text, PositionForAreaStrategy labelPositionStrategy)Create a new way/area text element definition
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TextElementcreate(Environment env)Create a new text elementstatic TextElementcreateForContent(Environment env)JOSM traditionally adds both line and content text elements if a fill style was set.booleanequals(java.lang.Object obj)PositionForAreaStrategygetLabelPositionStrategy()Gets the strategy that defines where to place the label.inthashCode()voidpaintPrimitive(IPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean outermember, boolean member)draws a primitivejava.lang.StringtoString()-
Methods inherited from class org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement
getFont, getWidth, isProperLineStyle
-
-
-
-
Field Detail
-
labelPositionStrategy
private final PositionForAreaStrategy labelPositionStrategy
The position strategy for this text label.
-
-
Constructor Detail
-
TextElement
protected TextElement(Cascade c, TextLabel text, PositionForAreaStrategy labelPositionStrategy)
Create a new way/area text element definition- Parameters:
c- The cascadetext- The textlabelPositionStrategy- The position in the area.
-
-
Method Detail
-
getLabelPositionStrategy
public PositionForAreaStrategy getLabelPositionStrategy()
Gets the strategy that defines where to place the label.- Returns:
- The strategy. Never null.
- Since:
- 12475
-
create
public static TextElement create(Environment env)
Create a new text element- Parameters:
env- The environment to read the text data from- Returns:
- The text element or
nullif it could not be created.
-
createForContent
public static TextElement createForContent(Environment env)
JOSM traditionally adds both line and content text elements if a fill style was set. For now, we simulate this by generating a TextElement if no text-position was provided.- Parameters:
env- The environment to read the text data from- Returns:
- The text element or
nullif it could not be created.
-
paintPrimitive
public void paintPrimitive(IPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean outermember, boolean member)
Description copied from class:StyleElementdraws a primitive- Specified by:
paintPrimitivein classStyleElement- Parameters:
primitive- primitive to drawpaintSettings- 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 relation
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classStyleElement
-
hashCode
public int hashCode()
- Overrides:
hashCodein classStyleElement
-
toString
public java.lang.String toString()
- Overrides:
toStringin classStyleElement
-
-