Changeset 8807 in josm
- Timestamp:
- 2015-09-29T21:17:43+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r8805 r8807 63 63 import org.openstreetmap.josm.data.osm.Node; 64 64 import org.openstreetmap.josm.data.osm.OsmPrimitive; 65 import org.openstreetmap.josm.data.osm.OsmPrimitiveComparator; 65 66 import org.openstreetmap.josm.data.osm.Relation; 66 67 import org.openstreetmap.josm.data.osm.Way; … … 560 561 561 562 private static void waysToGpxData(Collection<Way> ways, GpxData gpxData, Set<Node> doneNodes) { 562 for (Way w : ways) { 563 /* When the dataset has been obtained from a gpx layer and now is being converted back, 564 * the ways have negative ids. The first created way corresponds to the first gpx segment, 565 * and has the highest id (i.e., closest to zero). 566 * Thus, sorting by OsmPrimitive#getUniqueId gives the original order. 567 * (Only works if the data layer has not been saved to and been loaded from an osm file before.) 568 */ 569 final List<Way> sortedWays = new ArrayList<>(ways); 570 Collections.sort(sortedWays, new OsmPrimitiveComparator(true, false)); // sort by OsmPrimitive#getUniqueId ascending 571 Collections.reverse(sortedWays); // sort by OsmPrimitive#getUniqueId descending 572 for (Way w : sortedWays) { 563 573 if (!w.isUsable()) { 564 574 continue;
Note:
See TracChangeset
for help on using the changeset viewer.