Skip to content

Commit 75a8fc8

Browse files
author
gjm
committed
Fix for ticket #2228. Also enhanced to offer a couple more conversion
options between tracks, waypoints, and routes. git-svn-id: http://svn.osgeo.org/qgis/trunk@13886 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 771fe9a commit 75a8fc8

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/plugins/gps_importer/qgsgpsplugin.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ void QgsGPSPlugin::convertGPSFile( QString inputFileName,
322322
convertStrings << "-x" << "transform,wpt=rte,del"; break;
323323
case 1:
324324
convertStrings << "-x" << "transform,rte=wpt,del"; break;
325+
case 2:
326+
convertStrings << "-x" << "transform,trk=wpt,del"; break;
327+
case 3:
328+
convertStrings << "-x" << "transform,wpt=trk,del"; break;
325329
default:
326330
QgsDebugMsg( "Illegal conversion index!" );
327331
return;
@@ -367,13 +371,18 @@ void QgsGPSPlugin::convertGPSFile( QString inputFileName,
367371
switch ( convertType )
368372
{
369373
case 0:
374+
case 3:
370375
emit drawVectorLayer( outputFileName + "?type=waypoint",
371376
layerName, "gpx" );
372377
break;
373378
case 1:
374379
emit drawVectorLayer( outputFileName + "?type=route",
375380
layerName, "gpx" );
376381
break;
382+
case 2:
383+
emit drawVectorLayer( outputFileName + "?type=track",
384+
layerName, "gpx" );
385+
break;
377386
default:
378387
QgsDebugMsg( "Illegal conversion index!" );
379388
return;

src/plugins/gps_importer/qgsgpsplugingui.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ QgsGPSPluginGui::QgsGPSPluginGui( const BabelMap& importers,
3838
populatePortComboBoxes();
3939
populateULLayerComboBox();
4040
populateIMPBabelFormats();
41+
populateCONVDialog();
4142

4243
connect( pbULEditDevices, SIGNAL( clicked() ), this, SLOT( openDeviceEditor() ) );
4344
connect( pbDLEditDevices, SIGNAL( clicked() ), this, SLOT( openDeviceEditor() ) );
@@ -130,7 +131,8 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
130131
// or convert between waypoints/tracks=
131132
case 4:
132133
{
133-
int convertType = cmbCONVType->currentIndex();
134+
int convertType = cmbCONVType->itemData(cmbCONVType->currentIndex()).toInt();
135+
134136
emit convertGPSFile( leCONVInput->text(),
135137
convertType,
136138
leCONVOutput->text(),
@@ -327,6 +329,13 @@ void QgsGPSPluginGui::populatePortComboBoxes()
327329
cmbULPort->setCurrentIndex( idx < 0 ? 0 : idx );
328330
}
329331

332+
void QgsGPSPluginGui::populateCONVDialog()
333+
{
334+
cmbCONVType->addItem(tr("Waypoints from a route"), QVariant(int(0)));
335+
cmbCONVType->addItem(tr("Waypoints from a track"), QVariant(int(3)));
336+
cmbCONVType->addItem(tr("Route from waypoints"), QVariant(int(1)));
337+
cmbCONVType->addItem(tr("Track from waypoints"), QVariant(int(2)));
338+
}
330339

331340
void QgsGPSPluginGui::populateULLayerComboBox()
332341
{

src/plugins/gps_importer/qgsgpsplugingui.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ class QgsGPSPluginGui : public QDialog, private Ui::QgsGPSPluginGuiBase
6464
void populateULLayerComboBox();
6565
void populateIMPBabelFormats();
6666
void populatePortComboBoxes();
67+
void populateCONVDialog();
68+
6769
#if 0
6870
void populateLoadDialog();
6971
void populateDLDialog();
7072
void populateULDialog();
7173
void populateIMPDialog();
72-
void populateCONVDialog();
7374
#endif
7475

7576
private slots:

0 commit comments

Comments
 (0)