Changeset 3033 in josm for trunk/src


Ignore:
Timestamp:
2010-02-21T13:22:06+01:00 (10 years ago)
Author:
jttt
Message:

Fix #4572 after update data - way contains deleted member

File:
1 edited

Legend:

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

    r2990 r3033  
    33import static org.openstreetmap.josm.tools.I18n.tr;
    44
     5import java.util.ArrayList;
    56import java.util.Collection;
    67import java.util.HashMap;
     
    216217            throw new IllegalStateException(tr("Missing merge target for way with id {0}", source.getUniqueId()));
    217218
    218         List<Node> newNodes = new LinkedList<Node>();
     219        List<Node> newNodes = new ArrayList<Node>(source.getNodesCount());
    219220        for (Node sourceNode : source.getNodes()) {
    220221            Node targetNode = (Node)getMergeTarget(sourceNode);
     
    222223                if (targetNode.isVisible()) {
    223224                    newNodes.add(targetNode);
     225                    if (targetNode.isDeleted() && !conflicts.hasConflictForMy(targetNode)) {
     226                        conflicts.add(targetNode, sourceNode);
     227                    }
    224228                } else {
    225229                    target.setModified(true);
     
    250254                RelationMember newMember = new RelationMember(sourceMember.getRole(), targetMember);
    251255                newMembers.add(newMember);
     256                if (targetMember.isDeleted() && !conflicts.hasConflictForMy(targetMember)) {
     257                    conflicts.add(targetMember, sourceMember.getMember());
     258                }
    252259            } else {
    253260                target.setModified(true);
     
    309316            // otherwise too many conflicts when refreshing from the server
    310317            // but, if source has a referrer that is not in the target dataset there is a conflict
     318            // If target dataset refers to the deleted primitive, conflict will be added in fixReferences method
    311319            for (OsmPrimitive referrer: source.getReferrers()) {
    312320                if (targetDataSet.getPrimitiveById(referrer.getPrimitiveId()) == null) {
Note: See TracChangeset for help on using the changeset viewer.