public abstract class AbstractMapRenderer extends java.lang.Object implements Rendering
Abstract common superclass for Rendering
implementations.
Modifier and Type | Field and Description |
---|---|
protected java.awt.Color |
backgroundColor
Color Preference for background
|
protected java.awt.Graphics2D |
g
the graphics context to which the visitor renders OSM objects
|
protected java.awt.Color |
highlightColor
Color Preference for hightlighted objects
|
protected java.awt.Color |
inactiveColor
Color Preference for inactive objects
|
protected boolean |
isInactiveMode
if true, the paint visitor shall render OSM objects such that they
look inactive.
|
protected MapViewState |
mapState
The
MapViewState to use to convert between coordinates. |
protected NavigatableComponent |
nc
the map viewport - provides projection and hit detection functionality
|
protected java.awt.Color |
nodeColor
Color Preference for nodes
|
protected java.awt.Color |
relationSelectedColor
Color Preference for members of selected relations
|
protected int |
segmentNumberSpace
Preference: minimum space (displayed way length) to display segment numbers
|
protected java.awt.Color |
selectedColor
Color Preference for selected objects
|
protected int |
virtualNodeSize
Preference: size of virtual nodes (0 displayes display)
|
protected int |
virtualNodeSpace
Preference: minimum space (displayed way length) to display virtual nodes
|
Constructor and Description |
---|
AbstractMapRenderer(java.awt.Graphics2D g,
NavigatableComponent nc,
boolean isInactiveMode)
Creates an abstract paint visitor
|
Modifier and Type | Method and Description |
---|---|
abstract void |
drawNode(Node n,
java.awt.Color color,
int size,
boolean fill)
Draw the node as small square with the given color.
|
protected void |
drawOrderNumber(MapViewState.MapViewPoint p1,
MapViewState.MapViewPoint p2,
int orderNumber,
java.awt.Color clr)
Draw an number of the order of the two consecutive nodes within the
parents way
|
void |
drawVirtualNodes(DataSet data,
BBox bbox)
Draws virtual nodes.
|
void |
getColors()
Reads the color definitions from preferences.
|
protected void |
getSettings(boolean virtual)
Reads all the settings from preferences.
|
static boolean |
isLargeSegment(MapViewState.MapViewPoint p1,
MapViewState.MapViewPoint p2,
int space)
Checks if a way segemnt is large enough for additional information display.
|
protected boolean |
isSegmentVisible(MapViewState.MapViewPoint p1,
MapViewState.MapViewPoint p2)
Checks if segment is visible in display.
|
void |
visitVirtual(java.awt.geom.Path2D path,
Way w)
Creates path for drawing virtual nodes for one way.
|
protected java.awt.Graphics2D g
protected NavigatableComponent nc
protected final MapViewState mapState
MapViewState
to use to convert between coordinates.protected boolean isInactiveMode
protected java.awt.Color backgroundColor
protected java.awt.Color inactiveColor
protected java.awt.Color selectedColor
protected java.awt.Color relationSelectedColor
protected java.awt.Color nodeColor
protected java.awt.Color highlightColor
protected int virtualNodeSize
protected int virtualNodeSpace
protected int segmentNumberSpace
public AbstractMapRenderer(java.awt.Graphics2D g, NavigatableComponent nc, boolean isInactiveMode)
Creates an abstract paint visitor
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 abstract void drawNode(Node n, java.awt.Color color, int size, boolean fill)
n
- The node to draw.color
- The color of the node.size
- size in pixelsfill
- determines if the square mmust be filledprotected void drawOrderNumber(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, int orderNumber, java.awt.Color clr)
p1
- First point of the way segment.p2
- Second point of the way segment.orderNumber
- The number of the segment in the way.clr
- The color to use for drawing the text.public void drawVirtualNodes(DataSet data, BBox bbox)
data
- The data set being rendered.bbox
- The bounding box being displayed.public void getColors()
public
, so that
color names in preferences can be displayed even without calling the wireframe display before.protected void getSettings(boolean virtual)
virtual
- true
if virtual nodes are usedpublic static boolean isLargeSegment(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, int space)
p1
- First point of the way segment.p2
- Second point of the way segment.space
- The free space to check against.true
if segment is larger than required spaceprotected boolean isSegmentVisible(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2)
p1
- First point of the way segment.p2
- Second point of the way segment.true
if segment may be visible.public void visitVirtual(java.awt.geom.Path2D path, Way w)
path
- The path to append drawing to.w
- The ways to draw node for.