Changed default and white themes to show a speed camera warning image. Small fix...
[jspeed] / src / poialerts.cpp
index 2d8fe0d..67cf921 100644 (file)
@@ -197,7 +197,10 @@ double PoiAlerts::getCurrentDistance() const
         return 0.0;
     }
 
-    return currentDistance_;
+    const Location::Fix* fix = &(Odometer::instance().getLatestFix());
+
+    return calculateDistance(currentPoi_->latitude, currentPoi_->longitude,
+                             fix->latitude, fix->longitude);
 }
 
 QString PoiAlerts::getCurrentPoi() const
@@ -232,7 +235,7 @@ void PoiAlerts::onDataUpdated()
 
     double travelled = Odometer::instance().getTotal();
 
-    if(absValue(travelled - travelled_) > 0.02)
+    if(absValue(travelled - travelled_) > 0.015)
     {
         double distance;
         double inRouteMargin = IN_ROUTE_MARGIN + (fix->eph / 1000.0);
@@ -268,7 +271,7 @@ void PoiAlerts::onDataUpdated()
                     }
                     else
                     {
-                        trackLimit = 90.0 - radToDeg(acos((inRouteMargin + (distance * 0.16)) / distance));
+                        trackLimit = 90.0 - radToDeg(acos((inRouteMargin + (distance * 0.17)) / distance));
                     }
 
                     qDebug() << "Tracklimit: " << trackLimit;
@@ -277,7 +280,6 @@ void PoiAlerts::onDataUpdated()
                     {
                         found = true;
                         currentPoi_ = &pois_[i];
-                        currentDistance_ = distance;
                         emit visibilityChanged(true);
                         playSound(i);
                     }
@@ -292,7 +294,6 @@ void PoiAlerts::onDataUpdated()
                 {
                     found = true;
                     currentPoi_ = &pois_[i];
-                    currentDistance_ = distance;
                     emit visibilityChanged(true);
                     playSound(i);
                 }