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


Ignore:
Timestamp:
2020-04-18T10:52:42+02:00 (5 years ago)
Author:
simon04
Message:

fix #19112, see #18164 - OverpassTurboQueryWizard: use OsmPrimitiveType.getAPIName

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java

    r16264 r16336  
    1212import java.util.regex.Pattern;
    1313import java.util.stream.Collectors;
     14import java.util.stream.Stream;
    1415
    1516import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    8990            final EnumSet<OsmPrimitiveType> types = EnumSet.noneOf(OsmPrimitiveType.class);
    9091            final String query = constructQuery(conjunction, types);
    91             for (Object type : types.isEmpty() || types.size() == 3 ? Collections.singleton("nwr") : types) {
    92                 queryLines.add("  " + type + query + queryLineSuffix + ";");
    93             }
     92            final Stream<String> typeStream = types.isEmpty() || types.size() == 3
     93                    ? Stream.of("nwr")
     94                    : types.stream().map(OsmPrimitiveType::getAPIName);
     95            typeStream.forEach(type -> queryLines.add("  " + type + query + queryLineSuffix + ";"));
    9496        }
    9597        queryLines.add(");");
Note: See TracChangeset for help on using the changeset viewer.