Class ConnectivityRelations
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.ConnectivityRelations
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class ConnectivityRelations extends Test
Check for inconsistencies in lane information between relation and members.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BW
protected static int
CONNECTIVITY_IMPLIED
private static java.lang.String
CONNECTIVITY_TAG
private static java.lang.String
FROM
protected static int
INCONSISTENT_LANE_COUNT
private static java.util.regex.Pattern
LANE_TAG_PATTERN
protected static int
MALFORMED_CONNECTIVITY_TAG
protected static int
MEMBER_MISSING_LANES
protected static int
MISSING_COMMA_CONNECTIVITY_TAG
private static java.util.regex.Pattern
MISSING_COMMA_PATTERN
protected static int
MISSING_ROLE
protected static int
NO_CONNECTIVITY_TAG
private static java.util.regex.Pattern
OPTIONAL_LANE_PATTERN
private static java.lang.String
TO
private static java.util.regex.Pattern
TO_LANE_PATTERN
protected static int
TOO_MANY_ROLES
protected static int
UNKNOWN_CONNECTIVITY_ROLE
private static java.lang.String
VIA
-
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 Constructor Description ConnectivityRelations()
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
checkForBadRole(Relation relation)
Check if the roles of the relation are appropriateprivate void
checkForImpliedConnectivity(Relation relation, java.util.Map<java.lang.String,java.lang.Integer> roleLanes, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Boolean>> connTagLanes)
Check the relation to see if the connectivity described is already implied by other dataprivate java.util.Map<java.lang.String,java.lang.Integer>
checkForInconsistentLanes(Relation relation, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Boolean>> connTagLanes)
Compare lane tags of members to values in theconnectivity
tag of the relationprivate static boolean
checkForIntersectionAtMembers(Relation relation)
Check to see if there is an intersection present at the via memberprivate static boolean
checkForMissingRole(Relation relation)
Check if the relation contains all necessary rolesprivate static boolean
checkMemberTagsForImpliedConnectivity(Relation relation, java.util.Map<java.lang.String,java.lang.Integer> roleLanes)
Check the relation to see if the connectivity described is already implied by the relation members' tagsprivate boolean
mixedViaNodeAndWay(Relation relation, int viaWays, int viaNodes)
Check if the relation's roles are on appropriate objectsstatic java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Boolean>>
parseConnectivityTag(Relation relation)
Convert the connectivity tag into a map of valuesvoid
visit(Relation r)
Visiting call for relations.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, endTest, fixError, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, startTest, testBeforeUpload, visit, visit, visit
-
-
-
-
Field Detail
-
INCONSISTENT_LANE_COUNT
protected static final int INCONSISTENT_LANE_COUNT
- See Also:
- Constant Field Values
-
UNKNOWN_CONNECTIVITY_ROLE
protected static final int UNKNOWN_CONNECTIVITY_ROLE
- See Also:
- Constant Field Values
-
NO_CONNECTIVITY_TAG
protected static final int NO_CONNECTIVITY_TAG
- See Also:
- Constant Field Values
-
MALFORMED_CONNECTIVITY_TAG
protected static final int MALFORMED_CONNECTIVITY_TAG
- See Also:
- Constant Field Values
-
MISSING_COMMA_CONNECTIVITY_TAG
protected static final int MISSING_COMMA_CONNECTIVITY_TAG
- See Also:
- Constant Field Values
-
TOO_MANY_ROLES
protected static final int TOO_MANY_ROLES
- See Also:
- Constant Field Values
-
MISSING_ROLE
protected static final int MISSING_ROLE
- See Also:
- Constant Field Values
-
MEMBER_MISSING_LANES
protected static final int MEMBER_MISSING_LANES
- See Also:
- Constant Field Values
-
CONNECTIVITY_IMPLIED
protected static final int CONNECTIVITY_IMPLIED
- See Also:
- Constant Field Values
-
CONNECTIVITY_TAG
private static final java.lang.String CONNECTIVITY_TAG
- See Also:
- Constant Field Values
-
VIA
private static final java.lang.String VIA
- See Also:
- Constant Field Values
-
TO
private static final java.lang.String TO
- See Also:
- Constant Field Values
-
FROM
private static final java.lang.String FROM
- See Also:
- Constant Field Values
-
BW
private static final int BW
- See Also:
- Constant Field Values
-
OPTIONAL_LANE_PATTERN
private static final java.util.regex.Pattern OPTIONAL_LANE_PATTERN
-
TO_LANE_PATTERN
private static final java.util.regex.Pattern TO_LANE_PATTERN
-
MISSING_COMMA_PATTERN
private static final java.util.regex.Pattern MISSING_COMMA_PATTERN
-
LANE_TAG_PATTERN
private static final java.util.regex.Pattern LANE_TAG_PATTERN
-
-
Constructor Detail
-
ConnectivityRelations
public ConnectivityRelations()
Constructor
-
-
Method Detail
-
parseConnectivityTag
public static java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Boolean>> parseConnectivityTag(Relation relation)
Convert the connectivity tag into a map of values- Parameters:
relation
- A relation with aconnectivity
tag.- Returns:
- A Map in the form of
Map<Lane From, Map<Lane To, Optional>>
May contain nulls when errors are encountered, empty collection ifconnectivity
tag contains unusual values
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for relations.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
r
- The relation to inspect.
-
checkForInconsistentLanes
private java.util.Map<java.lang.String,java.lang.Integer> checkForInconsistentLanes(Relation relation, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Boolean>> connTagLanes)
Compare lane tags of members to values in theconnectivity
tag of the relation- Parameters:
relation
- A relation with aconnectivity
tag.connTagLanes
- result ofparseConnectivityTag(Relation)
- Returns:
- A Map in the form of
Map<Role, Lane Count>
-
checkForImpliedConnectivity
private void checkForImpliedConnectivity(Relation relation, java.util.Map<java.lang.String,java.lang.Integer> roleLanes, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Boolean>> connTagLanes)
Check the relation to see if the connectivity described is already implied by other data- Parameters:
relation
- A relation with aconnectivity
tag.roleLanes
- The lane counts for each relation roleconnTagLanes
- result ofparseConnectivityTag(Relation)
-
checkForIntersectionAtMembers
private static boolean checkForIntersectionAtMembers(Relation relation)
Check to see if there is an intersection present at the via member- Parameters:
relation
- A relation with aconnectivity
tag.- Returns:
- A Boolean that indicates whether an intersection is present at the via member
-
checkMemberTagsForImpliedConnectivity
private static boolean checkMemberTagsForImpliedConnectivity(Relation relation, java.util.Map<java.lang.String,java.lang.Integer> roleLanes)
Check the relation to see if the connectivity described is already implied by the relation members' tags- Parameters:
relation
- A relation with aconnectivity
tag.roleLanes
- The lane counts for each relation role- Returns:
- Whether connectivity is already implied by tags on relation members
-
checkForBadRole
private boolean checkForBadRole(Relation relation)
Check if the roles of the relation are appropriate- Parameters:
relation
- A relation with aconnectivity
tag.- Returns:
- Whether one or more of the relation's members has an unusual role
-
checkForMissingRole
private static boolean checkForMissingRole(Relation relation)
Check if the relation contains all necessary roles- Parameters:
relation
- A relation with aconnectivity
tag.- Returns:
- Whether the relation is missing one or more of the critical
from
,via
, orto
roles
-
mixedViaNodeAndWay
private boolean mixedViaNodeAndWay(Relation relation, int viaWays, int viaNodes)
Check if the relation's roles are on appropriate objects- Parameters:
relation
- A relation with aconnectivity
tag.viaWays
- The number of ways in the relation with thevia
roleviaNodes
- The number of nodes in the relation with thevia
role- Returns:
- Whether the relation is missing one or more of the critical 'from', 'via', or 'to' roles
-
-