Changeset 6623 in josm for trunk/src/org/openstreetmap/josm/data/validation/tests
- Timestamp:
- 2014-01-04T06:39:00+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r6581 r6623 33 33 public abstract class CrossingWays extends Test { 34 34 protected static final int CROSSING_WAYS = 601; 35 36 private static final String HIGHWAY = "highway"; 37 private static final String RAILWAY = "railway"; 38 private static final String WATERWAY = "waterway"; 35 39 36 40 /** All way segments, grouped by cells */ … … 47 51 return super.isPrimitiveUsable(w) 48 52 && !isProposedOrAbandoned(w) 49 && (w.hasKey( "highway")50 || w.hasKey( "waterway")51 || (w.hasKey( "railway") && !isSubwayOrTram(w))53 && (w.hasKey(HIGHWAY) 54 || w.hasKey(WATERWAY) 55 || (w.hasKey(RAILWAY) && !isSubwayOrTram(w)) 52 56 || isCoastline(w) 53 57 || isBuilding(w)); … … 59 63 return true; 60 64 } 61 if (w1.hasKey( "highway") && w2.hasKey("highway") && !Utils.equal(w1.get("level"), w2.get("level"))) {65 if (w1.hasKey(HIGHWAY) && w2.hasKey(HIGHWAY) && !Utils.equal(w1.get("level"), w2.get("level"))) { 62 66 return true; 63 67 } … … 68 72 return true; 69 73 } 70 if ((w1.hasTag( "waterway", "river") && w2.hasTag("waterway", "riverbank"))71 || (w2.hasTag( "waterway", "river") && w1.hasTag("waterway", "riverbank"))) {74 if ((w1.hasTag(WATERWAY, "river") && w2.hasTag(WATERWAY, "riverbank")) 75 || (w2.hasTag(WATERWAY, "river") && w1.hasTag(WATERWAY, "riverbank"))) { 72 76 return true; 73 77 } … … 82 86 if (isBuilding(w1)) { 83 87 return ("Crossing buildings"); 84 } else if (w1.hasKey( "waterway") && w2.hasKey("waterway")) {88 } else if (w1.hasKey(WATERWAY) && w2.hasKey(WATERWAY)) { 85 89 return tr("Crossing waterways"); 86 } else if ((w1.hasKey( "highway") && w2.hasKey("waterway"))87 || (w2.hasKey( "highway") && w1.hasKey("waterway"))) {90 } else if ((w1.hasKey(HIGHWAY) && w2.hasKey(WATERWAY)) 91 || (w2.hasKey(HIGHWAY) && w1.hasKey(WATERWAY))) { 88 92 return tr("Crossing waterway/highway"); 89 93 } else { … … 207 211 208 212 static boolean isSubwayOrTram(OsmPrimitive w) { 209 return w.hasTag( "railway", "subway", "tram");213 return w.hasTag(RAILWAY, "subway", "tram"); 210 214 } 211 215 212 216 static boolean isProposedOrAbandoned(OsmPrimitive w) { 213 return w.hasTag( "highway", "proposed") || w.hasTag("railway", "proposed", "abandoned");217 return w.hasTag(HIGHWAY, "proposed") || w.hasTag(RAILWAY, "proposed", "abandoned"); 214 218 } 215 219 -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r6605 r6623 17 17 import org.openstreetmap.josm.Main; 18 18 import org.openstreetmap.josm.command.ChangePropertyCommand; 19 import org.openstreetmap.josm.data.osm.Node;20 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 import org.openstreetmap.josm.data.osm.Relation;22 import org.openstreetmap.josm.data.osm.Way;23 20 import org.openstreetmap.josm.data.validation.FixableTestError; 24 21 import org.openstreetmap.josm.data.validation.Severity; … … 194 191 return Collections.emptyList(); 195 192 } 193 final List<OpeningHoursTestError> errors = new ArrayList<OpeningHoursTestError>(); 196 194 try { 197 195 final Object r = parse(value, mode); 198 final List<OpeningHoursTestError> errors = new ArrayList<OpeningHoursTestError>();199 196 String prettifiedValue = null; 200 197 try { … … 212 209 errors.add(new OpeningHoursTestError(tr("opening_hours value can be prettified"), Severity.OTHER, prettifiedValue)); 213 210 } 214 return errors; 215 } catch (final Exception ex) { 216 throw new RuntimeException(ex); 217 } 211 } catch (ScriptException ex) { 212 Main.error(ex); 213 } catch (NoSuchMethodException ex) { 214 Main.error(ex); 215 } 216 return errors; 218 217 } 219 218
Note:
See TracChangeset
for help on using the changeset viewer.