Class PaintVisitor

java.lang.Object
org.openstreetmap.josm.gui.layer.validation.PaintVisitor
All Implemented Interfaces:
OsmPrimitiveVisitor, ValidatorVisitor

public class PaintVisitor extends Object implements OsmPrimitiveVisitor, ValidatorVisitor
Visitor that highlights the primitives affected by an error
Since:
5671, 12823 (moved from data.validation package)
  • Field Details

  • Constructor Details

  • Method Details

    • visit

      public void visit(TestError error)
      Description copied from interface: ValidatorVisitor
      Visit a test error
      Specified by:
      visit in interface ValidatorVisitor
      Parameters:
      error - The test error to visit
    • visit

      public void visit(OsmPrimitive p)
      Description copied from interface: ValidatorVisitor
      Visit a OSM primitive, e.g. to highlight it
      Specified by:
      visit in interface ValidatorVisitor
      Parameters:
      p - The primitive
    • drawNode

      protected void drawNode(Node n, Color color)
      Draws a circle around the node
      Parameters:
      n - The node
      color - The circle color
    • drawSegment

      protected void drawSegment(Point p1, Point p2, Color color)
      Draws a line around the segment
      Parameters:
      p1 - The first point of segment
      p2 - The second point of segment
      color - The color
    • drawSegment

      protected void drawSegment(Node n1, Node n2, Color color)
      Draws a line around the segment
      Parameters:
      n1 - The first node of segment
      n2 - The second node of segment
      color - The color
    • visit

      public void visit(Node n)
      Draw a small rectangle. White if selected (as always) or red otherwise.
      Specified by:
      visit in interface OsmPrimitiveVisitor
      Parameters:
      n - The node to draw.
    • visit

      public void visit(Way w)
      Description copied from interface: OsmPrimitiveVisitor
      Visiting call for lines.
      Specified by:
      visit in interface OsmPrimitiveVisitor
      Parameters:
      w - The way to inspect.
    • visit

      public void visit(WaySegment ws)
      Description copied from interface: ValidatorVisitor
      Visit a way segment that was part of the error
      Specified by:
      visit in interface ValidatorVisitor
      Parameters:
      ws - The way segment
    • visit

      public void visit(Relation r)
      Description copied from interface: OsmPrimitiveVisitor
      Visiting call for relations.
      Specified by:
      visit in interface OsmPrimitiveVisitor
      Parameters:
      r - The relation to inspect.
    • isNodeVisible

      protected boolean isNodeVisible(Node n)
      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

      protected boolean isSegmentVisible(Node n1, Node n2)
      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 check
      n2 - The second point of the segment to check
      Returns:
      true if the segment is visible
    • visit

      public void visit(List<Node> nodes)
      Description copied from interface: ValidatorVisitor
      Visit a list of nodes that are part of the error
      Specified by:
      visit in interface ValidatorVisitor
      Parameters:
      nodes - The nodes
    • getHighlightColor

      private static Color getHighlightColor(Color color)
      Gets the color to draw highlight markers with.
      Parameters:
      color - severity color
      Returns:
      The color.
    • clearPaintedObjects

      public void clearPaintedObjects()
      Clears the internal painted objects collections.