Class SnakeRoadNetworkWalk
- java.lang.Object
-
- org.openstreetmap.atlas.checks.validation.linear.edges.SnakeRoadNetworkWalk
-
public class SnakeRoadNetworkWalk extends java.lang.ObjectKeeps track of the network walk results for theSnakeRoadCheck
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSnakeRoadNetworkWalk(org.openstreetmap.atlas.geography.atlas.items.Edge edge, org.openstreetmap.atlas.utilities.scalars.Angle threshold)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDirectConnections(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge> edges)protected voidcheckIfEdgeHeadingDifferenceExceedsThreshold(org.openstreetmap.atlas.geography.atlas.items.Edge incoming, org.openstreetmap.atlas.geography.atlas.items.Edge outgoing)Checks if the difference in heading between the incoming and outgoingEdges exceeds the thresholdprotected voidclearOneLayerRemovedConnections()protected voidfilterFalsePositives()We filter false positives for two cases.protected java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge>getConnectedMainEdgeOfTheSameWay(org.openstreetmap.atlas.geography.atlas.items.Edge edge)Returns all connected main, non-visitedEdges that are a continuation of the same OSM wayprotected java.util.Queue<org.openstreetmap.atlas.geography.atlas.items.Edge>getDirectConnections()protected longgetGreatestEncounteredValence()protected java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge>getOneLayerRemovedConnections()protected java.util.TreeSet<org.openstreetmap.atlas.geography.atlas.items.AtlasObject>getVisitedEdges()protected booleanisSnakeRoad()protected voidpopulateOneLayerRemovedConnections(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge> edges)protected voidvisitEdge(org.openstreetmap.atlas.geography.atlas.items.Edge comingFrom, org.openstreetmap.atlas.geography.atlas.items.Edge comingTo)Adds the givenEdgeto the visited set and updates the greatest valence value
-
-
-
Method Detail
-
addDirectConnections
protected void addDirectConnections(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge> edges)
-
checkIfEdgeHeadingDifferenceExceedsThreshold
protected void checkIfEdgeHeadingDifferenceExceedsThreshold(org.openstreetmap.atlas.geography.atlas.items.Edge incoming, org.openstreetmap.atlas.geography.atlas.items.Edge outgoing)Checks if the difference in heading between the incoming and outgoingEdges exceeds the threshold- Parameters:
incoming- The incomingEdgeoutgoing- The outgoingEdge
-
clearOneLayerRemovedConnections
protected void clearOneLayerRemovedConnections()
-
filterFalsePositives
protected void filterFalsePositives()
We filter false positives for two cases. 1) If the network walk has yielded a snake road with a name, we check all of the connected roads to see if that name is shared across any of them. If it is, highly likely that the snake road is a false positive, and we remove the snake road designation. An example is when we flag a portion of highway that behaves as a snake road. 2) We do the same for ref tags to avoid flagging section of highway that exhibit snake road behavior.
-
getConnectedMainEdgeOfTheSameWay
protected java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge> getConnectedMainEdgeOfTheSameWay(org.openstreetmap.atlas.geography.atlas.items.Edge edge)
Returns all connected main, non-visitedEdges that are a continuation of the same OSM way- Parameters:
edge- theEdgefrom which we're seeking connections- Returns:
- a set of
Edges
-
getDirectConnections
protected java.util.Queue<org.openstreetmap.atlas.geography.atlas.items.Edge> getDirectConnections()
-
getGreatestEncounteredValence
protected long getGreatestEncounteredValence()
-
getOneLayerRemovedConnections
protected java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge> getOneLayerRemovedConnections()
-
getVisitedEdges
protected java.util.TreeSet<org.openstreetmap.atlas.geography.atlas.items.AtlasObject> getVisitedEdges()
-
isSnakeRoad
protected boolean isSnakeRoad()
-
populateOneLayerRemovedConnections
protected void populateOneLayerRemovedConnections(java.util.Set<org.openstreetmap.atlas.geography.atlas.items.Edge> edges)
-
visitEdge
protected void visitEdge(org.openstreetmap.atlas.geography.atlas.items.Edge comingFrom, org.openstreetmap.atlas.geography.atlas.items.Edge comingTo)Adds the givenEdgeto the visited set and updates the greatest valence value- Parameters:
comingFrom- theEdgewe are coming fromcomingTo- theEdgewe are coming to
-
-