Changeset 9691 in josm for trunk/src/org


Ignore:
Timestamp:
2016-01-31T10:47:29+01:00 (9 years ago)
Author:
simon04
Message:

fix #12452 - icons in relation list display low priority icons

Prefer more specific presets w.r.t. the supported types

File:
1 edited

Legend:

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

    r9637 r9691  
    3434import java.util.Arrays;
    3535import java.util.Collection;
     36import java.util.Comparator;
    3637import java.util.HashMap;
    3738import java.util.Hashtable;
     
    4041import java.util.List;
    4142import java.util.Map;
     43import java.util.TreeSet;
    4244import java.util.concurrent.ExecutorService;
    4345import java.util.concurrent.Executors;
     
    13461348        // Check if the presets have icons for nodes/relations.
    13471349        if (!OsmPrimitiveType.WAY.equals(primitive.getType())) {
    1348             for (final TaggingPreset preset : TaggingPresets.getMatchingPresets(primitive)) {
     1350            final Collection<TaggingPreset> presets = new TreeSet<>(new Comparator<TaggingPreset>() {
     1351                @Override
     1352                public int compare(TaggingPreset o1, TaggingPreset o2) {
     1353                    final int o1TypesSize = o1.types == null || o1.types.isEmpty() ? Integer.MAX_VALUE : o1.types.size();
     1354                    final int o2TypesSize = o2.types == null || o2.types.isEmpty() ? Integer.MAX_VALUE : o2.types.size();
     1355                    return Integer.compare(o1TypesSize, o2TypesSize);
     1356                }
     1357            });
     1358            presets.addAll(TaggingPresets.getMatchingPresets(primitive));
     1359            for (final TaggingPreset preset : presets) {
    13491360                if (preset.getIcon() != null) {
    13501361                    return preset.getIcon();
Note: See TracChangeset for help on using the changeset viewer.