Changeset 14763 in josm for trunk/src


Ignore:
Timestamp:
2019-02-05T17:18:01+01:00 (6 years ago)
Author:
GerdP
Message:

fix #17279: improve performance when retrieving history

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

Legend:

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

    r13927 r14763  
    138138        private HistoryLoaderAndListener(Map<OsmPrimitive, Date> toLoad) {
    139139            this.toLoad = toLoad;
     140            this.setChangesetDataNeeded(false);
    140141            add(toLoad.keySet());
    141142            // Updating process is done after all history requests have been made
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java

    r14756 r14763  
    2727import org.openstreetmap.josm.io.OsmTransferException;
    2828import org.openstreetmap.josm.tools.CheckParameterUtil;
     29import org.openstreetmap.josm.tools.Logging;
    2930import org.xml.sax.SAXException;
    3031
     
    5354    private HistoryDataSet loadedData;
    5455    private OsmServerHistoryReader reader;
     56    private boolean getChangesetData = true;
    5557
    5658    /**
     
    164166    protected void realRun() throws SAXException, IOException, OsmTransferException {
    165167        loadedData = new HistoryDataSet();
     168        int ticks = toLoad.size();
     169        if (getChangesetData)
     170            ticks *= 2;
    166171        try {
    167             progressMonitor.setTicksCount(2 * toLoad.size());
     172            progressMonitor.setTicksCount(ticks);
    168173            for (PrimitiveId pid: toLoad) {
    169174                if (canceled) {
     
    184189        try {
    185190            reader = new OsmServerHistoryReader(pid.getType(), pid.getUniqueId());
    186             ds = loadHistory(reader, progressMonitor);
     191            if (getChangesetData) {
     192                ds = loadHistory(reader, progressMonitor);
     193            } else {
     194                ds = reader.parseHistory(progressMonitor.createSubTaskMonitor(1, false));
     195            }
    187196        } catch (OsmTransferException e) {
    188197            if (canceled)
     
    241250        return lastException;
    242251    }
     252
     253    /**
     254     * Determine if changeset information is needed. By default it is retrieved.
     255     * @param b false means don't retrieve changeset data.
     256     */
     257    public void setChangesetDataNeeded(boolean b) {
     258        getChangesetData = b;
     259    }
    243260}
  • trunk/src/org/openstreetmap/josm/io/OsmServerHistoryReader.java

    r11262 r14763  
    6060        progressMonitor.beginTask("");
    6161        try {
    62             progressMonitor.indeterminateSubTask(tr("Contacting OSM Server..."));
    6362            final String urlStr = primitiveType.getAPIName() + '/' + id + "/history";
     63            progressMonitor.indeterminateSubTask(tr("Contacting OSM Server for {0}", urlStr));
    6464
    6565            try (InputStream in = getInputStream(urlStr, progressMonitor.createSubTaskMonitor(1, true))) {
Note: See TracChangeset for help on using the changeset viewer.