Class DuplicateWay
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.DuplicateWay
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class DuplicateWay extends Test
Tests if there are duplicate ways
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DuplicateWay.WayPair
Class to store a way reduced to coordinates and keys.private static class
DuplicateWay.WayPairNoTags
Class to store a way reduced to coordinates.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DUPLICATE_WAY
Test identification for exactly identical ways (coordinates and tags).private java.util.Set<java.lang.Integer>
knownHashCodes
Set of known hashcodes for list of coordinatesprotected static int
SAME_WAY
Test identification for identical ways (coordinates only).private MultiMap<DuplicateWay.WayPair,OsmPrimitive>
ways
Bag of all waysprivate MultiMap<DuplicateWay.WayPairNoTags,OsmPrimitive>
waysNoTags
Bag of all ways, regardless of tagsprivate java.util.List<Way>
waysToCheck
-
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 DuplicateWay()
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkWay(Way w)
void
endTest()
Notification of the end of the test.Command
fixError(TestError testError)
Fix the error by removing all but one instance of duplicate waysstatic java.util.List<LatLon>
getOrderedNodes(Way w)
Replies the ordered list of nodes of way w such as it is easier to find duplicated ways.boolean
isFixable(TestError testError)
Returns true if the given error can be fixed automaticallyvoid
removeUninterestingKeys(java.util.Map<java.lang.String,java.lang.String> wkeys)
Remove uninteresting discardable keys to normalize the tagsvoid
startTest(ProgressMonitor monitor)
Start the test using a given progress monitorvoid
visit(Way w)
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, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit, visit
-
-
-
-
Field Detail
-
DUPLICATE_WAY
protected static final int DUPLICATE_WAY
Test identification for exactly identical ways (coordinates and tags).- See Also:
- Constant Field Values
-
SAME_WAY
protected static final int SAME_WAY
Test identification for identical ways (coordinates only).- See Also:
- Constant Field Values
-
ways
private MultiMap<DuplicateWay.WayPair,OsmPrimitive> ways
Bag of all ways
-
waysNoTags
private MultiMap<DuplicateWay.WayPairNoTags,OsmPrimitive> waysNoTags
Bag of all ways, regardless of tags
-
knownHashCodes
private java.util.Set<java.lang.Integer> knownHashCodes
Set of known hashcodes for list of coordinates
-
waysToCheck
private java.util.List<Way> waysToCheck
-
-
Constructor Detail
-
DuplicateWay
public DuplicateWay()
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).
-
removeUninterestingKeys
public void removeUninterestingKeys(java.util.Map<java.lang.String,java.lang.String> wkeys)
Remove uninteresting discardable keys to normalize the tags- Parameters:
wkeys
- The tags of the way, obtained byWay#getKeys
-
visit
public void visit(Way w)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for lines.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
w
- The way to inspect.
-
getOrderedNodes
public static java.util.List<LatLon> getOrderedNodes(Way w)
Replies the ordered list of nodes of way w such as it is easier to find duplicated ways. In case of a closed way, build the list of lat/lon starting from the node with the lowest id to ensure this list will produce the same hashcode as the list obtained from another closed way with the same nodes, in the same order, but that does not start from the same node (fix #8008)- Parameters:
w
- way- Returns:
- the ordered list of nodes of way w such as it is easier to find duplicated ways
- Since:
- 7721
-
fixError
public Command fixError(TestError testError)
Fix the error by removing all but one instance of duplicate ways
-
-