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 classUnconnectedWays.MyWaySegmentstatic classUnconnectedWays.UnconnectedHighwaysUnconnected highways test.static classUnconnectedWays.UnconnectedNaturalOrLanduseUnconnected natural/landuse test.static classUnconnectedWays.UnconnectedPowerUnconnected power ways test.static classUnconnectedWays.UnconnectedRailwaysUnconnected railways test.static classUnconnectedWays.UnconnectedWaterwaysUnconnected 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 intcodeprivate static java.lang.StringCONSTRUCTION(package private) static doubleDETOUR_FACTORprivate DataSetdsprivate java.awt.geom.AreadsAreaprivate java.util.Set<Node>endnodesprivate booleanisHighwayTestprivate doublemaxLenprivate java.util.Set<Node>middlenodesprivate doublemindistprivate doubleminmiddledistprivate java.util.Set<Node>nodesToTestprivate java.util.Set<Node>othernodesprivate static java.lang.StringPLATFORMprivate static java.lang.StringPLATFORM_EDGEprivate static java.lang.StringPOWERprotected static java.lang.StringPREFIXprivate QuadBuckets<Node>searchNodesprotected static intUNCONNECTED_WAYSprivate java.util.List<UnconnectedWays.MyWaySegment>waySegmentsprivate java.util.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 protectedUnconnectedWays(java.lang.String title)Constructs a newUnconnectedWaystest.protectedUnconnectedWays(java.lang.String title, int code, boolean isHighwayTest)Constructs a newUnconnectedWaystest with the given code.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddErrors(Severity severity, java.util.Map<Node,UnconnectedWays.MyWaySegment> errorMap, java.lang.String message)private voidaddIfNewOrCloser(java.util.Map<Node,UnconnectedWays.MyWaySegment> map, Node node, UnconnectedWays.MyWaySegment ws)private voidaddNode(Node n, java.util.Set<Node> s)voidendTest()Notification of the end of the test.private voidfillSearchNodes(java.util.Collection<Node> nodes)protected java.util.Map<Node,UnconnectedWays.MyWaySegment>getHighwayEndNodesNearOtherHighway()protected WaygetWantedParentWay(Node endnode)An unconnected node might have multiple parent ways, e.g.protected java.util.Map<Node,UnconnectedWays.MyWaySegment>getWayEndNodesNearOtherWay()protected java.util.Map<Node,UnconnectedWays.MyWaySegment>getWayNodesNearOtherWay()(package private) java.util.List<UnconnectedWays.MyWaySegment>getWaySegments(Way w)protected booleanignoreUnconnectedEndNode(Node n)Check if unconnected end node should be ignored.protected abstract booleanisCandidate(OsmPrimitive p)booleanisPrimitiveUsable(OsmPrimitive p)Determines if the primitive is usable for tests.protected booleanisWantedWay(Way w)voidstartTest(ProgressMonitor monitor)Start the test using a given progress monitorvoidvisit(Node n)Visiting call for points.voidvisit(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, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit
-
-
-
-
Field Detail
-
POWER
private static final java.lang.String POWER
- See Also:
- Constant Field Values
-
PLATFORM
private static final java.lang.String PLATFORM
- See Also:
- Constant Field Values
-
PLATFORM_EDGE
private static final java.lang.String PLATFORM_EDGE
- See Also:
- Constant Field Values
-
CONSTRUCTION
private static final java.lang.String CONSTRUCTION
- See Also:
- Constant Field Values
-
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
-
PREFIX
protected static final java.lang.String PREFIX
-
waySegments
private java.util.List<UnconnectedWays.MyWaySegment> waySegments
-
middlenodes
private java.util.Set<Node> middlenodes
-
othernodes
private java.util.Set<Node> othernodes
-
searchNodes
private QuadBuckets<Node> searchNodes
-
waysToTest
private java.util.Set<Way> waysToTest
-
nodesToTest
private java.util.Set<Node> nodesToTest
-
dsArea
private java.awt.geom.Area dsArea
-
mindist
private double mindist
-
minmiddledist
private double minmiddledist
-
maxLen
private double maxLen
-
-
Constructor Detail
-
UnconnectedWays
protected UnconnectedWays(java.lang.String title)
Constructs a newUnconnectedWaystest.- Parameters:
title- The test title- Since:
- 6691
-
UnconnectedWays
protected UnconnectedWays(java.lang.String title, int code, boolean isHighwayTest)
Constructs a newUnconnectedWaystest with the given code.- Parameters:
title- The test titlecode- The test codeisHighwayTest- usetrueif 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:TestDetermines if the primitive is usable for tests.- Overrides:
isPrimitiveUsablein classTest- Parameters:
p- The primitive- Returns:
trueif the primitive can be tested,falseotherwise
-
startTest
public void startTest(ProgressMonitor monitor)
Description copied from class:TestStart the test using a given progress monitor
-
getHighwayEndNodesNearOtherHighway
protected java.util.Map<Node,UnconnectedWays.MyWaySegment> getHighwayEndNodesNearOtherHighway()
-
getWayEndNodesNearOtherWay
protected java.util.Map<Node,UnconnectedWays.MyWaySegment> getWayEndNodesNearOtherWay()
-
getWayNodesNearOtherWay
protected java.util.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(java.util.Map<Node,UnconnectedWays.MyWaySegment> map, Node node, UnconnectedWays.MyWaySegment ws)
-
addErrors
protected final void addErrors(Severity severity, java.util.Map<Node,UnconnectedWays.MyWaySegment> errorMap, java.lang.String message)
-
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).
-
fillSearchNodes
private void fillSearchNodes(java.util.Collection<Node> nodes)
-
getWaySegments
java.util.List<UnconnectedWays.MyWaySegment> getWaySegments(Way w)
-
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.
-
visit
public void visit(Node n)
Description copied from interface:OsmPrimitiveVisitorVisiting call for points.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
n- The node to inspect.
-
-