Changeset 11913 in josm for trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
- Timestamp:
- 2017-04-15T01:38:46+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r11807 r11913 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.HIGHWAY; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 77 78 if (n.isUsable()) { 78 79 if (!n.hasTag("crossing", "no") 79 && !(n.hasKey("crossing") && (n.hasTag("highway", "crossing") || n.hasTag("highway", "traffic_signals"))) 80 && !(n.hasKey("crossing") && (n.hasTag(HIGHWAY, "crossing") 81 || n.hasTag(HIGHWAY, "traffic_signals"))) 80 82 && n.isReferredByWays(2)) { 81 83 testMissingPedestrianCrossing(n); … … 92 94 public void visit(Way w) { 93 95 if (w.isUsable()) { 94 if (w.isClosed() && w.hasTag( "highway", CLASSIFIED_HIGHWAYS) && w.hasTag("junction", "roundabout")) {96 if (w.isClosed() && w.hasTag(HIGHWAY, CLASSIFIED_HIGHWAYS) && w.hasTag("junction", "roundabout")) { 95 97 // TODO: find out how to handle splitted roundabouts (see #12841) 96 98 testWrongRoundabout(w); … … 110 112 for (Node n : new HashSet<>(w.getNodes())) { 111 113 for (Way h : Utils.filteredCollection(n.getReferrers(), Way.class)) { 112 String value = h.get( "highway");114 String value = h.get(HIGHWAY); 113 115 if (h != w && value != null && !value.endsWith("_link")) { 114 116 List<Way> list = map.get(value); … … 130 132 if (list.size() > 2 || oneway1 == null || oneway2 == null || !oneway1 || !oneway2) { 131 133 // Error when the highway tags do not match 132 String value = w.get( "highway");134 String value = w.get(HIGHWAY); 133 135 if (!value.equals(s)) { 134 136 errors.add(TestError.builder(this, Severity.WARNING, WRONG_ROUNDABOUT_HIGHWAY) 135 137 .message(tr("Incorrect roundabout (highway: {0} instead of {1})", value, s)) 136 138 .primitives(w) 137 .fix(() -> new ChangePropertyCommand(w, "highway", s))139 .fix(() -> new ChangePropertyCommand(w, HIGHWAY, s)) 138 140 .build()); 139 141 } … … 145 147 146 148 public static boolean isHighwayLinkOkay(final Way way) { 147 final String highway = way.get( "highway");149 final String highway = way.get(HIGHWAY); 148 150 if (highway == null || !highway.endsWith("_link") 149 151 || !IN_DOWNLOADED_AREA.test(way.getNode(0)) || !IN_DOWNLOADED_AREA.test(way.getNode(way.getNodesCount()-1))) { … … 164 166 165 167 return Utils.filteredCollection(referrers, Way.class).stream().anyMatch( 166 otherWay -> !way.equals(otherWay) && otherWay.hasTag( "highway", highway, highway.replaceAll("_link$", "")));168 otherWay -> !way.equals(otherWay) && otherWay.hasTag(HIGHWAY, highway, highway.replaceAll("_link$", ""))); 167 169 } 168 170 … … 185 187 186 188 for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) { 187 String highway = w.get( "highway");189 String highway = w.get(HIGHWAY); 188 190 if (highway != null) { 189 191 if ("footway".equals(highway) || "path".equals(highway)) {
Note:
See TracChangeset
for help on using the changeset viewer.