Changeset 11608 in josm for trunk/src/org/openstreetmap/josm/data/validation
- Timestamp:
- 2017-02-25T03:14:20+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r11553 r11608 342 342 */ 343 343 protected static final boolean isBuilding(OsmPrimitive p) { 344 String v = p.get("building"); 345 return v != null && !"no".equals(v) && !"entrance".equals(v); 344 return p.hasTagDifferent("building", "no", "entrance"); 346 345 } 347 346 … … 357 356 Test test = (Test) obj; 358 357 return Objects.equals(name, test.name) && 359 358 Objects.equals(description, test.description); 360 359 } 361 360 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r11339 r11608 63 63 // warning level only if several relations have different names, see #10945 64 64 final String name = list.get(0).get("name"); 65 if (name == null || SubclassFilteredCollection.filter(list, r -> name.equals(r.get("name"))).size() < list.size()) {65 if (name == null || SubclassFilteredCollection.filter(list, r -> r.hasTag("name", name)).size() < list.size()) { 66 66 level = Severity.WARNING; 67 67 } else { … … 147 147 street.add((Way) p); 148 148 } 149 if (relationName != null && p.has Key("name") && !relationName.equals(p.get("name"))) {149 if (relationName != null && p.hasTagDifferent("name", relationName)) { 150 150 if (wrongStreetNames.isEmpty()) { 151 151 wrongStreetNames.add(r); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
r11129 r11608 251 251 252 252 private static boolean isCoastline(OsmPrimitive osm) { 253 return osm instanceof Way && "coastline" .equals(osm.get("natural"));253 return osm instanceof Way && osm.hasTag("natural", "coastline"); 254 254 } 255 255 -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r11587 r11608 241 241 242 242 static boolean isHighway(OsmPrimitive w) { 243 return w.has Key(HIGHWAY) && !w.hasTag(HIGHWAY, "rest_area", "services");243 return w.hasTagDifferent(HIGHWAY, "rest_area", "services"); 244 244 } 245 245 -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r11129 r11608 92 92 public void visit(Way w) { 93 93 if (w.isUsable()) { 94 if (w.isClosed() && w.hasKey("highway") && CLASSIFIED_HIGHWAYS.contains(w.get("highway")) 95 && w.hasKey("junction") && "roundabout".equals(w.get("junction"))) { 94 if (w.isClosed() && w.hasTag("highway", CLASSIFIED_HIGHWAYS) && w.hasTag("junction", "roundabout")) { 96 95 // TODO: find out how to handle splitted roundabouts (see #12841) 97 96 testWrongRoundabout(w); … … 131 130 if (list.size() > 2 || oneway1 == null || oneway2 == null || !oneway1 || !oneway2) { 132 131 // Error when the highway tags do not match 133 if (!w.get("highway").equals(s)) { 132 String value = w.get("highway"); 133 if (!value.equals(s)) { 134 134 errors.add(TestError.builder(this, Severity.WARNING, WRONG_ROUNDABOUT_HIGHWAY) 135 .message(tr("Incorrect roundabout (highway: {0} instead of {1})", w.get("highway"), s))135 .message(tr("Incorrect roundabout (highway: {0} instead of {1})", value, s)) 136 136 .primitives(w) 137 137 .fix(() -> new ChangePropertyCommand(w, "highway", s)) -
trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java
r11129 r11608 35 35 @Override 36 36 public void visit(Way w) { 37 if ( "ferry".equals(w.get("route"))) {37 if (w.hasTag("route", "ferry")) { 38 38 return; 39 39 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r11590 r11608 175 175 private void checkStyleConsistency(Relation r, Multipolygon polygon) { 176 176 ElemStyles styles = MapPaintStyles.getStyles(); 177 if (styles != null && !"boundary" .equals(r.get("type"))) {177 if (styles != null && !r.hasTag("type", "boundary")) { 178 178 AreaElement area = ElemStyles.getAreaElemStyle(r, false); 179 179 boolean areaStyle = area != null; -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r11129 r11608 90 90 91 91 for (WaySegment ws : duplicated) { 92 if (ws.way. get("highway")!= null) {92 if (ws.way.hasKey("highway")) { 93 93 highway++; 94 } else if (ws.way. get("railway")!= null) {94 } else if (ws.way.hasKey("railway")) { 95 95 railway++; 96 96 } … … 107 107 currentWays.add(ws.way); 108 108 } 109 /* These ways not seen before 110 * If two or more of the overlapping ways are 111 * highways or railways mark a separate error 112 */ 109 // These ways not seen before 110 // If two or more of the overlapping ways are highways or railways mark a separate error 113 111 if ((highlight = seenWays.get(currentWays)) == null) { 114 112 String errortype; -
trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
r11432 r11608 165 165 */ 166 166 private static boolean isPowerIn(OsmPrimitive p, Collection<String> values) { 167 String v = p.get("power"); 168 return v != null && values != null && values.contains(v); 167 return p.hasTag("power", values); 169 168 } 170 169 … … 176 175 */ 177 176 private static boolean isBuildingIn(OsmPrimitive p, Collection<String> values) { 178 String v = p.get("building"); 179 return v != null && values != null && values.contains(v); 177 return p.hasTag("building", values); 180 178 } 181 179 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java
r11129 r11608 48 48 @Override 49 49 public void visit(Relation r) { 50 if (!"restriction" .equals(r.get("type")))50 if (!r.hasTag("type", "restriction")) 51 51 return; 52 52 … … 224 224 225 225 private static boolean isFullOneway(Way w) { 226 return w.isOneway() != 0 && ! "no".equals(w.get("oneway:bicycle"));226 return w.isOneway() != 0 && !w.hasTag("oneway:bicycle", "no"); 227 227 } 228 228 -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r11587 r11608 306 306 this.isAbandoned = "abandoned".equals(railway) || w.isKeyTrue("disused"); 307 307 this.highway = (highway != null || railway != null) && !isAbandoned; 308 this.isBoundary = !this.highway && "administrative" .equals(w.get("boundary"));308 this.isBoundary = !this.highway && w.hasTag("boundary", "administrative"); 309 309 line = new Line2D.Double(n1.getEastNorth().east(), n1.getEastNorth().north(), 310 310 n2.getEastNorth().east(), n2.getEastNorth().north());
Note:
See TracChangeset
for help on using the changeset viewer.