public class RelationChecker extends Test implements TaggingPresetListener
Modifier and Type | Class and Description |
---|---|
private static class |
RelationChecker.RoleInfo |
Test.TagTest
Modifier and Type | Field and Description |
---|---|
static int |
HIGH_COUNT
Number of ''{0}'' roles too high ({1})
|
private boolean |
ignoreMultiPolygons |
private boolean |
ignoreTurnRestrictions |
static int |
LOW_COUNT
Number of ''{0}'' roles too low ({1})
|
static int |
RELATION_EMPTY
Relation is empty
|
static int |
RELATION_UNKNOWN
Relation type is unknown
|
private static java.util.Collection<TaggingPreset> |
relationpresets |
static int |
ROLE_EMPTY
Empty role found when expecting one of ''{0}''
|
static int |
ROLE_MISSING
Role ''{0}'' missing
|
static int |
ROLE_UNKNOWN
Role ''{0}'' is not in templates ''{1}''
|
static java.lang.String |
ROLE_VERIF_PROBLEM_MSG
Error message used to group errors related to role problems.
|
static int |
WRONG_ROLE
Role of relation member does not match template expression ''{0}'' in preset {1}
|
static int |
WRONG_TYPE
Type ''{0}'' of relation member with role ''{1}'' does not match accepted types ''{2}'' in preset {3}
|
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, startTime, testBeforeUpload
Constructor and Description |
---|
RelationChecker()
Constructor
|
Modifier and Type | Method and Description |
---|---|
private static java.util.Map<Roles.Role,java.lang.String> |
buildAllRoles(Relation n) |
private static java.util.Map<java.lang.String,RelationChecker.RoleInfo> |
buildRoleInfoMap(Relation n) |
private boolean |
checkMemberExpressionAndType(java.util.Map<Roles.Role,java.lang.String> allroles,
RelationMember member,
Relation n)
get all role definition for specified key and check, if some definition matches
|
private static boolean |
checkMemberType(Roles.Role r,
RelationMember member) |
private void |
checkRoleCounts(Relation n,
Roles.Role r,
java.lang.String keyname,
RelationChecker.RoleInfo ri) |
private void |
checkRoles(Relation n,
java.util.Map<Roles.Role,java.lang.String> allroles,
java.util.Map<java.lang.String,RelationChecker.RoleInfo> map) |
Command |
fixError(TestError testError)
Fixes the error with the appropriate command
|
void |
initialize()
Initializes any global data used this tester.
|
static void |
initializePresets()
Reads the presets data.
|
boolean |
isFixable(TestError testError)
Returns true if the given error can be fixed automatically
|
void |
startTest(ProgressMonitor progressMonitor)
Start the test using a given progress monitor
|
void |
taggingPresetsModified()
Called after list of tagging presets has been modified.
|
void |
visit(Relation n)
Visiting call for relations.
|
addGui, clear, deletePrimitivesIfNeeded, endTest, getErrors, getName, isBuilding, isCanceled, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit, visit
public static final int ROLE_UNKNOWN
public static final int ROLE_EMPTY
public static final int WRONG_ROLE
public static final int HIGH_COUNT
public static final int LOW_COUNT
public static final int ROLE_MISSING
public static final int RELATION_UNKNOWN
public static final int RELATION_EMPTY
public static final int WRONG_TYPE
public static final java.lang.String ROLE_VERIF_PROBLEM_MSG
private boolean ignoreMultiPolygons
private boolean ignoreTurnRestrictions
private static final java.util.Collection<TaggingPreset> relationpresets
public RelationChecker()
public void initialize()
Test
initialize
in class Test
public static void initializePresets()
public void startTest(ProgressMonitor progressMonitor)
Test
public void visit(Relation n)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
visit
in class Test
n
- The relation to inspect.private static java.util.Map<java.lang.String,RelationChecker.RoleInfo> buildRoleInfoMap(Relation n)
private static java.util.Map<Roles.Role,java.lang.String> buildAllRoles(Relation n)
private static boolean checkMemberType(Roles.Role r, RelationMember member)
private boolean checkMemberExpressionAndType(java.util.Map<Roles.Role,java.lang.String> allroles, RelationMember member, Relation n)
allroles
- containing list of possible role presets of the membermember
- to be verifiedn
- relation to be verifiedtrue
if member passed any of definition within presetprivate void checkRoles(Relation n, java.util.Map<Roles.Role,java.lang.String> allroles, java.util.Map<java.lang.String,RelationChecker.RoleInfo> map)
n
- relation to validateallroles
- contains presets for specified relationmap
- contains statistics of occurrences of specified role in relationprivate void checkRoleCounts(Relation n, Roles.Role r, java.lang.String keyname, RelationChecker.RoleInfo ri)
public Command fixError(TestError testError)
Test
public boolean isFixable(TestError testError)
Test
public void taggingPresetsModified()
TaggingPresetListener
taggingPresetsModified
in interface TaggingPresetListener