X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2Fgpsies%2FGetGpsiesFunction.java;h=e60ed7429c4578e2bbfb44f8e3902dd69e102d63;hp=51085cf14742a8ae57b6b4bf75930439ee1fb8b0;hb=4d5796d02a15808311c09448d79e6e7d1de9d636;hpb=f1b92378a792131ac8fb33a869405851d5b2d1f7 diff --git a/tim/prune/function/gpsies/GetGpsiesFunction.java b/tim/prune/function/gpsies/GetGpsiesFunction.java index 51085cf..e60ed74 100644 --- a/tim/prune/function/gpsies/GetGpsiesFunction.java +++ b/tim/prune/function/gpsies/GetGpsiesFunction.java @@ -63,7 +63,6 @@ public class GetGpsiesFunction extends GenericDownloaderFunction _statusLabel.setText(I18nManager.getText("confirm.running")); // Act on callback to update list and send another request if necessary double[] coords = _app.getViewport().getBounds(); - // Example http://www.gpsies.com/api.do?BBOX=10,51,12,53&limit=20&trackTypes=jogging&filetype=kml&device=Run.GPS int currPage = 1; ArrayList trackList = null; @@ -73,6 +72,7 @@ public class GetGpsiesFunction extends GenericDownloaderFunction // Loop for each page of the results do { + // Example http://ws.gpsies.com/api.do?BBOX=10,51,12,53&limit=20&resultPage=1&key=oumgvvbckiwpvsnb String urlString = "http://ws.gpsies.com/api.do?BBOX=" + coords[1] + "," + coords[0] + "," + coords[3] + "," + coords[2] + "&limit=" + RESULTS_PER_PAGE + "&resultPage=" + currPage + @@ -112,23 +112,30 @@ public class GetGpsiesFunction extends GenericDownloaderFunction } /** - * Load the selected track or point + * Load the selected track(s) */ protected void loadSelected() { - // Find the row selected in the table and get the corresponding track - int rowNum = _trackTable.getSelectedRow(); - if (rowNum >= 0 && rowNum < _trackListModel.getRowCount()) + // Find the row(s) selected in the table and get the corresponding track + int numSelected = _trackTable.getSelectedRowCount(); + if (numSelected < 1) return; + int[] rowNums = _trackTable.getSelectedRows(); + for (int i=0; i= 0 && rowNum < _trackListModel.getRowCount()) { - loader.openStream(new URL(url).openStream()); - } - catch (IOException ioe) { - System.err.println("IO Exception : " + ioe.getMessage()); + String url = _trackListModel.getTrack(rowNum).getDownloadLink(); + XmlFileLoader xmlLoader = new XmlFileLoader(_app); + ZipFileLoader loader = new ZipFileLoader(_app, xmlLoader); + if (i>0) _app.autoAppendNextFile(); + try + { + loader.openStream(new URL(url).openStream()); + } + catch (IOException ioe) { + System.err.println("IO Exception : " + ioe.getMessage()); + } } } // Close the dialog