Class PaintVisitor
java.lang.Object
org.openstreetmap.josm.gui.layer.validation.PaintVisitor
- All Implemented Interfaces:
OsmPrimitiveVisitor,ValidatorVisitor
Visitor that highlights the primitives affected by an error
- Since:
- 5671, 12823 (moved from
data.validationpackage)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ColorThe severity colorprivate final Graphics2DThe graphicsprivate final MapViewThe MapViewprivate final Set<PaintVisitor.PaintedPoint>private final Set<PaintVisitor.PaintedSegment>private booleanIs the error selected ? -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the internal painted objects collections.protected voidDraws a circle around the nodeprotected voiddrawSegment(Point p1, Point p2, Color color) Draws a line around the segmentprotected voiddrawSegment(Node n1, Node n2, Color color) Draws a line around the segmentprivate static ColorgetHighlightColor(Color color) Gets the color to draw highlight markers with.protected booleanChecks if the given node is in the visible area.protected booleanisSegmentVisible(Node n1, Node n2) Checks if the given segment is in the visible area.voidVisit a list of nodes that are part of the errorvoidDraw a small rectangle.voidVisit a OSM primitive, e.g.voidVisiting call for relations.voidVisiting call for lines.voidvisit(WaySegment ws) Visit a way segment that was part of the errorvoidVisit a test error
-
Field Details
-
g
The graphics -
mv
The MapView -
color
The severity color -
selected
Is the error selected ? -
paintedPoints
-
paintedSegments
-
-
Constructor Details
-
PaintVisitor
Constructor- Parameters:
g- The graphicsmv- The Mapview
-
-
Method Details
-
visit
Description copied from interface:ValidatorVisitorVisit a test error- Specified by:
visitin interfaceValidatorVisitor- Parameters:
error- The test error to visit
-
visit
Description copied from interface:ValidatorVisitorVisit a OSM primitive, e.g. to highlight it- Specified by:
visitin interfaceValidatorVisitor- Parameters:
p- The primitive
-
drawNode
Draws a circle around the node- Parameters:
n- The nodecolor- The circle color
-
drawSegment
Draws a line around the segment- Parameters:
p1- The first point of segmentp2- The second point of segmentcolor- The color
-
drawSegment
Draws a line around the segment- Parameters:
n1- The first node of segmentn2- The second node of segmentcolor- The color
-
visit
Draw a small rectangle. White if selected (as always) or red otherwise.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
n- The node to draw.
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
w- The way to inspect.
-
visit
Description copied from interface:ValidatorVisitorVisit a way segment that was part of the error- Specified by:
visitin interfaceValidatorVisitor- Parameters:
ws- The way segment
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for relations.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
r- The relation to inspect.
-
isNodeVisible
Checks if the given node is in the visible area.- Parameters:
n- The node to check for visibility- Returns:
- true if the node is visible
-
isSegmentVisible
Checks if the given segment is in the visible area. NOTE: This will return true for a small number of non-visible segments.- Parameters:
n1- The first point of the segment to checkn2- The second point of the segment to check- Returns:
trueif the segment is visible
-
visit
Description copied from interface:ValidatorVisitorVisit a list of nodes that are part of the error- Specified by:
visitin interfaceValidatorVisitor- Parameters:
nodes- The nodes
-
getHighlightColor
Gets the color to draw highlight markers with.- Parameters:
color- severity color- Returns:
- The color.
-
clearPaintedObjects
Clears the internal painted objects collections.
-