X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2FSearchWikipediaNames.java;h=0458943036ed8007ffecb0838bf66c504aff4e6d;hp=ab24522eb68120168b49c420996f245ea8ffb32d;hb=4d5796d02a15808311c09448d79e6e7d1de9d636;hpb=f1b92378a792131ac8fb33a869405851d5b2d1f7 diff --git a/tim/prune/function/SearchWikipediaNames.java b/tim/prune/function/SearchWikipediaNames.java index ab24522..0458943 100644 --- a/tim/prune/function/SearchWikipediaNames.java +++ b/tim/prune/function/SearchWikipediaNames.java @@ -130,22 +130,29 @@ public class SearchWikipediaNames extends GenericDownloaderFunction _statusLabel.setText(descMessage); } + /** - * Load the selected track or point + * Load the selected point(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 rows selected in the table and get the corresponding coords + int numSelected = _trackTable.getSelectedRowCount(); + if (numSelected < 1) return; + int[] rowNums = _trackTable.getSelectedRows(); + for (int i=0; i= 0 && rowNum < _trackListModel.getRowCount()) { - DataPoint point = new DataPoint(new Latitude(latlon[0]), new Longitude(latlon[1]), null); - point.setFieldValue(Field.WAYPT_NAME, _trackListModel.getTrack(rowNum).getTrackName(), false); - _app.createPoint(point); + String coords = _trackListModel.getTrack(rowNum).getDownloadLink(); + String[] latlon = coords.split(","); + if (latlon.length == 2) + { + DataPoint point = new DataPoint(new Latitude(latlon[0]), new Longitude(latlon[1]), null); + point.setFieldValue(Field.WAYPT_NAME, _trackListModel.getTrack(rowNum).getTrackName(), false); + _app.createPoint(point); + } } } // Close the dialog