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/qgis@13737 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 16, 2010
1 parent c19fd0d commit 52f985c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/gps/qgsgpsinformationwidget.cpp
Original file line number Diff line number Diff line change
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 52f985c

Please sign in to comment.