Changeset 6482 in josm
- Timestamp:
- 2013-12-17T01:52:59+01:00 (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r6475 r6482 10 10 import java.util.Iterator; 11 11 import java.util.List; 12 import java.util.Locale; 12 13 import java.util.Map; 13 14 … … 31 32 protected static final int WRONG_ROUNDABOUT_HIGHWAY = 2701; 32 33 protected static final int MISSING_PEDESTRIAN_CROSSING = 2702; 34 protected static final int SOURCE_MAXSPEED_UNKNOWN_COUNTRY_CODE = 2703; 35 protected static final int SOURCE_MAXSPEED_UNKNOWN_CONTEXT = 2704; 36 protected static final int SOURCE_MAXSPEED_CONTEXT_MISMATCH_VS_MAXSPEED = 2705; 37 protected static final int SOURCE_MAXSPEED_CONTEXT_MISMATCH_VS_HIGHWAY = 2706; 33 38 34 39 /** … … 45 50 "living_street"); 46 51 52 protected static final List<String> KNOWN_SOURCE_MAXSPEED_CONTEXTS = Arrays.asList( 53 "urban", "rural", "zone", "zone30", "zone:30", "nsl_single", "nsl_dual", "motorway", "trunk", "living_street"); 54 55 protected static final List<String> ISO_COUNTRIES = Arrays.asList(Locale.getISOCountries()); 56 47 57 boolean leftByPedestrians = false; 48 58 boolean leftByCyclists = false; … … 73 83 @Override 74 84 public void visit(Node n) { 75 if (n.isUsable() && !n.hasTag("highway", "crossing") && !n.hasTag("crossing", "no") && n.isReferredByWays(2)) { 76 testMissingPedestrianCrossing(n); 85 if (n.isUsable()) { 86 if (!n.hasTag("highway", "crossing") && !n.hasTag("crossing", "no") && n.isReferredByWays(2)) { 87 testMissingPedestrianCrossing(n); 88 } 89 if (n.hasKey("source:maxspeed")) { 90 // Check maxspeed but not context against highway for nodes as maxspeed is not set on highways here but on signs, speed cameras, etc. 91 testSourceMaxspeed(n, false); 92 } 77 93 } 78 94 } … … 80 96 @Override 81 97 public void visit(Way w) { 82 if (w.isUsable() && w.hasKey("highway") && w.hasKey("junction") && w.get("junction").equals("roundabout")) { 83 testWrongRoundabout(w); 98 if (w.isUsable()) { 99 if (w.hasKey("highway") && w.hasKey("junction") && w.get("junction").equals("roundabout")) { 100 testWrongRoundabout(w); 101 } 102 if (w.hasKey("source:maxspeed")) { 103 // Check maxspeed, including context against highway 104 testSourceMaxspeed(w, true); 105 } 84 106 } 85 107 } … … 173 195 } 174 196 } 197 198 private void testSourceMaxspeed(OsmPrimitive p, boolean testContextHighway) { 199 String value = p.get("source:maxspeed"); 200 if (value.matches("[A-Z]{2}:.+")) { 201 int index = value.indexOf(':'); 202 // Check country 203 String country = value.substring(0, index); 204 if (!ISO_COUNTRIES.contains(country)) { 205 errors.add(new TestError(this, Severity.WARNING, tr("Unknown country code: {0}", country), SOURCE_MAXSPEED_UNKNOWN_COUNTRY_CODE, p)); 206 } 207 // Check context 208 String context = value.substring(index+1); 209 if (!KNOWN_SOURCE_MAXSPEED_CONTEXTS.contains(context)) { 210 errors.add(new TestError(this, Severity.WARNING, tr("Unknown source:maxspeed context: {0}", context), SOURCE_MAXSPEED_UNKNOWN_CONTEXT, p)); 211 } 212 // TODO: Check coherence of context against maxspeed 213 // TODO: Check coherence of context against highway 214 } 215 } 175 216 176 217 @Override -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r6385 r6482 73 73 74 74 /** The default data files */ 75 public static final String DATA_FILE = "resource://data/ tagchecker.cfg";76 public static final String IGNORE_FILE = "resource://data/ ignoretags.cfg";77 public static final String SPELL_FILE = "resource://data/ words.cfg";75 public static final String DATA_FILE = "resource://data/validator/tagchecker.cfg"; 76 public static final String IGNORE_FILE = "resource://data/validator/ignoretags.cfg"; 77 public static final String SPELL_FILE = "resource://data/validator/words.cfg"; 78 78 79 79 /** The spell check key substitutions: the key should be substituted by the value */
Note:
See TracChangeset
for help on using the changeset viewer.