From 55fb4d68c6a737974734ceebe9ca0f3316f4e39f Mon Sep 17 00:00:00 2001 From: grauser Date: Tue, 2 Jun 2015 23:04:32 +0200 Subject: [PATCH] RideFile: Don't use 0.0 as min or max for gps lat/lon --- src/RideFile.cpp | 8 ++++---- src/Route.cpp | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/RideFile.cpp b/src/RideFile.cpp index 1b4dd6c1c..ca626e755 100644 --- a/src/RideFile.cpp +++ b/src/RideFile.cpp @@ -714,9 +714,9 @@ void RideFile::updateMin(RideFilePoint* point) minPoint->watts = point->watts; if (point->altalt) minPoint->alt = point->alt; - if (minPoint->lon == 0 || point->lonlon) + if (minPoint->lon == 0.0 || (point->lon != 0.0 && point->lonlon)) minPoint->lon = point->lon; - if (minPoint->lat == 0 || point->latlat) + if (minPoint->lat == 0.0 || (point->lat != 0.0 && point->latlat)) minPoint->lat = point->lat; if (point->headwindheadwind) minPoint->headwind = point->headwind; @@ -791,9 +791,9 @@ void RideFile::updateMax(RideFilePoint* point) maxPoint->watts = point->watts; if (point->alt>maxPoint->alt) maxPoint->alt = point->alt; - if (point->lon>maxPoint->lon) + if (maxPoint->lon == 0.0 || (point->lon != 0.0 && point->lon>maxPoint->lon)) maxPoint->lon = point->lon; - if (point->lat>maxPoint->lat) + if (maxPoint->lat == 0.0 || (point->lat != 0.0 && point->lat>maxPoint->lat)) maxPoint->lat = point->lat; if (point->headwind>maxPoint->headwind) maxPoint->headwind = point->headwind; diff --git a/src/Route.cpp b/src/Route.cpp index 0a04e3dcc..e1ee50623 100644 --- a/src/Route.cpp +++ b/src/Route.cpp @@ -373,6 +373,12 @@ Routes::search(RideItem *item, RideFile*ride, QList&here) for (int routecount=0;routecountgetMinPoint(RideFile::lat); + qDebug() << ride->getMaxPoint(RideFile::lat); + qDebug() << ride->getMinPoint(RideFile::lon); + qDebug() << ride->getMaxPoint(RideFile::lon); + + // The third decimal place is worth up to 110 m if (ride->getMinPoint(RideFile::lat).toDouble()getMinLat()+0.001 && ride->getMaxPoint(RideFile::lat).toDouble()>segment->getMaxLat()-0.001 &&