Class CrossingWays
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.CrossingWays
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
- Direct Known Subclasses:
CrossingWays.Boundaries,CrossingWays.SelfCrossing,CrossingWays.Ways
public abstract class CrossingWays extends Test
Tests if there are segments that crosses in the same layer/level
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCrossingWays.BoundariesCrossing boundaries ways test.(package private) static classCrossingWays.MessageHelperstatic classCrossingWays.SelfCrossingSelf crossing ways test (for all ways)static classCrossingWays.WaysGeneral crossing ways test.private static classCrossingWays.WayTypeType of way.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringBARRIERprivate java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>>cellSegmentsAll way segments, grouped by cellsprotected intcode(package private) static java.lang.StringHIGHWAY(package private) static java.lang.StringLANDUSE(package private) static java.lang.StringRAILWAYprivate java.util.Map<java.util.List<Way>,java.util.List<WaySegment>>seenWaysThe already detected ways in error(package private) static java.lang.StringWATERWAYprivate 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 protectedCrossingWays(java.lang.String title, int code)Constructs a newCrossingWaystest.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private java.util.Collection<Way>addNearbyObjects()private static booleanareLayerOrLevelDifferent(Way w1, Way w2)(package private) CrossingWays.MessageHelpercreateMessage(Way w1, Way w2)voidendTest()Notification of the end of the test.static voidfindIntersectingWay(Way w, java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments, java.util.Map<java.util.List<Way>,java.util.List<WaySegment>> crossingWays, boolean findSharedWaySegments)Find ways which are crossing without sharing a node.static java.util.List<java.util.List<WaySegment>>getSegments(java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments, EastNorth n1, EastNorth n2)Returns all the cells this segment crosses.static java.util.List<java.util.List<WaySegment>>getSegments(java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments, ILatLon n1, ILatLon n2)Returns all the cells this segment crosses.(package private) abstract booleanignoreWaySegmentCombination(Way w1, Way w2)(package private) static booleanisCoastline(OsmPrimitive w)(package private) static booleanisHighway(OsmPrimitive w)(package private) static booleanisProposedOrAbandoned(OsmPrimitive w)(package private) static booleanisRailway(OsmPrimitive w)static booleanisSelfCrossing(Way way)Check if the given way is self crossing(package private) static booleanisSubwayOrTramOrRazed(OsmPrimitive w)(package private) static booleanisWaterArea(OsmPrimitive w)protected voidrunTest()voidstartTest(ProgressMonitor monitor)Start the test using a given progress monitorprivate voidtestWay(Way w)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, isPrimitiveUsable, isResidentialArea, ok, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit, visit
-
-
-
-
Field Detail
-
BARRIER
static final java.lang.String BARRIER
- See Also:
- Constant Field Values
-
HIGHWAY
static final java.lang.String HIGHWAY
- See Also:
- Constant Field Values
-
RAILWAY
static final java.lang.String RAILWAY
- See Also:
- Constant Field Values
-
WATERWAY
static final java.lang.String WATERWAY
- See Also:
- Constant Field Values
-
LANDUSE
static final java.lang.String LANDUSE
- See Also:
- Constant Field Values
-
cellSegments
private final java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments
All way segments, grouped by cells
-
seenWays
private final java.util.Map<java.util.List<Way>,java.util.List<WaySegment>> seenWays
The already detected ways in error
-
waysToTest
private final java.util.Set<Way> waysToTest
-
code
protected final int code
-
-
Constructor Detail
-
CrossingWays
protected CrossingWays(java.lang.String title, int code)
Constructs a newCrossingWaystest.- Parameters:
title- The test titlecode- The test code- Since:
- 12958
-
-
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).
-
runTest
protected void runTest()
-
addNearbyObjects
private java.util.Collection<Way> addNearbyObjects()
-
isCoastline
static boolean isCoastline(OsmPrimitive w)
-
isWaterArea
static boolean isWaterArea(OsmPrimitive w)
-
isHighway
static boolean isHighway(OsmPrimitive w)
-
isRailway
static boolean isRailway(OsmPrimitive w)
-
isSubwayOrTramOrRazed
static boolean isSubwayOrTramOrRazed(OsmPrimitive w)
-
isProposedOrAbandoned
static boolean isProposedOrAbandoned(OsmPrimitive w)
-
ignoreWaySegmentCombination
abstract boolean ignoreWaySegmentCombination(Way w1, Way w2)
-
createMessage
CrossingWays.MessageHelper createMessage(Way w1, Way w2)
-
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.
-
areLayerOrLevelDifferent
private static boolean areLayerOrLevelDifferent(Way w1, Way w2)
-
getSegments
public static java.util.List<java.util.List<WaySegment>> getSegments(java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments, EastNorth n1, EastNorth n2)
Returns all the cells this segment crosses. Each cell contains the list of segments already processed- Parameters:
cellSegments- map with already collected way segmentsn1- The first EastNorthn2- The second EastNorth- Returns:
- A list with all the cells the segment crosses
-
getSegments
public static java.util.List<java.util.List<WaySegment>> getSegments(java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments, ILatLon n1, ILatLon n2)
Returns all the cells this segment crosses. Each cell contains the list of segments already processed- Parameters:
cellSegments- map with already collected way segmentsn1- The first EastNorthn2- The second EastNorth- Returns:
- A list with all the cells the segment crosses
- Since:
- 18553
-
findIntersectingWay
public static void findIntersectingWay(Way w, java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>> cellSegments, java.util.Map<java.util.List<Way>,java.util.List<WaySegment>> crossingWays, boolean findSharedWaySegments)
Find ways which are crossing without sharing a node.- Parameters:
w- way that is to be checkedcellSegments- map with already collected way segmentscrossingWays- map to collect crossing ways and related segmentsfindSharedWaySegments- true: find shared way segments instead of crossings
-
isSelfCrossing
public static boolean isSelfCrossing(Way way)
Check if the given way is self crossing- Parameters:
way- the way to check- Returns:
trueif one or more segments of the way are crossing- Since:
- 17393
- See Also:
SelfIntersectingWay
-
-