java.lang.Object
org.openstreetmap.josm.data.validation.Test
org.openstreetmap.josm.data.validation.tests.Coastlines
All Implemented Interfaces:
OsmPrimitiveVisitor

public class Coastlines extends Test
Check coastlines for errors
  • Field Details

  • Constructor Details

  • Method Details

    • startTest

      public void startTest(ProgressMonitor monitor)
      Description copied from class: Test
      Start the test using a given progress monitor
      Overrides:
      startTest in class Test
      Parameters:
      monitor - the progress monitor
    • endTest

      public void endTest()
      Description copied from class: Test
      Notification of the end of the test. The tester may perform additional actions and destroy the used structures.

      If you override this method, don't forget to cleanup progressMonitor (most overrides call super.endTest() to do this).

      Overrides:
      endTest in class Test
    • checkConnections

      private void checkConnections()
      Check connections between coastline ways. The nodes of a coastline way have to fulfil these rules: 1) the first node must be connected to the last node of a coastline way (which might be the same way) 2) the last node must be connected to the first node of a coastline way (which might be the same way) 3) all other nodes must not be connected to a coastline way 4) the number of referencing coastline ways must be 1 or 2 Nodes outside the download area are special cases, we may not know enough about the connected ways.
    • checkDirection

      private void checkDirection()
      Check if two or more coastline ways form a closed clockwise way
    • checkIfReversed

      private void checkIfReversed(Way w, Way other, Node n1)
      Check if a reversed way would fit, if yes, add fixable "reversed" error, "unordered" else
      Parameters:
      w - way that might be reversed
      other - other way that is connected to w
      n1 - node at which w and other are connected
    • addError

      private void addError(int errCode, Way w, Collection<Way> otherWays, Node n)
      Add error if not already done
      Parameters:
      errCode - the error code
      w - the way that is in error
      otherWays - collection of other ways in error or null
      n - the node to be highlighted or null
    • visit

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

      private static boolean isCoastline(OsmPrimitive osm)
    • fixError

      public Command fixError(TestError testError)
      Description copied from class: Test
      Fixes the error with the appropriate command
      Overrides:
      fixError in class Test
      Parameters:
      testError - error to fix
      Returns:
      The command to fix the error
    • isFixable

      public boolean isFixable(TestError testError)
      Description copied from class: Test
      Returns true if the given error can be fixed automatically
      Overrides:
      isFixable in class Test
      Parameters:
      testError - The error to check if can be fixed
      Returns:
      true if the error can be fixed