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 class
LineElement.LineType
The type of this line
-
Field Summary
Fields Modifier and Type Field Description java.awt.Color
color
The color of the line.java.awt.Color
dashesBackground
The secondary color of the line that is used for the gaps in dashed lines.private java.awt.BasicStroke
dashesLine
The stroke used to paint the gaps between the dashesprivate java.awt.BasicStroke
line
The stroke used to paint the linefloat
offset
The dash offset.float
realWidth
the real width of this line in meter.static LineElement
UNTAGGED_WAY
The default style for any untagged way.boolean
wayDirectionArrows
A 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 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.Float
computeOffset(LineElement.LineType type, Cascade c, Cascade cDef, java.lang.Float width)
private static float
computeRealWidth(Environment env, LineElement.LineType type, Cascade c)
private static java.lang.Float
computeWidth(LineElement.LineType type, Cascade c, Cascade cDef)
static LineElement
createCasing(Environment env)
Create a line element for the casing from the given MapCSS environmentprivate static LineElement
createImpl(Environment env, LineElement.LineType type)
static LineElement
createLeftCasing(Environment env)
Create a line element for the left casing from the given MapCSS environmentstatic LineElement
createLine(Environment env)
Create a line element from the given MapCSS environmentstatic LineElement
createRightCasing(Environment env)
Create a line element for the right casing from the given MapCSS environmentstatic LineElement
createSimpleLineStyle(java.awt.Color color, boolean isAreaEdge)
Creates a simple line with default width.boolean
equals(java.lang.Object obj)
int
hashCode()
boolean
isProperLineStyle()
Check if this is a style that makes the line visible to the userjava.lang.String
linecapToString(int linecap)
Converts a linecap of aBasicStroke
to a MapCSS stringjava.lang.String
linejoinToString(int linejoin)
Converts a linejoin of aBasicStroke
to a MapCSS stringvoid
paintPrimitive(IPrimitive primitive, MapPaintSettings paintSettings, StyledMapRenderer painter, boolean selected, boolean outermember, boolean member)
draws a primitivejava.lang.String
toString()
-
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:StyleElement
draws a primitive- Specified by:
paintPrimitive
in 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:StyleElement
Check if this is a style that makes the line visible to the user- Overrides:
isProperLineStyle
in classStyleElement
- Returns:
true
for line styles
-
linejoinToString
public java.lang.String linejoinToString(int linejoin)
Converts a linejoin of aBasicStroke
to a MapCSS string- Parameters:
linejoin
- The linejoin- Returns:
- The MapCSS string or
null
on error. - See Also:
BasicStroke.getLineJoin()
-
linecapToString
public java.lang.String linecapToString(int linecap)
Converts a linecap of aBasicStroke
to a MapCSS string- Parameters:
linecap
- The linecap- Returns:
- The MapCSS string or
null
on error. - See Also:
BasicStroke.getEndCap()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classStyleElement
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classStyleElement
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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
null
if 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
null
if 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
null
if 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
null
if 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)
-
-