Class Coastlines
- 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description private List<Way>
coastlineWays
protected static int
REVERSED_COASTLINE
protected static int
UNCONNECTED_COASTLINE
protected static int
UNORDERED_COASTLINE
protected static int
WRONG_ORDER_COASTLINE
-
Fields inherited from class org.openstreetmap.josm.data.validation.Test
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, stopwatch, testBeforeUpload
-
-
Constructor Summary
Constructors Constructor Description Coastlines()
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addError(int errCode, Way w, Collection<Way> otherWays, Node n)
Add error if not already doneprivate void
checkConnections()
Check connections between coastline ways.private void
checkDirection()
Check if two or more coastline ways form a closed clockwise wayprivate void
checkIfReversed(Way w, Way other, Node n1)
Check if a reversed way would fit, if yes, add fixable "reversed" error, "unordered" elsevoid
endTest()
Notification of the end of the test.Command
fixError(TestError testError)
Fixes the error with the appropriate commandprivate static boolean
isCoastline(OsmPrimitive osm)
boolean
isFixable(TestError testError)
Returns true if the given error can be fixed automaticallyvoid
startTest(ProgressMonitor monitor)
Start the test using a given progress monitorvoid
visit(Way way)
Visiting call for lines.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit, visit
-
-
-
-
Field Detail
-
UNORDERED_COASTLINE
protected static final int UNORDERED_COASTLINE
- See Also:
- Constant Field Values
-
REVERSED_COASTLINE
protected static final int REVERSED_COASTLINE
- See Also:
- Constant Field Values
-
UNCONNECTED_COASTLINE
protected static final int UNCONNECTED_COASTLINE
- See Also:
- Constant Field Values
-
WRONG_ORDER_COASTLINE
protected static final int WRONG_ORDER_COASTLINE
- See Also:
- Constant Field Values
-
coastlineWays
private List<Way> coastlineWays
-
-
Constructor Detail
-
Coastlines
public Coastlines()
Constructor
-
-
Method Detail
-
startTest
public void startTest(ProgressMonitor monitor)
Description copied from class:Test
Start the test using a given 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 callsuper.endTest()
to do this).
-
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 reversedother
- other way that is connected to wn1
- 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 codew
- the way that is in errorotherWays
- collection of other ways in error or nulln
- 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 interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- 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
-
-