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 intBWprotected static intCONNECTIVITY_IMPLIEDprivate static java.lang.StringCONNECTIVITY_TAGprivate static java.lang.StringFROMprotected static intINCONSISTENT_LANE_COUNTprivate static java.util.regex.PatternLANE_TAG_PATTERNprotected static intMALFORMED_CONNECTIVITY_TAGprotected static intMEMBER_MISSING_LANESprotected static intMISSING_COMMA_CONNECTIVITY_TAGprivate static java.util.regex.PatternMISSING_COMMA_PATTERNprotected static intMISSING_ROLEprotected static intNO_CONNECTIVITY_TAGprivate static java.util.regex.PatternOPTIONAL_LANE_PATTERNprivate static java.lang.StringTOprivate static java.util.regex.PatternTO_LANE_PATTERNprotected static intTOO_MANY_ROLESprotected static intUNKNOWN_CONNECTIVITY_ROLEprivate static java.lang.StringVIA-
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 booleancheckForBadRole(Relation relation)Check if the roles of the relation are appropriateprivate voidcheckForImpliedConnectivity(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 theconnectivitytag of the relationprivate static booleancheckForIntersectionAtMembers(Relation relation)Check to see if there is an intersection present at the via memberprivate static booleancheckForMissingRole(Relation relation)Check if the relation contains all necessary rolesprivate static booleancheckMemberTagsForImpliedConnectivity(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 booleanmixedViaNodeAndWay(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 valuesvoidvisit(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 aconnectivitytag.- Returns:
- A Map in the form of
Map<Lane From, Map<Lane To, Optional>>May contain nulls when errors are encountered, empty collection ifconnectivitytag contains unusual values
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitorVisiting call for relations.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin 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 theconnectivitytag of the relation- Parameters:
relation- A relation with aconnectivitytag.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 aconnectivitytag.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 aconnectivitytag.- 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 aconnectivitytag.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 aconnectivitytag.- 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 aconnectivitytag.- Returns:
- Whether the relation is missing one or more of the critical
from,via, ortoroles
-
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 aconnectivitytag.viaWays- The number of ways in the relation with theviaroleviaNodes- The number of nodes in the relation with theviarole- Returns:
- Whether the relation is missing one or more of the critical 'from', 'via', or 'to' roles
-
-