public class WireframeMapRenderer extends AbstractMapRenderer implements Visitor
Modifier and Type | Field and Description |
---|---|
protected Color |
connectionColor
Color Preference for multiply connected nodes
|
protected int |
connectionNodeSize
Preference: size of multiply connected nodes
|
private static double |
cosPHI
Helper variable for
drawSegment(java.awt.geom.GeneralPath, java.awt.Point, java.awt.Point, boolean) |
protected Color |
currentColor
Color cache to draw subsequent segments of same color as one
Path . |
protected GeneralPath |
currentPath
Path store to draw subsequent segments of same color as one
Path . |
protected 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 static double |
PHI
Helper variable for
drawSegment(java.awt.geom.GeneralPath, java.awt.Point, java.awt.Point, boolean) |
private Stroke |
relatedWayStroke
Helper variable for
visit(Relation) |
protected 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 segement numbers of ways be displayed
|
private static double |
sinPHI
Helper variable for
drawSegment(java.awt.geom.GeneralPath, java.awt.Point, java.awt.Point, boolean) |
protected Color |
taggedColor
Color Preference for tagged nodes
|
protected 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 Color |
untaggedWayColor
Color Preference for untagged ways
|
backgroundColor, g, highlightColor, inactiveColor, isInactiveMode, nc, nodeColor, relationSelectedColor, segmentNumberSpace, selectedColor, virtualNodeSize, virtualNodeSpace
Constructor and Description |
---|
WireframeMapRenderer(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(Color newColor)
Finally display all segments in currect path.
|
void |
drawNode(Node n,
Color color,
int size,
boolean fill)
Draw the node as small square with the given color.
|
protected void |
drawSegment(GeneralPath path,
Point p1,
Point p2,
boolean showDirection)
Draw a line with the given color.
|
protected void |
drawSegment(Point p1,
Point p2,
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 boolean |
isNodeTagged(Node n) |
protected boolean |
isPolygonVisible(Polygon polygon)
Checks if a polygon is visible in display.
|
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 dataset for display.
|
void |
visit(Changeset cs)
Visitor for changesets not used in this class
|
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 Color dfltWayColor
protected Color relationColor
protected Color untaggedWayColor
protected Color taggedColor
protected Color connectionColor
protected Color taggedConnectionColor
protected boolean showDirectionArrow
protected boolean showOnewayArrow
protected boolean showHeadArrowOnly
protected boolean showOrderNumber
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 Color currentColor
Path
.protected GeneralPath 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 double PHI
drawSegment(java.awt.geom.GeneralPath, java.awt.Point, java.awt.Point, boolean)
private static final double cosPHI
drawSegment(java.awt.geom.GeneralPath, java.awt.Point, java.awt.Point, boolean)
private static final double sinPHI
drawSegment(java.awt.geom.GeneralPath, java.awt.Point, java.awt.Point, boolean)
private Stroke relatedWayStroke
visit(Relation)
public WireframeMapRenderer(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.IllegalArgumentException
- thrown if g
is nullIllegalArgumentException
- thrown 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)
private static final int max(int a, int b, int c, int d)
a
- First valueb
- Second valuec
- Third valued
- Fourth valuepublic void visit(Node n)
private boolean isNodeTagged(Node n)
public void drawNode(Node n, 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(GeneralPath path, Point p1, Point p2, boolean showDirection)
path
- The path to append this segment.p1
- First point of the way segment.p2
- Second point of the way segment.showDirection
- true
if segment direction should be indicatedprotected void drawSegment(Point p1, Point p2, 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 boolean isPolygonVisible(Polygon polygon)
polygon
- The polygon to check.true
if polygon is visible.protected void displaySegments()
protected void displaySegments(Color newColor)
newColor
- This color is set after the path is drawn.