Ticket #2404: 20090413-improve-update-download.diff

File 20090413-improve-update-download.diff, 2.9 KB (added by smsm1, 16 years ago)

Patch that improves one of the symptoms of this problem, but doesn't fix it

  • src/org/openstreetmap/josm/actions/UpdateDataAction.java

     
    6161        }
    6262
    6363        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);
    6567                continue;
     68            }
    6669            bboxCount++;
    6770        }
    6871
     
    8285        if(result != 1)
    8386            return;
    8487
    85         new DownloadOsmTaskList().download(false, areas);
     88        new DownloadOsmTaskList().download(false, areas, bboxCount);
    8689    }
    8790
    8891}
  • src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java

     
    3131     * Downloads a list of areas from the OSM Server
    3232     * @param newLayer Set to true if all areas should be put into a single new layer
    3333     * @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()
    3436     */
    35     public void download(boolean newLayer, List<Rectangle2D> rects) {
     37    public void download(boolean newLayer, List<Rectangle2D> rects, int count) {
    3638        if(newLayer) {
    3739            Layer l = new OsmDataLayer(new DataSet(), tr("Data Layer"), null);
    3840            Main.main.addLayer(l);
     
    4143
    4244        int i = 0;
    4345        for(Rectangle2D td : rects) {
     46            if(td.isEmpty())
     47              continue;
    4448            i++;
    4549            DownloadTask dt = new DownloadOsmTask();
    4650            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));
    4852            osmTasks.add(dt);
    4953        }
    5054
     
    5862     * Downloads a list of areas from the OSM Server
    5963     * @param newLayer Set to true if all areas should be put into a single new layer
    6064     * @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()
    6167     */
    62     public void download(boolean newLayer, Collection<Area> areas) {
     68    public void download(boolean newLayer, Collection<Area> areas, int count) {
    6369        List<Rectangle2D> rects = new LinkedList<Rectangle2D>();
    6470        for(Area a : areas)
    6571            rects.add(a.getBounds2D());
    6672
    67         download(newLayer, rects);
     73        download(newLayer, rects, count);
    6874    }
    6975
    7076    /**