Changeset 8941 in josm for trunk/src/org/openstreetmap/josm/data/validation
- Timestamp:
- 2015-10-24T21:32:35+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r8840 r8941 20 20 import org.openstreetmap.josm.data.osm.OsmUtils; 21 21 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm.data.validation.FixableTestError; 22 23 import org.openstreetmap.josm.data.validation.Severity; 23 24 import org.openstreetmap.josm.data.validation.Test; … … 39 40 protected static final int SOURCE_MAXSPEED_CONTEXT_MISMATCH_VS_HIGHWAY = 2706; 40 41 protected static final int SOURCE_WRONG_LINK = 2707; 42 43 protected static final String SOURCE_MAXSPEED = "source:maxspeed"; 41 44 42 45 /** … … 92 95 testMissingPedestrianCrossing(n); 93 96 } 94 if (n.hasKey( "source:maxspeed")) {97 if (n.hasKey(SOURCE_MAXSPEED)) { 95 98 // Check maxspeed but not context against highway for nodes 96 99 // as maxspeed is not set on highways here but on signs, speed cameras, etc. … … 107 110 testWrongRoundabout(w); 108 111 } 109 if (w.hasKey( "source:maxspeed")) {112 if (w.hasKey(SOURCE_MAXSPEED)) { 110 113 // Check maxspeed, including context against highway 111 114 testSourceMaxspeed(w, true); … … 240 243 241 244 private void testSourceMaxspeed(OsmPrimitive p, boolean testContextHighway) { 242 String value = p.get( "source:maxspeed");245 String value = p.get(SOURCE_MAXSPEED); 243 246 if (value.matches("[A-Z]{2}:.+")) { 244 247 int index = value.indexOf(':'); … … 246 249 String country = value.substring(0, index); 247 250 if (!ISO_COUNTRIES.contains(country)) { 248 errors.add(new TestError(this, Severity.WARNING, 249 tr("Unknown country code: {0}", country), SOURCE_MAXSPEED_UNKNOWN_COUNTRY_CODE, p)); 251 if ("UK".equals(country)) { 252 errors.add(new FixableTestError(this, Severity.WARNING, 253 tr("Unknown country code: {0}", country), SOURCE_MAXSPEED_UNKNOWN_COUNTRY_CODE, p, 254 new ChangePropertyCommand(p, SOURCE_MAXSPEED, value.replace("UK:", "GB:")))); 255 } else { 256 errors.add(new TestError(this, Severity.WARNING, 257 tr("Unknown country code: {0}", country), SOURCE_MAXSPEED_UNKNOWN_COUNTRY_CODE, p)); 258 } 250 259 } 251 260 // Check context
Note:
See TracChangeset
for help on using the changeset viewer.