Main.map.repaint();
}
protected void downloadParents(long id, OsmPrimitiveType type, ProgressMonitor progressMonitor) throws OsmTransferException{
reader = new OsmServerBackreferenceReader(id, type);
DataSet ds = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false));
synchronized(this) { // avoid race condition in cancel()
reader = null;
}
Collection<Way> ways = ds.getWays();
DataSetMerger merger;
if (!ways.isEmpty()) {
Set<Node> nodes = new HashSet<>();
for (Way w: ways) {
// Ensure each node is only listed once
nodes.addAll(w.getNodes());
}
// Don't retrieve any nodes we've already grabbed
nodes.removeAll(targetLayer.data.getNodes());
if (!nodes.isEmpty()) {
reader = new MultiFetchServerObjectReader();
((MultiFetchServerObjectReader)reader).append(nodes);
DataSet wayNodes = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false));
synchronized(this) { // avoid race condition in cancel()
reader = null;
}
merger = new DataSetMerger(ds, wayNodes);
merger.merge();