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 classDuplicateWay.WayPairClass to store a way reduced to coordinates and keys.private static classDuplicateWay.WayPairNoTagsClass 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 intDUPLICATE_WAYTest identification for exactly identical ways (coordinates and tags).private java.util.Set<java.lang.Integer>knownHashCodesSet of known hashcodes for list of coordinatesprotected static intSAME_WAYTest identification for identical ways (coordinates only).private MultiMap<DuplicateWay.WayPair,OsmPrimitive>waysBag of all waysprivate MultiMap<DuplicateWay.WayPairNoTags,OsmPrimitive>waysNoTagsBag 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 voidcheckWay(Way w)voidendTest()Notification of the end of the test.CommandfixError(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.booleanisFixable(TestError testError)Returns true if the given error can be fixed automaticallyvoidremoveUninterestingKeys(java.util.Map<java.lang.String,java.lang.String> wkeys)Remove uninteresting discardable keys to normalize the tagsvoidstartTest(ProgressMonitor monitor)Start the test using a given progress monitorvoidvisit(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:TestStart the test using a given progress monitor
-
endTest
public void endTest()
Description copied from class:TestNotification 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:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin 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
-
-