Changeset 17289 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2020-11-02T09:04:47+01:00 (3 years ago)
Author:
GerdP
Message:

fix #20013: When combining two ways and one of them needs to have the direction changed then JOSM doesn't consider effects on stop and give way signs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java

    r16771 r17289  
    1414import java.util.regex.Matcher;
    1515import java.util.regex.Pattern;
     16import java.util.stream.Collectors;
    1617
    1718import org.openstreetmap.josm.command.Command;
     
    2526import org.openstreetmap.josm.data.osm.RelationMember;
    2627import org.openstreetmap.josm.data.osm.Tag;
    27 import org.openstreetmap.josm.data.osm.TagCollection;
    2828import org.openstreetmap.josm.data.osm.Tagged;
    2929import org.openstreetmap.josm.data.osm.Way;
     
    174174     * Tests whether way can be reversed without semantic change, i.e., whether tags have to be changed.
    175175     * 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.
    176177     * @param way way to test
    177178     * @return false if tags should be changed to keep semantic, true otherwise.
    178179     */
    179180    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();
    186182    }
    187183
     
    193189     */
    194190    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());
    202192    }
    203193
Note: See TracChangeset for help on using the changeset viewer.