HistoryDataSet.getInstance().mergeInto(loadedData);
}
@Override
protected void realRun() throws SAXException, IOException, OsmTransferException {
loadedData = new HistoryDataSet();
try {
progressMonitor.setTicksCount(toLoad.size());
for(PrimitiveId pid: toLoad) {
if (canceled) {
break;
}
String msg = "";
switch(pid.getType()) {
case NODE: msg = marktr("Loading history for node {0}"); break;
case WAY: msg = marktr("Loading history for way {0}"); break;
case RELATION: msg = marktr("Loading history for relation {0}"); break;
}
progressMonitor.indeterminateSubTask(tr(msg,
Long.toString(pid.getUniqueId())));
reader = null;
HistoryDataSet ds = null;
try {
reader = new OsmServerHistoryReader(pid.getType(), pid.getUniqueId());
ds = reader.parseHistory(progressMonitor.createSubTaskMonitor(1, false));
// load corresponding changesets (mostly for changeset comment)
for (final Changeset i : new OsmServerChangesetReader().queryChangesets(
new ChangesetQuery().forChangesetIds(ds.getChangesetIds()), progressMonitor.createSubTaskMonitor(1, false))) {
ds.putChangeset(i);
}
} catch(OsmTransferException e) {
if (canceled)
return;
throw e;