Class UnconnectedWays
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.UnconnectedWays
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
- Direct Known Subclasses:
UnconnectedWays.UnconnectedHighways
,UnconnectedWays.UnconnectedNaturalOrLanduse
,UnconnectedWays.UnconnectedPower
,UnconnectedWays.UnconnectedRailways
,UnconnectedWays.UnconnectedWaterways
public abstract class UnconnectedWays extends Test
Checks if a way has an endpoint very near to another way.
This class is abstract since highway/railway/waterway/… ways must be handled separately. An actual implementation must overrideisPrimitiveUsable(OsmPrimitive)
to denote which kind of primitives can be handled.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
UnconnectedWays.MyWaySegment
static class
UnconnectedWays.UnconnectedHighways
Unconnected highways test.static class
UnconnectedWays.UnconnectedNaturalOrLanduse
Unconnected natural/landuse test.static class
UnconnectedWays.UnconnectedPower
Unconnected power ways test.static class
UnconnectedWays.UnconnectedRailways
Unconnected railways test.static class
UnconnectedWays.UnconnectedWaterways
Unconnected waterways test.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description private int
code
(package private) static double
DETOUR_FACTOR
private DataSet
ds
private Area
dsArea
private Set<Node>
endnodes
private boolean
isHighwayTest
private double
maxLen
private Set<Node>
middlenodes
private double
mindist
private double
minmiddledist
private Set<Node>
nodesToTest
private Set<Node>
othernodes
protected static String
PREFIX
private QuadBuckets<Node>
searchNodes
protected static int
UNCONNECTED_WAYS
private List<UnconnectedWays.MyWaySegment>
waySegments
private Set<Way>
waysToTest
-
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 Modifier Constructor Description protected
UnconnectedWays(String title)
Constructs a newUnconnectedWays
test.protected
UnconnectedWays(String title, int code, boolean isHighwayTest)
Constructs a newUnconnectedWays
test with the given code.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addErrors(Severity severity, Map<Node,UnconnectedWays.MyWaySegment> errorMap, String message)
private void
addIfNewOrCloser(Map<Node,UnconnectedWays.MyWaySegment> map, Node node, UnconnectedWays.MyWaySegment ws)
private void
addNode(Node n, Set<Node> s)
void
endTest()
Notification of the end of the test.private void
fillSearchNodes(Collection<Node> nodes)
protected Map<Node,UnconnectedWays.MyWaySegment>
getHighwayEndNodesNearOtherHighway()
protected Way
getWantedParentWay(Node endnode)
An unconnected node might have multiple parent ways, e.g.protected Map<Node,UnconnectedWays.MyWaySegment>
getWayEndNodesNearOtherWay()
protected Map<Node,UnconnectedWays.MyWaySegment>
getWayNodesNearOtherWay()
(package private) List<UnconnectedWays.MyWaySegment>
getWaySegments(Way w)
protected boolean
ignoreUnconnectedEndNode(Node n)
Check if unconnected end node should be ignored.protected abstract boolean
isCandidate(OsmPrimitive p)
boolean
isPrimitiveUsable(OsmPrimitive p)
Determines if the primitive is usable for tests.protected boolean
isWantedWay(Way w)
void
startTest(ProgressMonitor monitor)
Start the test using a given progress monitorvoid
visit(Node n)
Visiting call for points.void
visit(Way w)
Visiting call for lines.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, fixError, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isFixable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit
-
-
-
-
Field Detail
-
code
private final int code
-
isHighwayTest
private final boolean isHighwayTest
-
DETOUR_FACTOR
static final double DETOUR_FACTOR
- See Also:
- Constant Field Values
-
UNCONNECTED_WAYS
protected static final int UNCONNECTED_WAYS
- See Also:
- Constant Field Values
-
waySegments
private List<UnconnectedWays.MyWaySegment> waySegments
-
middlenodes
private Set<Node> middlenodes
-
othernodes
private Set<Node> othernodes
-
searchNodes
private QuadBuckets<Node> searchNodes
-
waysToTest
private Set<Way> waysToTest
-
nodesToTest
private Set<Node> nodesToTest
-
mindist
private double mindist
-
minmiddledist
private double minmiddledist
-
maxLen
private double maxLen
-
-
Constructor Detail
-
UnconnectedWays
protected UnconnectedWays(String title)
Constructs a newUnconnectedWays
test.- Parameters:
title
- The test title- Since:
- 6691
-
UnconnectedWays
protected UnconnectedWays(String title, int code, boolean isHighwayTest)
Constructs a newUnconnectedWays
test with the given code.- Parameters:
title
- The test titlecode
- The test codeisHighwayTest
- usetrue
if test concerns highways or railways- Since:
- 14468
-
-
Method Detail
-
isCandidate
protected abstract boolean isCandidate(OsmPrimitive p)
-
isWantedWay
protected boolean isWantedWay(Way w)
-
ignoreUnconnectedEndNode
protected boolean ignoreUnconnectedEndNode(Node n)
Check if unconnected end node should be ignored.- Parameters:
n
- the node- Returns:
- true if node should be ignored
-
isPrimitiveUsable
public boolean isPrimitiveUsable(OsmPrimitive p)
Description copied from class:Test
Determines if the primitive is usable for tests.- Overrides:
isPrimitiveUsable
in classTest
- Parameters:
p
- The primitive- Returns:
true
if the primitive can be tested,false
otherwise
-
startTest
public void startTest(ProgressMonitor monitor)
Description copied from class:Test
Start the test using a given progress monitor
-
getHighwayEndNodesNearOtherHighway
protected Map<Node,UnconnectedWays.MyWaySegment> getHighwayEndNodesNearOtherHighway()
-
getWayEndNodesNearOtherWay
protected Map<Node,UnconnectedWays.MyWaySegment> getWayEndNodesNearOtherWay()
-
getWayNodesNearOtherWay
protected Map<Node,UnconnectedWays.MyWaySegment> getWayNodesNearOtherWay()
-
getWantedParentWay
protected Way getWantedParentWay(Node endnode)
An unconnected node might have multiple parent ways, e.g. a highway and a landuse way. Make sure we get the one that was analysed before.- Parameters:
endnode
- the node which is known to be an end node of the wanted way- Returns:
- the wanted way
-
addIfNewOrCloser
private void addIfNewOrCloser(Map<Node,UnconnectedWays.MyWaySegment> map, Node node, UnconnectedWays.MyWaySegment ws)
-
addErrors
protected final void addErrors(Severity severity, Map<Node,UnconnectedWays.MyWaySegment> errorMap, String message)
-
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).
-
fillSearchNodes
private void fillSearchNodes(Collection<Node> nodes)
-
getWaySegments
List<UnconnectedWays.MyWaySegment> getWaySegments(Way w)
-
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.
-
visit
public void visit(Node n)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for points.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
n
- The node to inspect.
-
-