X-Git-Url: http://git.maemo.org/git/?p=jspeed;a=blobdiff_plain;f=src%2Fpoialerts.cpp;h=67cf921418dc8df325765c544218fc70badcf4a9;hp=2d8fe0dd5a86accce7cad8fc130f35e5963562e6;hb=31dd947afd934b933c3739f3b9325f01199e8fd2;hpb=fa66fb373153edc684f4d575c56107b74a615a3b diff --git a/src/poialerts.cpp b/src/poialerts.cpp index 2d8fe0d..67cf921 100644 --- a/src/poialerts.cpp +++ b/src/poialerts.cpp @@ -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); }