org.openstreetmap.josm.data.osm.visitor.paint
Class WireframeMapRenderer

java.lang.Object
  extended by org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
      extended by org.openstreetmap.josm.data.osm.visitor.paint.WireframeMapRenderer
All Implemented Interfaces:
Rendering, Visitor

public class WireframeMapRenderer
extends AbstractMapRenderer
implements Visitor

A map renderer that paints a simple scheme of every primitive it visits to a previous set graphic environment.


Field Summary
protected  java.awt.Color connectionColor
          Color Preference for multiply connected nodes
protected  int connectionNodeSize
          Preference: size of multiply connected nodes
private static double cosPHI
          Helper variable for #drawSgement
protected  java.awt.Color currentColor
          Color cache to draw subsequent segments of same color as one Path.
protected  java.awt.geom.GeneralPath 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 static double PHI
          Helper variable for #drawSgement
private  java.awt.Stroke relatedWayStroke
          Helper variable for {@link #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 segement numbers of ways be displayed
private static double sinPHI
          Helper variable for #drawSgement
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
 
Fields inherited from class org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
backgroundColor, g, highlightColor, inactiveColor, isInactiveMode, nc, nodeColor, segmentNumberSpace, selectedColor, virtualNodeSize, virtualNodeSpace
 
Constructor Summary
WireframeMapRenderer(java.awt.Graphics2D g, NavigatableComponent nc, boolean isInactiveMode)
          Creates an wireframe render
 
Method Summary
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 rectangle with the given color.
protected  void drawSegment(java.awt.geom.GeneralPath path, java.awt.Point p1, java.awt.Point p2, boolean showDirection)
          Draw a line with the given color.
protected  void drawSegment(java.awt.Point p1, java.awt.Point 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.
protected  boolean isPolygonVisible(java.awt.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.
 
Methods inherited from class org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
drawOrderNumber, drawVirtualNodes, isLargeSegment, isSegmentVisible, visitVirtual
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dfltWayColor

protected java.awt.Color dfltWayColor
Color Preference for ways not matching any other group


relationColor

protected java.awt.Color relationColor
Color Preference for relations


untaggedWayColor

protected java.awt.Color untaggedWayColor
Color Preference for untagged ways


taggedColor

protected java.awt.Color taggedColor
Color Preference for tagged nodes


connectionColor

protected java.awt.Color connectionColor
Color Preference for multiply connected nodes


taggedConnectionColor

protected java.awt.Color taggedConnectionColor
Color Preference for tagged and multiply connected nodes


showDirectionArrow

protected boolean showDirectionArrow
Preference: should directional arrows be displayed


showOnewayArrow

protected boolean showOnewayArrow
Preference: should arrows for oneways be displayed


showHeadArrowOnly

protected boolean showHeadArrowOnly
Preference: should only the last arrow of a way be displayed


showOrderNumber

protected boolean showOrderNumber
Preference: should the segement numbers of ways be displayed


fillSelectedNode

protected boolean fillSelectedNode
Preference: should selected nodes be filled


fillUnselectedNode

protected boolean fillUnselectedNode
Preference: should unselected nodes be filled


fillTaggedNode

protected boolean fillTaggedNode
Preference: should tagged nodes be filled


fillConnectionNode

protected boolean fillConnectionNode
Preference: should multiply connected nodes be filled


selectedNodeSize

protected int selectedNodeSize
Preference: size of selected nodes


unselectedNodeSize

protected int unselectedNodeSize
Preference: size of unselected nodes


connectionNodeSize

protected int connectionNodeSize
Preference: size of multiply connected nodes


taggedNodeSize

protected int taggedNodeSize
Preference: size of tagged nodes


currentColor

protected java.awt.Color currentColor
Color cache to draw subsequent segments of same color as one Path.


currentPath

protected java.awt.geom.GeneralPath currentPath
Path store to draw subsequent segments of same color as one Path.


ds

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.


PHI

private static final double PHI
Helper variable for #drawSgement


cosPHI

private static final double cosPHI
Helper variable for #drawSgement


sinPHI

private static final double sinPHI
Helper variable for #drawSgement


relatedWayStroke

private java.awt.Stroke relatedWayStroke
Helper variable for {@link #visit(Relation)

Constructor Detail

WireframeMapRenderer

public WireframeMapRenderer(java.awt.Graphics2D g,
                            NavigatableComponent nc,
                            boolean isInactiveMode)
Creates an wireframe render

Parameters:
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.
Throws:
java.lang.IllegalArgumentException - thrown if g is null
java.lang.IllegalArgumentException - thrown if nc is null
Method Detail

getColors

public void getColors()
Description copied from class: AbstractMapRenderer
Reads the color definitions from preferences. This function is public, so that color names in preferences can be displayed even without calling the wireframe display before.

Overrides:
getColors in class AbstractMapRenderer

getSettings

protected void getSettings(boolean virtual)
Description copied from class: AbstractMapRenderer
Reads all the settings from preferences. Calls the @{link #getColors} function.

Overrides:
getSettings in class AbstractMapRenderer
Parameters:
virtual - true if virtual nodes are used

render

public void render(DataSet data,
                   boolean virtual,
                   Bounds bounds)
Renders the dataset for display.

Specified by:
render in interface Rendering
Parameters:
data - DataSet to display
virtual - true if virtual nodes are used
bounds - display boundaries

max

private static final int max(int a,
                             int b,
                             int c,
                             int d)
Helper function to calculate maximum of 4 values.

Parameters:
a - First value
b - Second value
c - Third value
d - Fourth value

visit

public void visit(Node n)
Draw a small rectangle. White if selected (as always) or red otherwise.

Specified by:
visit in interface Visitor
Parameters:
n - The node to draw.

visit

public void visit(Way w)
Draw a line for all way segments.

Specified by:
visit in interface Visitor
Parameters:
w - The way to draw.

visit

public void visit(Relation r)
Draw objects used in relations.

Specified by:
visit in interface Visitor
Parameters:
r - The relation to draw.

visit

public void visit(Changeset cs)
Visitor for changesets not used in this class

Specified by:
visit in interface Visitor
Parameters:
cs - The changeset for inspection.

drawNode

public void drawNode(Node n,
                     java.awt.Color color,
                     int size,
                     boolean fill)
Description copied from class: AbstractMapRenderer
Draw the node as small rectangle with the given color.

Specified by:
drawNode in class AbstractMapRenderer
Parameters:
n - The node to draw.
color - The color of the node.

drawSegment

protected void drawSegment(java.awt.geom.GeneralPath path,
                           java.awt.Point p1,
                           java.awt.Point p2,
                           boolean showDirection)
Draw a line with the given color.

Parameters:
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 indicated

drawSegment

protected void drawSegment(java.awt.Point p1,
                           java.awt.Point p2,
                           java.awt.Color col,
                           boolean showDirection)
Draw a line with the given color.

Parameters:
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.

isPolygonVisible

protected boolean isPolygonVisible(java.awt.Polygon polygon)
Checks if a polygon is visible in display.

Parameters:
polygon - The polygon to check.
Returns:
true if polygon is visible.

displaySegments

protected void displaySegments()
Finally display all segments in currect path.


displaySegments

protected void displaySegments(java.awt.Color newColor)
Finally display all segments in currect path.

Parameters:
newColor - This color is set after the path is drawn.


JOSM