[QGIS Commit] r13737 - trunk/qgis/src/app/gps

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jun 16 07:31:39 EDT 2010


Author: mhugent
Date: 2010-06-16 11:31:39 +0000 (Wed, 16 Jun 2010)
New Revision: 13737

Modified:
   trunk/qgis/src/app/gps/qgsgpsinformationwidget.cpp
Log:
Fix 0 coords in gps feature capturing (appears sometimes when loosing gps connection)

Modified: trunk/qgis/src/app/gps/qgsgpsinformationwidget.cpp
===================================================================
--- trunk/qgis/src/app/gps/qgsgpsinformationwidget.cpp	2010-06-14 19:06:37 UTC (rev 13736)
+++ trunk/qgis/src/app/gps/qgsgpsinformationwidget.cpp	2010-06-16 11:31:39 UTC (rev 13737)
@@ -418,7 +418,18 @@
   mpPlot->replot();
   if ( mpMapMarker )
     delete mpMapMarker;
-  QgsPoint myNewCenter = QgsPoint( info.longitude, info.latitude );
+
+  //after loosing connection, the first gps info sometimes has uninitialized coords
+  QgsPoint myNewCenter;
+  if( doubleNear( info.longitude, 0.0 ) && doubleNear( info.latitude, 0.0) )
+  {
+    myNewCenter = mLastGpsPosition;
+  }
+  else
+  {
+    myNewCenter = QgsPoint( info.longitude, info.latitude );
+  }
+
   if ( mGroupShowMarker->isChecked() )
   {
     mpMapMarker = new QgsGpsMarker( mpCanvas );



More information about the QGIS-commit mailing list