- Timestamp:
- 2014-01-19T17:04:24+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r6731 r6735 174 174 } 175 175 if (ri != null) { 176 Set<OsmPrimitive> wrongTypes = new HashSet<OsmPrimitive>();177 176 if (r.types != null) { 177 Set<OsmPrimitive> wrongTypes = new HashSet<OsmPrimitive>(); 178 178 if (!r.types.contains(TaggingPresetType.WAY)) { 179 179 wrongTypes.addAll(r.types.contains(TaggingPresetType.CLOSEDWAY) ? ri.openways : ri.ways); … … 185 185 wrongTypes.addAll(ri.relations); 186 186 } 187 if (!wrongTypes.isEmpty()) { 188 String s = marktr("Member for role {0} of wrong type"); 189 LinkedList<OsmPrimitive> highlight = new LinkedList<OsmPrimitive>(wrongTypes); 190 highlight.addFirst(n); 191 errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG, 192 tr(s, keyname), MessageFormat.format(s, keyname), WRONG_TYPE, 193 highlight, wrongTypes)); 194 } 187 195 } 188 196 if (r.memberExpression != null) { 197 Set<OsmPrimitive> notMatching = new HashSet<OsmPrimitive>(); 189 198 for (Collection<OsmPrimitive> c : Arrays.asList(new Collection[]{ri.nodes, ri.ways, ri.relations})) { 190 199 for (OsmPrimitive p : c) { 191 200 if (p.isUsable() && !r.memberExpression.match(p)) { 192 wrongTypes.add(p);201 notMatching.add(p); 193 202 } 194 203 } 195 204 } 196 }197 if (!wrongTypes.isEmpty()) {198 String s = marktr("Member for role {0} of wrong type");199 LinkedList<OsmPrimitive> highlight = new LinkedList<OsmPrimitive>(wrongTypes);200 highlight.addFirst(n);201 errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,202 tr(s, keyname), MessageFormat.format(s, keyname), WRONG_TYPE,203 highlight, wrongTypes));205 if (!notMatching.isEmpty()) { 206 String s = marktr("Member for role ''{0}'' does not match ''{1}''"); 207 LinkedList<OsmPrimitive> highlight = new LinkedList<OsmPrimitive>(notMatching); 208 highlight.addFirst(n); 209 errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG, 210 tr(s, keyname, r.memberExpression), MessageFormat.format(s, keyname, r.memberExpression), WRONG_TYPE, 211 highlight, notMatching)); 212 } 204 213 } 205 214 }
Note:
See TracChangeset
for help on using the changeset viewer.