Ticket #4797: unglue-nodes-fix.patch

File unglue-nodes-fix.patch, 1.4 KB (added by KalleLampila, 10 years ago)
  • src/org/openstreetmap/josm/actions/UnGlueAction.java

    diff --git a/src/org/openstreetmap/josm/actions/UnGlueAction.java b/src/org/openstreetmap/josm/actions/UnGlueAction.java
    index 71fb402..d9ff30e 100644
    a b public class UnGlueAction extends JosmAction { 
    279279    /**
    280280     * dupe the given node of the given way
    281281     *
     282     * assume that OrginalNode is in the way
     283     *
    282284     * -> the new node will be put into the parameter newNodes.
    283285     * -> the add-node command will be put into the parameter cmds.
    284286     * -> the changed way will be returned and must be put into cmds by the caller!
    285287     */
    286288    private Way modifyWay(Node originalNode, Way w, List<Command> cmds, List<Node> newNodes) {
     289        // clone the node for the way
     290        Node newNode = new Node(originalNode, true /* clear OSM ID */);
     291        newNodes.add(newNode);
     292        cmds.add(new AddCommand(newNode));
     293
    287294        ArrayList<Node> nn = new ArrayList<Node>();
    288295        for (Node pushNode : w.getNodes()) {
    289296            if (originalNode == pushNode) {
    290                 // clone the node for all other ways
    291                 pushNode = new Node(pushNode, true /* clear OSM ID */);
    292                 newNodes.add(pushNode);
    293                 cmds.add(new AddCommand(pushNode));
     297                pushNode = newNode;
    294298            }
    295299            nn.add(pushNode);
    296300        }