Changeset 2942 in josm for trunk


Ignore:
Timestamp:
2010-02-05T20:52:53+01:00 (10 years ago)
Author:
mjulius
Message:

fixes #4441 - error downloading/sync
when updating data round bounding boxes to LatLon.MAX_SERVER_PRECISION and really eliminate empty download areas before downloading

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UpdateDataAction.java

    r2711 r2942  
    22package org.openstreetmap.josm.actions;
    33
     4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    66
    77import java.awt.event.ActionEvent;
     
    5151            return;
    5252
    53         int bboxCount = 0;
    5453        List<Area> areas = new ArrayList<Area>();
    5554        for(DataSource ds : getEditLayer().data.dataSources) {
    56             areas.add(new Area(ds.bounds.asRect()));
     55            areas.add(new Area(ds.bounds.getRoundedToOsmPrecision().asRect()));
    5756        }
    5857
     
    7372        }
    7473
     74        List<Area> areasToDownload = new ArrayList<Area>();
    7575        for(Area a : areas) {
    7676            if(a.isEmpty()) {
    7777                continue;
    7878            }
    79             bboxCount++;
     79            areasToDownload.add(a);
    8080        }
    8181
    82         if(bboxCount == 0) {
     82        if(areasToDownload.isEmpty()) {
    8383            // no bounds defined in the dataset? we update all primitives in the data set
    8484            // using a series of multi fetch requests
     
    8989            //
    9090            final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(tr("Download data"));
    91             final Future<?> future = new DownloadOsmTaskList().download(false /* no new layer */, areas, monitor);
     91            final Future<?> future = new DownloadOsmTaskList().download(false /* no new layer */, areasToDownload, monitor);
    9292            Main.worker.submit(
    9393                    new Runnable() {
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r2941 r2942  
    241241    }
    242242
     243    /**
     244     * Returns a clone of this Bounds, rounded to OSM precisions, i.e. to
     245     * LatLon.MAX_SERVER_PRECISION
     246     *
     247     * @return a clone of this Bounds
     248     */
     249    public Bounds getRoundedToOsmPrecision() {
     250        return new Bounds(
     251                Math.round(minLat / LatLon.MAX_SERVER_PRECISION) * LatLon.MAX_SERVER_PRECISION,
     252                Math.round(minLon / LatLon.MAX_SERVER_PRECISION) * LatLon.MAX_SERVER_PRECISION,
     253                Math.round(maxLat / LatLon.MAX_SERVER_PRECISION) * LatLon.MAX_SERVER_PRECISION,
     254                Math.round(maxLon / LatLon.MAX_SERVER_PRECISION) * LatLon.MAX_SERVER_PRECISION
     255        );
     256    }
    243257}
Note: See TracChangeset for help on using the changeset viewer.