- Timestamp:
- 2017-03-05T01:10:20+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveComparator.java
r11177 r11680 69 69 } 70 70 71 /** 72 * Returns a comparator ordering the primitives by type in the order RELATION, WAY, NODE 73 * 74 * @return a comparator ordering the primitives by type in the order RELATION, WAY, NODE 75 * @since 11679 76 */ 77 public static Comparator<OsmPrimitive> orderingRelationsWaysNodes() { 78 return comparingInt(osm -> { 79 switch (osm.getType()) { 80 case RELATION: 81 return 1; 82 case WAY: 83 return 2; 84 case NODE: 85 return 3; 86 default: 87 throw new IllegalStateException(); 88 } 89 }); 90 } 91 71 92 private static <T, R> Function<T, R> memoize(Function<T, R> base) { 72 93 final Map<T, R> cache = new HashMap<>(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r11386 r11680 17 17 import java.util.Collection; 18 18 import java.util.Collections; 19 import java.util.Comparator; 19 20 import java.util.HashSet; 20 21 import java.util.Iterator; … … 660 661 if (selection.size() <= Main.pref.getInteger("selection.no_sort_above", 100_000)) { 661 662 boolean quick = selection.size() > Main.pref.getInteger("selection.fast_sort_above", 10_000); 662 selection.sort(OsmPrimitiveComparator.orderingWaysRelationsNodes().thenComparing(quick 663 Comparator<OsmPrimitive> c = Main.pref.getBoolean("selection.sort_relations_before_ways", true) 664 ? OsmPrimitiveComparator.orderingRelationsWaysNodes() 665 : OsmPrimitiveComparator.orderingWaysRelationsNodes(); 666 selection.sort(c.thenComparing(quick 663 667 ? OsmPrimitiveComparator.comparingUniqueId() 664 668 : OsmPrimitiveComparator.comparingNames()));
Note:
See TracChangeset
for help on using the changeset viewer.