public class PaintVisitor extends AbstractVisitor implements ValidatorVisitor
Modifier and Type | Class and Description |
---|---|
protected static class |
PaintVisitor.PaintedPoint |
protected static class |
PaintVisitor.PaintedSegment |
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
color
The severity color
|
private java.awt.Graphics |
g
The graphics
|
private MapView |
mv
The MapView
|
private java.util.Set<PaintVisitor.PaintedPoint> |
paintedPoints |
private java.util.Set<PaintVisitor.PaintedSegment> |
paintedSegments |
private boolean |
selected
Is the error selected ?
|
Constructor and Description |
---|
PaintVisitor(java.awt.Graphics g,
MapView mv)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
clearPaintedObjects()
Clears the internal painted objects collections.
|
protected void |
drawNode(Node n,
java.awt.Color color)
Draws a circle around the node
|
protected void |
drawSegment(Node n1,
Node n2,
java.awt.Color color)
Draws a line around the segment
|
protected void |
drawSegment(java.awt.Point p1,
java.awt.Point p2,
java.awt.Color color)
Draws a line around the segment
|
private static java.awt.Color |
getHighlightColor(java.awt.Color color)
Gets the color to draw highlight markers with.
|
protected boolean |
isNodeVisible(Node n)
Checks if the given node is in the visible area.
|
protected boolean |
isSegmentVisible(Node n1,
Node n2)
Checks if the given segment is in the visible area.
|
void |
visit(java.util.List<Node> nodes) |
void |
visit(Node n)
Draw a small rectangle.
|
void |
visit(OsmPrimitive p) |
void |
visit(Relation r)
Visiting call for relations.
|
void |
visit(TestError error) |
void |
visit(Way w)
Visiting call for lines.
|
void |
visit(WaySegment ws) |
visit
private final java.awt.Graphics g
private java.awt.Color color
private boolean selected
private final java.util.Set<PaintVisitor.PaintedPoint> paintedPoints
private final java.util.Set<PaintVisitor.PaintedSegment> paintedSegments
public PaintVisitor(java.awt.Graphics g, MapView mv)
g
- The graphicsmv
- The Mapviewpublic void visit(TestError error)
visit
in interface ValidatorVisitor
public void visit(OsmPrimitive p)
visit
in interface ValidatorVisitor
protected void drawNode(Node n, java.awt.Color color)
n
- The nodecolor
- The circle colorprotected void drawSegment(java.awt.Point p1, java.awt.Point p2, java.awt.Color color)
p1
- The first point of segmentp2
- The second point of segmentcolor
- The colorprotected void drawSegment(Node n1, Node n2, java.awt.Color color)
n1
- The first node of segmentn2
- The second node of segmentcolor
- The colorpublic void visit(Node n)
public void visit(WaySegment ws)
visit
in interface ValidatorVisitor
public void visit(Relation r)
Visitor
protected boolean isNodeVisible(Node n)
n
- The node to check for visibilityprotected boolean isSegmentVisible(Node n1, Node n2)
n1
- The first point of the segment to checkn2
- The second point of the segment to checktrue
if the segment is visiblepublic void visit(java.util.List<Node> nodes)
visit
in interface ValidatorVisitor
private static java.awt.Color getHighlightColor(java.awt.Color color)
color
- severity colorpublic void clearPaintedObjects()