Skip to content

Commit

Permalink
Fix 0 coords in gps feature capturing (appears sometimes when loosing…
Browse files Browse the repository at this point in the history
… gps connection)

git-svn-id: http://svn.osgeo.org/qgis/trunk@13737 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 16, 2010
1 parent 9d3649b commit 8038b85
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/gps/qgsgpsinformationwidget.cpp
Expand Up @@ -418,7 +418,18 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
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 );
Expand Down

0 comments on commit 8038b85

Please sign in to comment.