Class LineElement
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement
-
- org.openstreetmap.josm.gui.mappaint.styleelement.LineElement
-
- All Implemented Interfaces:
StyleKeys
public class LineElement extends StyleElement
This is the style definition for a simple line.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLineElement.LineTypeThe type of this line
-
Field Summary
Fields Modifier and Type Field Description java.awt.ColorcolorThe color of the line.java.awt.ColordashesBackgroundThe secondary color of the line that is used for the gaps in dashed lines.private java.awt.BasicStrokedashesLineThe stroke used to paint the gaps between the dashesprivate java.awt.BasicStrokelineThe stroke used to paint the linefloatoffsetThe dash offset.floatrealWidththe real width of this line in meter.static LineElementUNTAGGED_WAYThe default style for any untagged way.booleanwayDirectionArrowsA flag indicating if the direction arrows should be painted.-
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 protectedLineElement(Cascade c, float defaultMajorZindex, java.awt.BasicStroke line, java.awt.Color color, java.awt.BasicStroke dashesLine, java.awt.Color dashesBackground, float offset, float realWidth, boolean wayDirectionArrows)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.FloatcomputeOffset(LineElement.LineType type, Cascade c, Cascade cDef, java.lang.Float width)private static floatcomputeRealWidth(Environment env, LineElement.LineType type, Cascade c)private static java.lang.FloatcomputeWidth(LineElement.LineType type, Cascade c, Cascade cDef)static LineElementcreateCasing(Environment env)Create a line element for the casing from the given MapCSS environmentprivate static LineElementcreateImpl(Environment env, LineElement.LineType type)static LineElementcreateLeftCasing(Environment env)Create a line element for the left casing from the given MapCSS environmentstatic LineElementcreateLine(Environment env)Create a line element from the given MapCSS environmentstatic LineElementcreateRightCasing(Environment env)Create a line element for the right casing from the given MapCSS environmentstatic LineElementcreateSimpleLineStyle(java.awt.Color color, boolean isAreaEdge)Creates a simple line with default width.booleanequals(java.lang.Object obj)inthashCode()booleanisProperLineStyle()Check if this is a style that makes the line visible to the userjava.lang.StringlinecapToString(int linecap)Converts a linecap of aBasicStroketo a MapCSS stringjava.lang.StringlinejoinToString(int linejoin)Converts a linejoin of aBasicStroketo a MapCSS stringvoidpaintPrimitive(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
-
-
-
-
Field Detail
-
UNTAGGED_WAY
public static final LineElement UNTAGGED_WAY
The default style for any untagged way.
-
line
private final java.awt.BasicStroke line
The stroke used to paint the line
-
color
public java.awt.Color color
The color of the line. Should not be accessed directly
-
dashesLine
private final java.awt.BasicStroke dashesLine
The stroke used to paint the gaps between the dashes
-
dashesBackground
public java.awt.Color dashesBackground
The secondary color of the line that is used for the gaps in dashed lines. Should not be accessed directly
-
offset
public float offset
The dash offset. Should not be accessed directly
-
realWidth
public float realWidth
the real width of this line in meter. Should not be accessed directly
-
wayDirectionArrows
public boolean wayDirectionArrows
A flag indicating if the direction arrows should be painted. Should not be accessed directly
-
-
Constructor Detail
-
LineElement
protected LineElement(Cascade c, float defaultMajorZindex, java.awt.BasicStroke line, java.awt.Color color, java.awt.BasicStroke dashesLine, java.awt.Color dashesBackground, float offset, float realWidth, boolean wayDirectionArrows)
-
-
Method Detail
-
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
-
isProperLineStyle
public boolean isProperLineStyle()
Description copied from class:StyleElementCheck if this is a style that makes the line visible to the user- Overrides:
isProperLineStylein classStyleElement- Returns:
truefor line styles
-
linejoinToString
public java.lang.String linejoinToString(int linejoin)
Converts a linejoin of aBasicStroketo a MapCSS string- Parameters:
linejoin- The linejoin- Returns:
- The MapCSS string or
nullon error. - See Also:
BasicStroke.getLineJoin()
-
linecapToString
public java.lang.String linecapToString(int linecap)
Converts a linecap of aBasicStroketo a MapCSS string- Parameters:
linecap- The linecap- Returns:
- The MapCSS string or
nullon error. - See Also:
BasicStroke.getEndCap()
-
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
-
createSimpleLineStyle
public static LineElement createSimpleLineStyle(java.awt.Color color, boolean isAreaEdge)
Creates a simple line with default width.- Parameters:
color- The color to useisAreaEdge- If this is an edge for an area. Edges are drawn at lower Z-Index.- Returns:
- The line style.
-
createLine
public static LineElement createLine(Environment env)
Create a line element from the given MapCSS environment- Parameters:
env- The environment- Returns:
- The line element describing the line that should be painted, or
nullif none should be painted.
-
createLeftCasing
public static LineElement createLeftCasing(Environment env)
Create a line element for the left casing from the given MapCSS environment- Parameters:
env- The environment- Returns:
- The line element describing the line that should be painted, or
nullif none should be painted.
-
createRightCasing
public static LineElement createRightCasing(Environment env)
Create a line element for the right casing from the given MapCSS environment- Parameters:
env- The environment- Returns:
- The line element describing the line that should be painted, or
nullif none should be painted.
-
createCasing
public static LineElement createCasing(Environment env)
Create a line element for the casing from the given MapCSS environment- Parameters:
env- The environment- Returns:
- The line element describing the line that should be painted, or
nullif none should be painted.
-
createImpl
private static LineElement createImpl(Environment env, LineElement.LineType type)
-
computeWidth
private static java.lang.Float computeWidth(LineElement.LineType type, Cascade c, Cascade cDef)
-
computeRealWidth
private static float computeRealWidth(Environment env, LineElement.LineType type, Cascade c)
-
computeOffset
private static java.lang.Float computeOffset(LineElement.LineType type, Cascade c, Cascade cDef, java.lang.Float width)
-
-