Ignore:
Timestamp:
2012-11-18T13:57:36+01:00 (12 years ago)
Author:
bastiK
Message:

drop unnecessary properties for upload to the OSM API in order to save bandwidth

The properties are: user, uid, visible, action and timestamp. In addition drop lat & lon for deleted nodes. (To undelete a primitive, it suffices to include it in a <modify> section, the 'visible' property is ignored by the server.)

File:
1 edited

Legend:

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

    r5266 r5589  
    5555    public void init(DataSet ds) {
    5656        if (ds == null) return;
     57        init(ds.allPrimitives());
     58    }
     59
     60    public void init(Collection<OsmPrimitive> primitives) {
    5761        toAdd.clear();
    5862        toUpdate.clear();
    5963        toDelete.clear();
    6064
    61         for (OsmPrimitive osm :ds.allPrimitives()) {
     65        for (OsmPrimitive osm :primitives) {
    6266            if (osm.get("josm/ignore") != null) {
    6367                continue;
     
    140144    public APIDataSet(Collection<OsmPrimitive> primitives) {
    141145        this();
    142         toAdd.clear();
    143         toUpdate.clear();
    144         toDelete.clear();
    145         for (OsmPrimitive osm: primitives) {
    146             if (osm.isNewOrUndeleted() && !osm.isDeleted()) {
    147                 toAdd.addLast(osm);
    148             } else if (osm.isModified() && !osm.isDeleted()) {
    149                 toUpdate.addLast(osm);
    150             } else if (osm.isDeleted() && !osm.isNew() && osm.isModified() && osm.isVisible()) {
    151                 toDelete.addFirst(osm);
    152             }
    153         }
    154         OsmPrimitiveComparator c = new OsmPrimitiveComparator();
    155         c.relationsFirst = true;
    156         Collections.sort(toDelete, c);
    157         Collections.sort(toAdd, c);
    158         Collections.sort(toUpdate, c);
     146        init(primitives);
    159147    }
    160148
Note: See TracChangeset for help on using the changeset viewer.