Changeset 14868 in josm for trunk


Ignore:
Timestamp:
2019-03-10T12:30:50+01:00 (5 years ago)
Author:
GerdP
Message:

fix #17443: improve performance for GPX layer action "Download from OSM along this track"

  • use Path2D.append() instead of Area.addToDownload() to calculate the area around the track
  • use only the intersection of the original area in recursive calls of DownloadAlongAction.addToDownload()

Even complex tracks which cover huge areas are now handled within a few seconds insteads of several minutes
Possible improvement: remove progress monitor in DownloadAlongTrackAction and add progress monitor for recursion in addToDownload() in DownloadAlongAction

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

Legend:

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

    r14153 r14868  
    6969                        bounds.getHeight() / 2);
    7070            }
    71             addToDownload(a, r1, results, maxArea);
    72             addToDownload(a, r2, results, maxArea);
     71            addToDownload(tmp, r1, results, maxArea);
     72            addToDownload(tmp, r2, results, maxArea);
    7373        } else {
    7474            results.add(bounds);
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackAction.java

    r12634 r14868  
    66import java.awt.event.ActionEvent;
    77import java.awt.geom.Area;
     8import java.awt.geom.Path2D;
    89import java.awt.geom.Rectangle2D;
    910
     
    104105        class CalculateDownloadArea extends PleaseWaitRunnable {
    105106
    106             private final Area a = new Area();
     107            private final Path2D path = new Path2D.Double();
    107108            private boolean cancel;
    108109            private int ticks;
     
    128129                    return;
    129130                }
    130                 confirmAndDownloadAreas(a, maxArea, panel.isDownloadOsmData(), panel.isDownloadGpxData(),
     131                confirmAndDownloadAreas(new Area(path), maxArea, panel.isDownloadOsmData(), panel.isDownloadGpxData(),
    131132                        tr("Download from OSM along this track"), progressMonitor);
    132133            }
     
    152153                    // we add a buffer around the point.
    153154                    r.setRect(c.lon() - bufferX, c.lat() - bufferY, 2 * bufferX, 2 * bufferY);
    154                     a.add(new Area(r));
     155                    path.append(r, false);
    155156                    return c;
    156157                }
Note: See TracChangeset for help on using the changeset viewer.