Changeset 4090 in josm


Ignore:
Timestamp:
2011-05-20T11:03:51+02:00 (10 years ago)
Author:
bastiK
Message:

applied #6251 (patch by akks) - download relatin members along with relation; zoom to download

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java

    r4088 r4090  
    1313import javax.swing.SwingUtilities;
    1414
     15import org.openstreetmap.josm.actions.AutoScaleAction;
    1516import org.openstreetmap.josm.data.osm.DataSet;
    1617import org.openstreetmap.josm.data.osm.DataSetMerger;
     
    8485            public void run() {
    8586                layer.mergeFrom(ds);
     87                AutoScaleAction.zoomTo(ds.allPrimitives());
    8688                layer.onPostDownloadFromServer();
    8789            }
     
    140142            DataSetMerger merger = new DataSetMerger(ds, theirDataSet);
    141143            merger.merge();
     144           
     145            // if incomplete relation members exist, download them too
     146            for (Relation r : ds.getRelations()) {
     147                if (canceled) return;
     148                if (r.hasIncompleteMembers()) {
     149                    synchronized(this) {
     150                        if (canceled) return;
     151                        objectReader = new OsmServerObjectReader(r.getId(), OsmPrimitiveType.RELATION, true /* full */);
     152                    }
     153                    theirDataSet = objectReader.parseOsm(progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
     154                    synchronized (this) {
     155                        objectReader = null;
     156                    }
     157                    merger = new DataSetMerger(ds, theirDataSet);
     158                    merger.merge();
     159                }
     160            }
     161
    142162            // a way loaded with MultiFetch may have incomplete nodes because at least one of its
    143163            // nodes isn't present in the local data set. We therefore fully load all
Note: See TracChangeset for help on using the changeset viewer.