Changeset 18320 in josm for trunk/src/org
- Timestamp:
- 2021-11-09T09:12:23+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r16553 r18320 12 12 import org.openstreetmap.josm.data.DataSource; 13 13 import org.openstreetmap.josm.data.gpx.GpxData; 14 import org.openstreetmap.josm.data.gpx.IGpxTrack; 14 15 import org.openstreetmap.josm.data.notes.Note; 15 16 import org.openstreetmap.josm.data.osm.DataSet; 16 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 import org.openstreetmap.josm.spi.preferences.Config; 17 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 20 import org.openstreetmap.josm.tools.JosmRuntimeException; 19 21 import org.openstreetmap.josm.tools.Logging; 22 import org.openstreetmap.josm.tools.Utils; 20 23 import org.xml.sax.SAXException; 21 24 … … 52 55 GpxData result = null; 53 56 final int pointsPerPage = 5000; // see https://wiki.openstreetmap.org/wiki/API_v0.6#GPS_traces 54 String url ="trackpoints?bbox="+b.getMinLon()+','+b.getMinLat()+','+b.getMaxLon()+','+b.getMaxLat()+"&page=";57 final String url = getBaseUrl() + "trackpoints?bbox="+b.getMinLon()+','+b.getMinLat()+','+b.getMaxLon()+','+b.getMaxLat()+"&page="; 55 58 for (int i = 0; !done && !isCanceled(); ++i) { 56 59 progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * pointsPerPage, (i + 1) * pointsPerPage)); … … 63 66 gpxParsedProperly = reader.parse(false); 64 67 GpxData currentGpx = reader.getGpxData(); 68 69 // #21538 - Apparently track URLs are no longer complete URLs, but only paths 70 // We'll prefix the browse URL to get something to navigate to again. 71 final String browseUrl = Config.getUrls().getBaseBrowseUrl(); 72 for (IGpxTrack track : currentGpx.tracks) { 73 Object trackUrl = track.get("url"); 74 if (trackUrl instanceof String) { 75 String sTrackUrl = (String) trackUrl; 76 if (!Utils.isBlank(sTrackUrl) && !sTrackUrl.startsWith("http")) { 77 track.put("url", browseUrl + sTrackUrl); 78 } 79 } 80 } 81 65 82 long count = 0; 66 83 if (currentGpx.hasTrackPoints()) {
Note:
See TracChangeset
for help on using the changeset viewer.