[josm-dev] How to update changes in dataSet ?

Flávio Henrique yoshimit at gmail.com
Tue Jan 4 18:39:43 GMT 2011


On Tue, Jan 4, 2011 at 16:03, Dirk Stöcker <openstreetmap at dstoecker.de>wrote:

> I think you still have a bug. The UndoRedo work basically like this: It
> describes a transformation from one state to another. When you implemented
> it correct, then the state needs to change. Please check, that the Actions
> you do really are done. Open the Command history and view it. For
> SequenceCommands you can view them like a tree and it needs to contain any
> action necessary to combine ways (including a delete for removed parts).
>
> But it is a long time since I last did this, so I may miss something. Best
> help is always the source code itself. See the Actions inside of JOSm and
> compare what they do different from the stuff you do.
>
> Also Do the data set check (should be in help menu). It can detect errors
> in the composition of datasets.
>
>
> Ciao
>

Hmm...
I did'nt changed any of your code. Just use them.
Basically what I'm doing is:
-> using mouse to select all my data and intercepting the selection in
SelectionManager.getObjectsInRectangle method
-> I iterate the ways selected, using nc.getCurrentDataSet().getWays(), and
search ways that have a particular tag with same value, using
way.get("id_log").
-> So I call CombineWayAction().combineWaysWorker(sameWays) to combine them.

The point is: as I have now only ways that can't be combined with all of
your segments (sometimes with hundreds of segments), I'm trying to combine
only those possible. So I call the combineWaysWorker method only with two
segments. If do not work, I try the first segment with a different segment
of the same way. If works I grab a differente way I repeat the process,
until all possibles segments could be combined.

The code to combine the ways is working fine, as I can see the combined
segments on GUI (I'm using debug mode).

Maybe my mistake is call nc.getCurrentDataSet().getWays() to get the updated
dataSet after the first call ? Maybe this method returns only the original
dataSet (unchanged)? There's another method to bring the updated (with the
combined way) dataSet?

Or, although the GUI shows the updated data (the way combined) I still need
to apply the commands? If so, how?

Thank you in advance!

Flávio Henrique


More information about the josm-dev mailing list