public class WireframeMapRenderer extends AbstractMapRenderer implements OsmPrimitiveVisitor
Modifier and Type | Field and Description |
---|---|
private static ArrowPaintHelper |
ARROW_PAINT_HELPER
|
protected java.awt.Color |
connectionColor
Color Preference for multiply connected nodes
|
protected int |
connectionNodeSize
Preference: size of multiply connected nodes
|
protected java.awt.Color |
currentColor
Color cache to draw subsequent segments of same color as one
Path . |
protected MapPath2D |
currentPath
Path store to draw subsequent segments of same color as one
Path . |
protected java.awt.Color |
dfltWayColor
Color Preference for ways not matching any other group
|
private DataSet |
ds
DataSet passed to the @{link render} function to overcome the argument
limitations of @{link Visitor} interface. |
protected boolean |
fillConnectionNode
Preference: should multiply connected nodes be filled
|
protected boolean |
fillSelectedNode
Preference: should selected nodes be filled
|
protected boolean |
fillTaggedNode
Preference: should tagged nodes be filled
|
protected boolean |
fillUnselectedNode
Preference: should unselected nodes be filled
|
private java.awt.Stroke |
relatedWayStroke
Helper variable for
visit(Relation) |
protected java.awt.Color |
relationColor
Color Preference for relations
|
protected int |
selectedNodeSize
Preference: size of selected nodes
|
protected boolean |
showDirectionArrow
Preference: should directional arrows be displayed
|
protected boolean |
showHeadArrowOnly
Preference: should only the last arrow of a way be displayed
|
protected boolean |
showOnewayArrow
Preference: should arrows for oneways be displayed
|
protected boolean |
showOrderNumber
Preference: should the segment numbers of ways be displayed
|
protected boolean |
showOrderNumberOnSelectedWay
Preference: should the segment numbers of the selected be displayed
|
protected java.awt.Color |
taggedColor
Color Preference for tagged nodes
|
protected java.awt.Color |
taggedConnectionColor
Color Preference for tagged and multiply connected nodes
|
protected int |
taggedNodeSize
Preference: size of tagged nodes
|
protected int |
unselectedNodeSize
Preference: size of unselected nodes
|
protected java.awt.Color |
untaggedWayColor
Color Preference for untagged ways
|
private MapViewState.MapViewRectangle |
viewClip |
backgroundColor, g, highlightColor, inactiveColor, isInactiveMode, mapState, nc, nodeColor, relationSelectedColor, segmentNumberSpace, selectedColor, virtualNodeSize, virtualNodeSpace
Constructor and Description |
---|
WireframeMapRenderer(java.awt.Graphics2D g,
NavigatableComponent nc,
boolean isInactiveMode)
Creates an wireframe render
|
Modifier and Type | Method and Description |
---|---|
protected void |
displaySegments()
Finally display all segments in currect path.
|
protected void |
displaySegments(java.awt.Color newColor)
Finally display all segments in currect path.
|
void |
drawNode(Node n,
java.awt.Color color,
int size,
boolean fill)
Draw the node as small square with the given color.
|
protected void |
drawSegment(MapPath2D path,
MapViewState.MapViewPoint mv1,
MapViewState.MapViewPoint mv2,
boolean showDirection)
Draw a line with the given color.
|
protected void |
drawSegment(MapViewState.MapViewPoint p1,
MapViewState.MapViewPoint p2,
java.awt.Color col,
boolean showDirection)
Draw a line with the given color.
|
void |
getColors()
Reads the color definitions from preferences.
|
protected void |
getSettings(boolean virtual)
Reads all the settings from preferences.
|
private static boolean |
isNodeTagged(Node n) |
private static int |
max(int a,
int b,
int c,
int d)
Helper function to calculate maximum of 4 values.
|
void |
render(DataSet data,
boolean virtual,
Bounds bounds)
Renders the OSM data in
data |
void |
visit(Node n)
Draw a small rectangle.
|
void |
visit(Relation r)
Draw objects used in relations.
|
void |
visit(Way w)
Draw a line for all way segments.
|
drawOrderNumber, drawVirtualNodes, isLargeSegment, isSegmentVisible, visitVirtual
protected java.awt.Color dfltWayColor
protected java.awt.Color relationColor
protected java.awt.Color untaggedWayColor
protected java.awt.Color taggedColor
protected java.awt.Color connectionColor
protected java.awt.Color taggedConnectionColor
protected boolean showDirectionArrow
protected boolean showOnewayArrow
protected boolean showHeadArrowOnly
protected boolean showOrderNumber
protected boolean showOrderNumberOnSelectedWay
protected boolean fillSelectedNode
protected boolean fillUnselectedNode
protected boolean fillTaggedNode
protected boolean fillConnectionNode
protected int selectedNodeSize
protected int unselectedNodeSize
protected int connectionNodeSize
protected int taggedNodeSize
protected java.awt.Color currentColor
Path
.protected MapPath2D currentPath
Path
.private DataSet ds
DataSet
passed to the @{link render} function to overcome the argument
limitations of @{link Visitor} interface. Only valid until end of rendering call.private static final ArrowPaintHelper ARROW_PAINT_HELPER
private final java.awt.Stroke relatedWayStroke
visit(Relation)
private MapViewState.MapViewRectangle viewClip
public WireframeMapRenderer(java.awt.Graphics2D g, NavigatableComponent nc, boolean isInactiveMode)
g
- the graphics context. Must not be null.nc
- the map viewport. Must not be null.isInactiveMode
- if true, the paint visitor shall render OSM objects such that they
look inactive. Example: rendering of data in an inactive layer using light gray as color only.java.lang.IllegalArgumentException
- if g
is nulljava.lang.IllegalArgumentException
- if nc
is nullpublic void getColors()
AbstractMapRenderer
public
, so that
color names in preferences can be displayed even without calling the wireframe display before.getColors
in class AbstractMapRenderer
protected void getSettings(boolean virtual)
AbstractMapRenderer
getSettings
in class AbstractMapRenderer
virtual
- true
if virtual nodes are usedpublic void render(DataSet data, boolean virtual, Bounds bounds)
Rendering
Renders the OSM data in data
private static int max(int a, int b, int c, int d)
a
- First valueb
- Second valuec
- Third valued
- Fourth valuea
, b
, c
, d
public void visit(Node n)
visit
in interface OsmPrimitiveVisitor
n
- The node to draw.private static boolean isNodeTagged(Node n)
public void visit(Way w)
visit
in interface OsmPrimitiveVisitor
w
- The way to draw.public void visit(Relation r)
visit
in interface OsmPrimitiveVisitor
r
- The relation to draw.public void drawNode(Node n, java.awt.Color color, int size, boolean fill)
AbstractMapRenderer
drawNode
in class AbstractMapRenderer
n
- The node to draw.color
- The color of the node.size
- size in pixelsfill
- determines if the square mmust be filledprotected void drawSegment(MapPath2D path, MapViewState.MapViewPoint mv1, MapViewState.MapViewPoint mv2, boolean showDirection)
path
- The path to append this segment.mv1
- First point of the way segment.mv2
- Second point of the way segment.showDirection
- true
if segment direction should be indicatedprotected void drawSegment(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, java.awt.Color col, boolean showDirection)
p1
- First point of the way segment.p2
- Second point of the way segment.col
- The color to use for drawing line.showDirection
- true
if segment direction should be indicated.protected void displaySegments()
protected void displaySegments(java.awt.Color newColor)
newColor
- This color is set after the path is drawn.