[josm-dev] How to update changes in dataSet ?
Dirk Stöcker
openstreetmap at dstoecker.de
Tue Jan 4 14:05:25 GMT 2011
On Tue, 4 Jan 2011, Flávio Henrique wrote:
> nc.getCurrentDataSet().beginUpdate();
> for (Way way : nc.getCurrentDataSet().getWays()) {
>
> similarWays = searchSimilarWays(way);
>
> new CombineWayAction().combineWaysWorker(similarWays);
>
> }
> nc.getCurrentDataSet().fireSelectionChanged();
> nc.getCurrentDataSet().endUpdate();
>
>
> I know, by my log, that some ways are combined, but after the endUpdate()
> call, another nc.getCurrentDataSet().getWays() returns the same previous
> data (unchanged).
>
> Someone could cast a light for me, please?
CombineWayAction().combineWaysWorker(similarWays)
return a way and a command (Pair<Way, Command>. You need to pass the
command to
Main.main.undoRedo.add(command)
or all you do is locally.
As you do a loop, you should rather use a SequenceCommand to group them:
LinkedList<Command> cmds = new LinkedList<Command>();
for...
cmds.add(...command part of combinewayaction result...);
Main.main.undoRedo.add(new SequenceCommand(tr("Your job"), cmds));
Ciao
--
http://www.dstoecker.eu/ (PGP key available)
More information about the josm-dev
mailing list