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

Flávio Henrique yoshimit at gmail.com
Tue Jan 4 02:01:03 GMT 2011


Hi there!
I need help to figure out how to update the dataset after some changes. I'll
try to explain.

My goal is select an area with mouse and search similar ways (specific
tests) and try to combine them. The problem is after combine some ways, the
method NavigatableComponent.getCurrentDataSet().getWays() returns the same
unchanged data. I tried the nc.getCurrentDataSet().beginUpdate() and
endUpdate() methods but no success.

So, how to update the dataSet after some modifications? Please?

To clarify (just to give the idea):
I'm using the SelectionManager.getObjectsInRectangle method to catch the
mouse selection, then I iterate through ways, test them and try to combine
them:

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?

Thank you in advance!

Flávio Henrique


More information about the josm-dev mailing list