Changeset 11176 in josm


Ignore:
Timestamp:
2016-10-27T00:32:49+02:00 (5 months ago)
Author:
simon04
Message:

fix #11010 - Wrong order of objects uploaded

Now the uploaded objects are sorted as follows:

  • added nodes
  • added ways
  • added relations
  • modified nodes
  • modified ways
  • modified relations
  • deleted relations
  • deleted ways
  • deleted nodes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/APIDataSet.java

    r11175 r11176  
    1616
    1717import org.openstreetmap.josm.actions.upload.CyclicUploadDependencyException;
    18 import org.openstreetmap.josm.data.conflict.Conflict;
    1918import org.openstreetmap.josm.data.conflict.ConflictCollection;
    2019import org.openstreetmap.josm.data.osm.DataSet;
     
    2221import org.openstreetmap.josm.data.osm.Node;
    2322import org.openstreetmap.josm.data.osm.OsmPrimitive;
    24 import org.openstreetmap.josm.data.osm.OsmPrimitiveComparator;
    2523import org.openstreetmap.josm.data.osm.PrimitiveId;
    2624import org.openstreetmap.josm.data.osm.Relation;
     
    7876            }
    7977        }
    80         OsmPrimitiveComparator c = new OsmPrimitiveComparator(false, true);
    81         toDelete.sort(c);
    82         toAdd.sort(c);
    83         toUpdate.sort(c);
     78        final Comparator<OsmPrimitive> orderingNodesWaysRelations = Comparator.comparingInt(osm -> osm.getType().ordinal());
     79        final Comparator<OsmPrimitive> byUniqueId = Comparator.comparing(OsmPrimitive::getUniqueId);
     80        toAdd.sort(orderingNodesWaysRelations.thenComparing(byUniqueId));
     81        toUpdate.sort(orderingNodesWaysRelations.thenComparing(byUniqueId));
     82        toDelete.sort(orderingNodesWaysRelations.reversed().thenComparing(byUniqueId));
    8483    }
    8584
Note: See TracChangeset for help on using the changeset viewer.