Ticket #2404: 20090413-improve-update-download.diff
File 20090413-improve-update-download.diff, 2.9 KB (added by , 16 years ago) |
---|
-
src/org/openstreetmap/josm/actions/UpdateDataAction.java
61 61 } 62 62 63 63 for(Area a : areas) { 64 if(a.isEmpty()) 64 if(a.isEmpty()) { 65 // Remove it so that we don't download it again 66 //areas.remove(a); 65 67 continue; 68 } 66 69 bboxCount++; 67 70 } 68 71 … … 82 85 if(result != 1) 83 86 return; 84 87 85 new DownloadOsmTaskList().download(false, areas );88 new DownloadOsmTaskList().download(false, areas, bboxCount); 86 89 } 87 90 88 91 } -
src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java
31 31 * Downloads a list of areas from the OSM Server 32 32 * @param newLayer Set to true if all areas should be put into a single new layer 33 33 * @param The List of Rectangle2D to download 34 * @param count The number of downloads that should occur. Will be equal or less 35 * than rects.size() 34 36 */ 35 public void download(boolean newLayer, List<Rectangle2D> rects ) {37 public void download(boolean newLayer, List<Rectangle2D> rects, int count) { 36 38 if(newLayer) { 37 39 Layer l = new OsmDataLayer(new DataSet(), tr("Data Layer"), null); 38 40 Main.main.addLayer(l); … … 41 43 42 44 int i = 0; 43 45 for(Rectangle2D td : rects) { 46 if(td.isEmpty()) 47 continue; 44 48 i++; 45 49 DownloadTask dt = new DownloadOsmTask(); 46 50 dt.download(null, td.getMinY(), td.getMinX(), td.getMaxY(), td.getMaxX(), true, 47 tr("Download {0} of {1} ({2} left)", i, rects.size(), rects.size()-i));51 tr("Download {0} of {1} ({2} left)", i, count, count-i)); 48 52 osmTasks.add(dt); 49 53 } 50 54 … … 58 62 * Downloads a list of areas from the OSM Server 59 63 * @param newLayer Set to true if all areas should be put into a single new layer 60 64 * @param The Collection of Areas to download 65 * @param count The number of downloads that should occur. Will be equal or less 66 * than rects.size() 61 67 */ 62 public void download(boolean newLayer, Collection<Area> areas ) {68 public void download(boolean newLayer, Collection<Area> areas, int count) { 63 69 List<Rectangle2D> rects = new LinkedList<Rectangle2D>(); 64 70 for(Area a : areas) 65 71 rects.add(a.getBounds2D()); 66 72 67 download(newLayer, rects );73 download(newLayer, rects, count); 68 74 } 69 75 70 76 /**