Skip to content

Commit

Permalink
Fix for ticket #2228. Also enhanced to offer a couple more conversion
Browse files Browse the repository at this point in the history
options between tracks, waypoints, and routes.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13886 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
gjm committed Jul 4, 2010
1 parent 7ff3877 commit 1dfee11
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/plugins/gps_importer/qgsgpsplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ void QgsGPSPlugin::convertGPSFile( QString inputFileName,
convertStrings << "-x" << "transform,wpt=rte,del"; break;
case 1:
convertStrings << "-x" << "transform,rte=wpt,del"; break;
case 2:
convertStrings << "-x" << "transform,trk=wpt,del"; break;
case 3:
convertStrings << "-x" << "transform,wpt=trk,del"; break;
default:
QgsDebugMsg( "Illegal conversion index!" );
return;
Expand Down Expand Up @@ -367,13 +371,18 @@ void QgsGPSPlugin::convertGPSFile( QString inputFileName,
switch ( convertType )
{
case 0:
case 3:
emit drawVectorLayer( outputFileName + "?type=waypoint",
layerName, "gpx" );
break;
case 1:
emit drawVectorLayer( outputFileName + "?type=route",
layerName, "gpx" );
break;
case 2:
emit drawVectorLayer( outputFileName + "?type=track",
layerName, "gpx" );
break;
default:
QgsDebugMsg( "Illegal conversion index!" );
return;
Expand Down
11 changes: 10 additions & 1 deletion src/plugins/gps_importer/qgsgpsplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ QgsGPSPluginGui::QgsGPSPluginGui( const BabelMap& importers,
populatePortComboBoxes();
populateULLayerComboBox();
populateIMPBabelFormats();
populateCONVDialog();

connect( pbULEditDevices, SIGNAL( clicked() ), this, SLOT( openDeviceEditor() ) );
connect( pbDLEditDevices, SIGNAL( clicked() ), this, SLOT( openDeviceEditor() ) );
Expand Down Expand Up @@ -130,7 +131,8 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
// or convert between waypoints/tracks=
case 4:
{
int convertType = cmbCONVType->currentIndex();
int convertType = cmbCONVType->itemData(cmbCONVType->currentIndex()).toInt();

emit convertGPSFile( leCONVInput->text(),
convertType,
leCONVOutput->text(),
Expand Down Expand Up @@ -327,6 +329,13 @@ void QgsGPSPluginGui::populatePortComboBoxes()
cmbULPort->setCurrentIndex( idx < 0 ? 0 : idx );
}

void QgsGPSPluginGui::populateCONVDialog()
{
cmbCONVType->addItem(tr("Waypoints from a route"), QVariant(int(0)));
cmbCONVType->addItem(tr("Waypoints from a track"), QVariant(int(3)));
cmbCONVType->addItem(tr("Route from waypoints"), QVariant(int(1)));
cmbCONVType->addItem(tr("Track from waypoints"), QVariant(int(2)));
}

void QgsGPSPluginGui::populateULLayerComboBox()
{
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/gps_importer/qgsgpsplugingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ class QgsGPSPluginGui : public QDialog, private Ui::QgsGPSPluginGuiBase
void populateULLayerComboBox();
void populateIMPBabelFormats();
void populatePortComboBoxes();
void populateCONVDialog();

#if 0
void populateLoadDialog();
void populateDLDialog();
void populateULDialog();
void populateIMPDialog();
void populateCONVDialog();
#endif

private slots:
Expand Down

0 comments on commit 1dfee11

Please sign in to comment.