Changeset 5350 in josm for trunk/src


Ignore:
Timestamp:
2012-07-19T00:52:15+02:00 (12 years ago)
Author:
Don-vip
Message:

see #7847 - Reset nodes/members to null when deleting a way/relation during a data set merge operation

File:
1 edited

Legend:

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

    r5298 r5350  
    188188                List<OsmPrimitive> referrers = target.getReferrers();
    189189                if (referrers.isEmpty()) {
     190                    resetPrimitive(target);
     191                    target.mergeFrom(source);
    190192                    target.setDeleted(true);
    191                     target.mergeFrom(source);
    192193                    it.remove();
    193194                    flag = true;
     
    212213            // This can be because of cross-referenced relations.
    213214            for (OsmPrimitive osm: objectsToDelete) {
    214                 if (osm instanceof Way) {
    215                     ((Way) osm).setNodes(null);
    216                 } else if (osm instanceof Relation) {
    217                     ((Relation) osm).setMembers(null);
    218                 }
     215                resetPrimitive(osm);
    219216            }
    220217            for (OsmPrimitive osm: objectsToDelete) {
     
    222219                osm.mergeFrom(sourceDataSet.getPrimitiveById(osm.getPrimitiveId()));
    223220            }
     221        }
     222    }
     223   
     224    private final void resetPrimitive(OsmPrimitive osm) {
     225        if (osm instanceof Way) {
     226            ((Way) osm).setNodes(null);
     227        } else if (osm instanceof Relation) {
     228            ((Relation) osm).setMembers(null);
    224229        }
    225230    }
Note: See TracChangeset for help on using the changeset viewer.