Changeset 5265 in josm for trunk


Ignore:
Timestamp:
2012-06-03T15:16:23+02:00 (7 years ago)
Author:
bastiK
Message:

fixed #7673 - select target node after merge

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r5216 r5265  
    240240    }
    241241
    242     public static Command mergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetNode) {
     242    public static void doMergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetLocationNode) {
     243        if (nodes == null) {
     244            return;
     245        }
     246        Set<Node> allNodes = new HashSet<Node>(nodes);
     247        allNodes.add(targetLocationNode);
     248        Node target = selectTargetNode(allNodes);
     249
     250        Command cmd = mergeNodes(layer, nodes, target, targetLocationNode);
     251        if (cmd != null) {
     252            Main.main.undoRedo.add(cmd);
     253            getCurrentDataSet().setSelected(target);
     254        }
     255    }
     256
     257    public static Command mergeNodes(OsmDataLayer layer, Collection<Node> nodes, Node targetLocationNode) {
    243258        if (nodes == null) {
    244259            return null;
    245260        }
    246261        Set<Node> allNodes = new HashSet<Node>(nodes);
    247         allNodes.add(targetNode);
    248         return mergeNodes(layer, nodes, selectTargetNode(allNodes), targetNode);
     262        allNodes.add(targetLocationNode);
     263        return mergeNodes(layer, nodes, selectTargetNode(allNodes), targetLocationNode);
    249264    }
    250265
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r5174 r5265  
    909909        Collection<Node> nodesToMerge = new LinkedList<Node>(selNodes);
    910910        nodesToMerge.add(target);
    911         Command cmd = MergeNodesAction.mergeNodes(Main.main.getEditLayer(), nodesToMerge, target);
    912         if (cmd != null) {
    913             Main.main.undoRedo.add(cmd);
    914             getCurrentDataSet().setSelected(target);
    915         }
     911        MergeNodesAction.doMergeNodes(Main.main.getEditLayer(), nodesToMerge, target);
    916912    }
    917913
Note: See TracChangeset for help on using the changeset viewer.