Changeset 4094 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-05-24T00:38:25+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java
r3720 r4094 8 8 import java.text.MessageFormat; 9 9 import java.util.Collection; 10 import java.util.Set; 11 import java.util.HashSet; 10 12 import java.util.HashMap; 11 13 import java.util.Map; … … 18 20 import org.openstreetmap.josm.data.osm.DataSet; 19 21 import org.openstreetmap.josm.data.osm.DataSetMerger; 22 import org.openstreetmap.josm.data.osm.Node; 20 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 24 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 193 196 } 194 197 Collection<Way> ways = ds.getWays(); 198 195 199 DataSetMerger merger; 196 200 if (!ways.isEmpty()) { 197 reader = new MultiFetchServerObjectReader();201 Set<Node> nodes = new HashSet<Node>(); 198 202 for (Way w: ways) { 199 ((MultiFetchServerObjectReader)reader).append(w.getNodes()); 200 } 201 DataSet wayNodes = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false)); 202 synchronized(this) { // avoid race condition in cancel() 203 reader = null; 204 } 205 merger = new DataSetMerger(ds, wayNodes); 206 merger.merge(); 203 // Ensure each node is only listed once 204 nodes.addAll(w.getNodes()); 205 } 206 // Don't retrieve any nodes we've already grabbed 207 nodes.removeAll(targetLayer.data.getNodes()); 208 if (!nodes.isEmpty()) { 209 reader = new MultiFetchServerObjectReader(); 210 ((MultiFetchServerObjectReader)reader).append(nodes); 211 DataSet wayNodes = reader.parseOsm(progressMonitor.createSubTaskMonitor(1, false)); 212 synchronized(this) { // avoid race condition in cancel() 213 reader = null; 214 } 215 merger = new DataSetMerger(ds, wayNodes); 216 merger.merge(); 217 } 207 218 } 208 219 merger = new DataSetMerger(parents, ds);
Note:
See TracChangeset
for help on using the changeset viewer.