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 class
CrossingWays.Boundaries
Crossing boundaries ways test.(package private) static class
CrossingWays.MessageHelper
static class
CrossingWays.SelfCrossing
Self crossing ways test (for all ways)static class
CrossingWays.Ways
General crossing ways test.private static class
CrossingWays.WayType
Type 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.String
BARRIER
private java.util.Map<java.awt.geom.Point2D,java.util.List<WaySegment>>
cellSegments
All way segments, grouped by cellsprotected int
code
(package private) static java.lang.String
HIGHWAY
(package private) static java.lang.String
LANDUSE
(package private) static java.lang.String
RAILWAY
private java.util.Map<java.util.List<Way>,java.util.List<WaySegment>>
seenWays
The already detected ways in error(package private) static java.lang.String
WATERWAY
private 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 protected
CrossingWays(java.lang.String title, int code)
Constructs a newCrossingWays
test.
-
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 boolean
areLayerOrLevelDifferent(Way w1, Way w2)
(package private) CrossingWays.MessageHelper
createMessage(Way w1, Way w2)
void
endTest()
Notification of the end of the test.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.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 boolean
ignoreWaySegmentCombination(Way w1, Way w2)
(package private) static boolean
isCoastline(OsmPrimitive w)
(package private) static boolean
isHighway(OsmPrimitive w)
(package private) static boolean
isProposedOrAbandoned(OsmPrimitive w)
(package private) static boolean
isRailway(OsmPrimitive w)
static boolean
isSelfCrossing(Way way)
Check if the given way is self crossing(package private) static boolean
isSubwayOrTramOrRazed(OsmPrimitive w)
(package private) static boolean
isWaterArea(OsmPrimitive w)
protected void
runTest()
void
startTest(ProgressMonitor monitor)
Start the test using a given progress monitorprivate void
testWay(Way w)
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, 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 newCrossingWays
test.- Parameters:
title
- The test titlecode
- The test code- Since:
- 12958
-
-
Method Detail
-
startTest
public void startTest(ProgressMonitor monitor)
Description copied from class:Test
Start the test using a given progress monitor
-
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).
-
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:OsmPrimitiveVisitor
Visiting call for lines.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in 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:
true
if one or more segments of the way are crossing- Since:
- 17393
- See Also:
SelfIntersectingWay
-
-