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 ArrowPaintHelperARROW_PAINT_HELPERprotected java.awt.ColorconnectionColorColor Preference for multiply connected nodesprotected intconnectionNodeSizePreference: size of multiply connected nodesprotected java.awt.ColorcurrentColorColor cache to draw subsequent segments of same color as onePath.protected MapPath2DcurrentPathPath store to draw subsequent segments of same color as onePath.protected java.awt.ColordfltWayColorColor Preference for ways not matching any other groupprotected booleanfillConnectionNodePreference: should multiply connected nodes be filledprotected booleanfillSelectedNodePreference: should selected nodes be filledprotected booleanfillTaggedNodePreference: should tagged nodes be filledprotected booleanfillUnselectedNodePreference: should unselected nodes be filledprivate java.awt.StrokerelatedWayStrokeHelper variable forvisit(IRelation)protected java.awt.ColorrelationColorColor Preference for relationsprotected intselectedNodeSizePreference: size of selected nodesprotected booleanshowDirectionArrowPreference: should directional arrows be displayedprotected booleanshowHeadArrowOnlyPreference: should only the last arrow of a way be displayedprotected booleanshowOnewayArrowPreference: should arrows for oneways be displayedprotected booleanshowOrderNumberPreference: should the segment numbers of ways be displayedprotected booleanshowOrderNumberOnSelectedWayPreference: should the segment numbers of the selected be displayedprotected java.awt.ColortaggedColorColor Preference for tagged nodesprotected java.awt.ColortaggedConnectionColorColor Preference for tagged and multiply connected nodesprotected inttaggedNodeSizePreference: size of tagged nodesprotected intunselectedNodeSizePreference: size of unselected nodesprotected java.awt.ColoruntaggedWayColorColor Preference for untagged waysprotected booleanuseRelatedWayStrokePreference: should relation ways be shown with outlinesprivate MapViewState.MapViewRectangleviewClip-
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 voiddisplaySegments()Finally display all segments in currect path.protected voiddisplaySegments(java.awt.Color newColor)Finally display all segments in currect path.voiddrawNode(INode n, java.awt.Color color, int size, boolean fill)Draw the node as small square with the given color.protected voiddrawSegment(MapPath2D path, MapViewState.MapViewPoint mv1, MapViewState.MapViewPoint mv2, boolean showDirection)Draw a line with the given color.protected voiddrawSegment(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, java.awt.Color col, boolean showDirection)Draw a line with the given color.voidgetColors()Reads the color definitions from preferences.protected voidgetSettings(boolean virtual)Reads all the settings from preferences.private static booleanisNodeTagged(INode n)private static intmax(int a, int b, int c, int d)Helper function to calculate maximum of 4 values.voidrender(OsmData<?,?,?,?> data, boolean virtual, Bounds bounds)Renders the OSM data indatavoidvisit(INode n)Draw a small rectangle.voidvisit(IRelation<?> r)Draw objects used in relations.voidvisit(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- ifgis nulljava.lang.IllegalArgumentException- ifncis null
-
-
Method Detail
-
getColors
public void getColors()
Description copied from class:AbstractMapRendererReads 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:
getColorsin classAbstractMapRenderer
-
getSettings
protected void getSettings(boolean virtual)
Description copied from class:AbstractMapRendererReads all the settings from preferences. Calls theAbstractMapRenderer.getColors()function.- Overrides:
getSettingsin classAbstractMapRenderer- Parameters:
virtual-trueif virtual nodes are used
-
render
public void render(OsmData<?,?,?,?> data, boolean virtual, Bounds bounds)
Description copied from interface:RenderingRenders 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:
visitin 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:
visitin interfacePrimitiveVisitor- Parameters:
w- The way to draw.
-
visit
public void visit(IRelation<?> r)
Draw objects used in relations.- Specified by:
visitin 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:AbstractMapRendererDraw the node as small square with the given color.- Specified by:
drawNodein 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-trueif 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-trueif 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.
-
-