Ignore:
Timestamp:
2009-06-23T22:03:37+02:00 (11 years ago)
Author:
Gubaer
Message:

new: MultiFetchServerObjectReader using APIs Multi Fetch method
update: now uses Multi Fetch to check for deleted primitives on the server
update: now uses Multi Fetch to update the selected primitives with the state from the server
fixed: cleaned up merging in MergeVisitor
new: conflict resolution dialog; now resolves conflicts due to different visibilities
new: replacement for realEqual() on OsmPrimitive and derived classes; realEqual now @deprecated
fixed: cleaning up OsmReader
fixed: progress indication in OsmApi

Location:
trunk/src/org/openstreetmap/josm/command
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java

    r1654 r1690  
    6666
    6767        if (decision.equals(MergeDecisionType.KEEP_MINE)) {
    68             // do nothing
     68            if (my.deleted) {
     69                // because my was involved in a conflict it my still be referred
     70                // to from a way or a relation. Fix this now.
     71                //
     72                Main.main.editLayer().data.unlinkReferencesToPrimitive(my);
     73            }
    6974        } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) {
    70             my.deleted = their.deleted;
     75            if (their.deleted) {
     76                Main.main.editLayer().data.unlinkReferencesToPrimitive(my);
     77                my.delete(true);
     78            } else {
     79                my.deleted = their.deleted;
     80            }
    7181        } else
    7282            // should not happen
  • trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java

    r1670 r1690  
    66import java.util.ArrayList;
    77import java.util.Collection;
     8import java.util.HashMap;
    89import java.util.List;
     10import java.util.Map;
    911
    1012import javax.swing.JLabel;
     
    3335 */
    3436public class PurgePrimitivesCommand extends Command{
     37
    3538
    3639    /**
     
    141144    private ArrayList<OsmParentChildPair> pairs;
    142145
     146    private Map<OsmPrimitive, OsmPrimitive> resolvedConflicts;
     147
    143148    /**
    144149     * constructor
     
    149154        purgedPrimitives = new ArrayList<OsmPrimitive>();
    150155        pairs = new ArrayList<OsmParentChildPair>();
     156        resolvedConflicts = new HashMap<OsmPrimitive, OsmPrimitive>();
    151157    }
    152158
     
    180186            if (pair.getParent() instanceof Way) {
    181187                Way w = (Way)pair.getParent();
    182                 System.out.println("removing reference from way " + w.id);
     188                System.out.println(tr("removing reference from way {0}",w.id));
    183189                w.nodes.remove(primitive);
    184190                // if a way ends up with less than two node we
     
    194200            } else if (pair.getParent() instanceof Relation) {
    195201                Relation r = (Relation)pair.getParent();
    196                 System.out.println("removing reference from relation " + r.id);
     202                System.out.println(tr("removing reference from relation {0}",r.id));
    197203                r.removeMembersFor(primitive);
    198204            }
     
    220226            }
    221227            purgedPrimitives.add(toPurge);
     228            if (Main.map.conflictDialog.conflicts.containsKey(toPurge)) {
     229                resolvedConflicts.put(toPurge, Main.map.conflictDialog.conflicts.get(toPurge));
     230                Main.map.conflictDialog.removeConflictForPrimitive(toPurge);
     231            }
    222232        }
    223233        return super.executeCommand();
     
    236246    @Override
    237247    public void undoCommand() {
     248
     249        // restore purged primitives
     250        //
    238251        for (OsmPrimitive purged : purgedPrimitives) {
    239252            Main.ds.addPrimitive(purged);
     253        }
     254
     255        // restore conflicts
     256        //
     257        for (OsmPrimitive primitive : resolvedConflicts.keySet()) {
     258            Main.map.conflictDialog.addConflict(primitive, resolvedConflicts.get(primitive));
    240259        }
    241260
  • trunk/src/org/openstreetmap/josm/command/UndeletePrimitivesCommand.java

    r1670 r1690  
    66import java.util.ArrayList;
    77import java.util.Collection;
     8import java.util.HashMap;
     9import java.util.Map;
    810
    911import javax.swing.JLabel;
     
    1113import javax.swing.tree.MutableTreeNode;
    1214
     15import org.openstreetmap.josm.Main;
    1316import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1417import org.openstreetmap.josm.tools.ImageProvider;
     
    2427    /** the node to undelete */
    2528    private ArrayList<OsmPrimitive> toUndelete;
     29    private Map<OsmPrimitive,OsmPrimitive> resolvedConflicts;
    2630
     31    protected UndeletePrimitivesCommand() {
     32        toUndelete = new ArrayList<OsmPrimitive>();
     33        resolvedConflicts = new HashMap<OsmPrimitive, OsmPrimitive>();
     34    }
    2735    /**
    2836     * constructor
     
    3038     */
    3139    public UndeletePrimitivesCommand(OsmPrimitive node) {
    32         toUndelete = new ArrayList<OsmPrimitive>();
     40        this();
    3341        toUndelete.add(node);
    3442    }
     
    3947     */
    4048    public UndeletePrimitivesCommand(OsmPrimitive ... toUndelete) {
    41         this.toUndelete = new ArrayList<OsmPrimitive>();
     49        this();
    4250        for (int i=0; i < toUndelete.length; i++) {
    4351            this.toUndelete.add(toUndelete[i]);
     
    5058     */
    5159    public UndeletePrimitivesCommand(Collection<OsmPrimitive> toUndelete) {
    52         this.toUndelete = new ArrayList<OsmPrimitive>();
     60        this();
    5361        this.toUndelete.addAll(toUndelete);
    5462    }
     
    7078        super.executeCommand();
    7179        for(OsmPrimitive primitive: toUndelete) {
     80            if (Main.map.conflictDialog.conflicts.containsKey(primitive)) {
     81                resolvedConflicts.put(primitive, Main.map.conflictDialog.conflicts.get(primitive));
     82                Main.map.conflictDialog.removeConflictForPrimitive(primitive);
     83            }
    7284            primitive.id = 0;
    7385        }
     
    8092        modified.addAll(toUndelete);
    8193    }
     94    @Override
     95    public void undoCommand() {
     96        super.undoCommand();
     97
     98        for (OsmPrimitive my: resolvedConflicts.keySet()) {
     99            if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
     100                Main.map.conflictDialog.addConflict(my, resolvedConflicts.get(my));
     101            }
     102        }
     103    }
    82104}
  • trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java

    r1670 r1690  
    1111
    1212import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.data.osm.Node;
    1413import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1514import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    16 import org.openstreetmap.josm.data.osm.Relation;
    17 import org.openstreetmap.josm.data.osm.Way;
    1815import org.openstreetmap.josm.tools.ImageProvider;
    1916
Note: See TracChangeset for help on using the changeset viewer.