Skip to content

Commit 52f985c

Browse files
author
mhugent
committed
Fix 0 coords in gps feature capturing (appears sometimes when loosing gps connection)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13737 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c19fd0d commit 52f985c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/app/gps/qgsgpsinformationwidget.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,18 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
418418
mpPlot->replot();
419419
if ( mpMapMarker )
420420
delete mpMapMarker;
421-
QgsPoint myNewCenter = QgsPoint( info.longitude, info.latitude );
421+
422+
//after loosing connection, the first gps info sometimes has uninitialized coords
423+
QgsPoint myNewCenter;
424+
if( doubleNear( info.longitude, 0.0 ) && doubleNear( info.latitude, 0.0) )
425+
{
426+
myNewCenter = mLastGpsPosition;
427+
}
428+
else
429+
{
430+
myNewCenter = QgsPoint( info.longitude, info.latitude );
431+
}
432+
422433
if ( mGroupShowMarker->isChecked() )
423434
{
424435
mpMapMarker = new QgsGpsMarker( mpCanvas );

0 commit comments

Comments
 (0)