Class WireframeMapRenderer
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
-
- org.openstreetmap.josm.data.osm.visitor.paint.WireframeMapRenderer
-
- All Implemented Interfaces:
Rendering
,PrimitiveVisitor
public class WireframeMapRenderer extends AbstractMapRenderer implements PrimitiveVisitor
A map renderer that paints a simple scheme of every primitive it visits to a previous set graphic environment.- Since:
- 23
-
-
Field Summary
Fields Modifier and Type Field Description private static ArrowPaintHelper
ARROW_PAINT_HELPER
protected java.awt.Color
connectionColor
Color Preference for multiply connected nodesprotected int
connectionNodeSize
Preference: size of multiply connected nodesprotected java.awt.Color
currentColor
Color cache to draw subsequent segments of same color as onePath
.protected MapPath2D
currentPath
Path store to draw subsequent segments of same color as onePath
.protected java.awt.Color
dfltWayColor
Color Preference for ways not matching any other groupprotected boolean
fillConnectionNode
Preference: should multiply connected nodes be filledprotected boolean
fillSelectedNode
Preference: should selected nodes be filledprotected boolean
fillTaggedNode
Preference: should tagged nodes be filledprotected boolean
fillUnselectedNode
Preference: should unselected nodes be filledprivate java.awt.Stroke
relatedWayStroke
Helper variable forvisit(IRelation)
protected java.awt.Color
relationColor
Color Preference for relationsprotected int
selectedNodeSize
Preference: size of selected nodesprotected boolean
showDirectionArrow
Preference: should directional arrows be displayedprotected boolean
showHeadArrowOnly
Preference: should only the last arrow of a way be displayedprotected boolean
showOnewayArrow
Preference: should arrows for oneways be displayedprotected boolean
showOrderNumber
Preference: should the segment numbers of ways be displayedprotected boolean
showOrderNumberOnSelectedWay
Preference: should the segment numbers of the selected be displayedprotected java.awt.Color
taggedColor
Color Preference for tagged nodesprotected java.awt.Color
taggedConnectionColor
Color Preference for tagged and multiply connected nodesprotected int
taggedNodeSize
Preference: size of tagged nodesprotected int
unselectedNodeSize
Preference: size of unselected nodesprotected java.awt.Color
untaggedWayColor
Color Preference for untagged waysprotected boolean
useRelatedWayStroke
Preference: should relation ways be shown with outlinesprivate MapViewState.MapViewRectangle
viewClip
-
Fields inherited from class org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
backgroundColor, doSlowOperations, g, highlightColor, inactiveColor, isInactiveMode, mapState, nc, nodeColor, relationSelectedColor, segmentNumberSpace, selectedColor, virtualNodeSize, virtualNodeSpace
-
-
Constructor Summary
Constructors Constructor Description WireframeMapRenderer(java.awt.Graphics2D g, NavigatableComponent nc, boolean isInactiveMode)
Creates an wireframe render
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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(INode 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(INode n)
private static int
max(int a, int b, int c, int d)
Helper function to calculate maximum of 4 values.void
render(OsmData<?,?,?,?> data, boolean virtual, Bounds bounds)
Renders the OSM data indata
void
visit(INode n)
Draw a small rectangle.void
visit(IRelation<?> r)
Draw objects used in relations.void
visit(IWay<?> w)
Draw a line for all way segments.-
Methods inherited from class org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
drawOrderNumber, drawVirtualNodes, enableSlowOperations, isLargeSegment, isSegmentVisible, isSegmentVisible, visitVirtual
-
-
-
-
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 segment numbers of ways be displayed
-
showOrderNumberOnSelectedWay
protected boolean showOrderNumberOnSelectedWay
Preference: should the segment numbers of the selected 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
-
useRelatedWayStroke
protected boolean useRelatedWayStroke
Preference: should relation ways be shown with outlines
-
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 onePath
.
-
currentPath
protected MapPath2D currentPath
Path store to draw subsequent segments of same color as onePath
.
-
ARROW_PAINT_HELPER
private static final ArrowPaintHelper ARROW_PAINT_HELPER
-
relatedWayStroke
private final java.awt.Stroke relatedWayStroke
Helper variable forvisit(IRelation)
-
viewClip
private MapViewState.MapViewRectangle viewClip
-
-
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
- ifg
is nulljava.lang.IllegalArgumentException
- ifnc
is null
-
-
Method Detail
-
getColors
public void getColors()
Description copied from class:AbstractMapRenderer
Reads the color definitions from preferences. This function ispublic
, so that color names in preferences can be displayed even without calling the wireframe display before.- Overrides:
getColors
in classAbstractMapRenderer
-
getSettings
protected void getSettings(boolean virtual)
Description copied from class:AbstractMapRenderer
Reads all the settings from preferences. Calls theAbstractMapRenderer.getColors()
function.- Overrides:
getSettings
in classAbstractMapRenderer
- Parameters:
virtual
-true
if virtual nodes are used
-
render
public void render(OsmData<?,?,?,?> data, boolean virtual, Bounds bounds)
Description copied from interface:Rendering
Renders the OSM data in
data
-
max
private static int max(int a, int b, int c, int d)
Helper function to calculate maximum of 4 values.- Parameters:
a
- First valueb
- Second valuec
- Third valued
- Fourth value- Returns:
- maximumof
a
,b
,c
,d
-
visit
public void visit(INode n)
Draw a small rectangle. White if selected (as always) or red otherwise.- Specified by:
visit
in interfacePrimitiveVisitor
- Parameters:
n
- The node to draw.
-
isNodeTagged
private static boolean isNodeTagged(INode n)
-
visit
public void visit(IWay<?> w)
Draw a line for all way segments.- Specified by:
visit
in interfacePrimitiveVisitor
- Parameters:
w
- The way to draw.
-
visit
public void visit(IRelation<?> r)
Draw objects used in relations.- Specified by:
visit
in interfacePrimitiveVisitor
- Parameters:
r
- The relation to draw.
-
drawNode
public void drawNode(INode n, java.awt.Color color, int size, boolean fill)
Description copied from class:AbstractMapRenderer
Draw the node as small square with the given color.- Specified by:
drawNode
in classAbstractMapRenderer
- Parameters:
n
- The node to draw.color
- The color of the node.size
- size in pixelsfill
- determines if the square must be filled
-
drawSegment
protected void drawSegment(MapPath2D path, MapViewState.MapViewPoint mv1, MapViewState.MapViewPoint mv2, boolean showDirection)
Draw a line with the given color.- Parameters:
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 indicated- Since:
- 10827
-
drawSegment
protected void drawSegment(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint 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.- Since:
- 10827
-
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.
-
-