[QGIS Commit] r13886 - trunk/qgis/src/plugins/gps_importer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Jul 4 15:45:39 EDT 2010


Author: gjm
Date: 2010-07-04 19:45:39 +0000 (Sun, 04 Jul 2010)
New Revision: 13886

Modified:
   trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp
   trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp
   trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.h
Log:
Fix for ticket #2228. Also enhanced to offer a couple more conversion
options between tracks, waypoints, and routes.


Modified: trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp	2010-07-04 18:03:34 UTC (rev 13885)
+++ trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp	2010-07-04 19:45:39 UTC (rev 13886)
@@ -322,6 +322,10 @@
       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;
@@ -367,6 +371,7 @@
   switch ( convertType )
   {
     case 0:
+    case 3:
       emit drawVectorLayer( outputFileName + "?type=waypoint",
                             layerName, "gpx" );
       break;
@@ -374,6 +379,10 @@
       emit drawVectorLayer( outputFileName + "?type=route",
                             layerName, "gpx" );
       break;
+    case 2:
+      emit drawVectorLayer( outputFileName + "?type=track",
+                            layerName, "gpx" );
+      break;
     default:
       QgsDebugMsg( "Illegal conversion index!" );
       return;

Modified: trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp
===================================================================
--- trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp	2010-07-04 18:03:34 UTC (rev 13885)
+++ trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.cpp	2010-07-04 19:45:39 UTC (rev 13886)
@@ -38,6 +38,7 @@
   populatePortComboBoxes();
   populateULLayerComboBox();
   populateIMPBabelFormats();
+  populateCONVDialog();
 
   connect( pbULEditDevices, SIGNAL( clicked() ), this, SLOT( openDeviceEditor() ) );
   connect( pbDLEditDevices, SIGNAL( clicked() ), this, SLOT( openDeviceEditor() ) );
@@ -130,7 +131,8 @@
     // 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(),
@@ -327,6 +329,13 @@
   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()
 {

Modified: trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.h
===================================================================
--- trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.h	2010-07-04 18:03:34 UTC (rev 13885)
+++ trunk/qgis/src/plugins/gps_importer/qgsgpsplugingui.h	2010-07-04 19:45:39 UTC (rev 13886)
@@ -64,12 +64,13 @@
     void populateULLayerComboBox();
     void populateIMPBabelFormats();
     void populatePortComboBoxes();
+    void populateCONVDialog();
+
 #if 0
     void populateLoadDialog();
     void populateDLDialog();
     void populateULDialog();
     void populateIMPDialog();
-    void populateCONVDialog();
 #endif
 
   private slots:



More information about the QGIS-commit mailing list