Ignore:
Timestamp:
2017-06-09T11:40:32+02:00 (2 years ago)
Author:
michael2402
Message:

CombineWayAction: Allow merging ways that are not in the current edit data set.

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

Legend:

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

    r12314 r12356  
    2020import java.util.Set;
    2121import java.util.Stack;
     22import java.util.stream.Collectors;
    2223
    2324import javax.swing.JOptionPane;
     
    112113        ways = new LinkedHashSet<>(ways);
    113114
     115        List<DataSet> dataSets = ways.stream().map(Way::getDataSet).distinct().collect(Collectors.toList());
     116        if (dataSets.size() != 1) {
     117            throw new IllegalArgumentException("Cannot combine ways of multiple data sets.");
     118        }
     119
    114120        // try to build a new way which includes all the combined ways
    115         //
    116121        NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(ways);
    117122        List<Node> path = graph.buildSpanningPath();
     
    194199        deletedWays.remove(targetWay);
    195200
    196         cmds.add(new ChangeCommand(targetWay, modifiedTargetWay));
     201        cmds.add(new ChangeCommand(dataSets.get(0), targetWay, modifiedTargetWay));
    197202        cmds.addAll(reverseWayTagCommands);
    198203        cmds.addAll(resolution);
    199         cmds.add(new DeleteCommand(deletedWays));
     204        cmds.add(new DeleteCommand(dataSets.get(0), deletedWays));
    200205        final Command sequenceCommand = new SequenceCommand(/* for correct i18n of plural forms - see #9110 */
    201206                trn("Combine {0} way", "Combine {0} ways", ways.size(), ways.size()), cmds);
  • trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

    r12210 r12356  
    153153            corrCmds = (new ReverseWayTagCorrector()).execute(w, wnew);
    154154        }
    155         return new ReverseWayResult(wnew, corrCmds, new ChangeCommand(w, wnew));
     155        return new ReverseWayResult(wnew, corrCmds, new ChangeCommand(w.getDataSet(), w, wnew));
    156156    }
    157157
Note: See TracChangeset for help on using the changeset viewer.