Changeset 17289 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-11-02T09:04:47+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java
r16771 r17289 14 14 import java.util.regex.Matcher; 15 15 import java.util.regex.Pattern; 16 import java.util.stream.Collectors; 16 17 17 18 import org.openstreetmap.josm.command.Command; … … 25 26 import org.openstreetmap.josm.data.osm.RelationMember; 26 27 import org.openstreetmap.josm.data.osm.Tag; 27 import org.openstreetmap.josm.data.osm.TagCollection;28 28 import org.openstreetmap.josm.data.osm.Tagged; 29 29 import org.openstreetmap.josm.data.osm.Way; … … 174 174 * Tests whether way can be reversed without semantic change, i.e., whether tags have to be changed. 175 175 * Looks for keys like oneway, oneway:bicycle, cycleway:right:oneway, left/right. 176 * Also tests the nodes, e.g. a highway=stop with direction, see #20013. 176 177 * @param way way to test 177 178 * @return false if tags should be changed to keep semantic, true otherwise. 178 179 */ 179 180 public static boolean isReversible(Way way) { 180 for (Tag tag : TagCollection.from(way)) { 181 if (!tag.equals(TagSwitcher.apply(tag))) { 182 return false; 183 } 184 } 185 return true; 181 return getTagCorrectionsMap(way).isEmpty(); 186 182 } 187 183 … … 193 189 */ 194 190 public static List<Way> irreversibleWays(List<Way> ways) { 195 List<Way> newWays = new ArrayList<>(ways); 196 for (Way way : ways) { 197 if (isReversible(way)) { 198 newWays.remove(way); 199 } 200 } 201 return newWays; 191 return ways.stream().filter(w -> !isReversible(w)).collect(Collectors.toList()); 202 192 } 203 193
Note:
See TracChangeset
for help on using the changeset viewer.