Class StyleElement
java.lang.Object
org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement
- All Implemented Interfaces:
StyleKeys
- Direct Known Subclasses:
AreaElement,AreaIconElement,BoxTextElement,LineElement,NodeElement,RepeatImageElement,TextElement
Class that defines how objects (
OsmPrimitive) should be drawn on the map.
Several subclasses of this abstract class implement different drawing features,
like icons for a node or area fill. This class and all its subclasses are immutable
and tend to get shared when multiple objects have the same style (in order to
save memory, see StyleCache.intern()).-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Stringprivate static FloatbooleanA flag indicating that the selection color handling should be done automaticallyprivate static final Map<StyleElement.FontDescriptor,Font> protected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intbooleanfalse, if style can serve as main style for the primitive; true, if it is a highlight or modifierprivate static final ObjectfloatThe major z index of this style elementfloatThe object z indexfloatThe z index as set by the userFields 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
ConstructorsModifierConstructorDescriptionprotectedStyleElement(float majorZIndex, float zIndex, float objectZIndex, boolean isModifier, boolean defaultSelectedHandling) Construct a new StyleElementprotectedStyleElement(Cascade c, float defaultMajorZindex) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate static FontgetCachedFont(String name, int style, int size) private static Stringprivate static Floatprotected static Fontprotected static FloatGet a property value of type WidthinthashCode()booleanCheck if this is a style that makes the line visible to the userabstract voidpaintPrimitive(IPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean outermember, boolean member) draws a primitivetoString()
-
Field Details
-
ICON_IMAGE_IDX
- See Also:
-
ICON_WIDTH_IDX
- See Also:
-
ICON_HEIGHT_IDX
- See Also:
-
ICON_OPACITY_IDX
- See Also:
-
ICON_OFFSET_X_IDX
- See Also:
-
ICON_OFFSET_Y_IDX
- See Also:
-
majorZIndex
The major z index of this style element -
zIndex
The z index as set by the user -
objectZIndex
The object z index -
isModifier
false, if style can serve as main style for the primitive; true, if it is a highlight or modifier -
defaultSelectedHandling
A flag indicating that the selection color handling should be done automatically -
defaultFontName
-
defaultFontSize
-
lock
-
FONT_MAP
-
-
Constructor Details
-
StyleElement
protected StyleElement(float majorZIndex, float zIndex, float objectZIndex, boolean isModifier, boolean defaultSelectedHandling) Construct a new StyleElement- Parameters:
majorZIndex- like z-index, but higher priorityzIndex- order the objects are drawnobjectZIndex- like z-index, but lower priorityisModifier- if false, a default line or node symbol is generateddefaultSelectedHandling- true if default behavior for selected objects is enabled, false if a style for selected state is given explicitly
-
StyleElement
-
-
Method Details
-
paintPrimitive
public abstract void paintPrimitive(IPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean outermember, boolean member) draws a primitive- 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- Since:
- 13662 (signature)
-
isProperLineStyle
Check if this is a style that makes the line visible to the user- Returns:
truefor line styles
-
getWidth
Get a property value of type Width- Parameters:
c- the cascadekey- property key for the width valuerelativeTo- reference width. Only needed, when relative width syntax is used, e.g. "+4".- Returns:
- width
-
getDefaultFontSize
-
getDefaultFontName
-
getCachedFont
-
getFont
-
equals
-
hashCode
-
toString
-