From 7d18379596a5ed614c52512029a4b18f69a8161a Mon Sep 17 00:00:00 2001 From: tegzed Date: Sat, 19 Feb 2011 20:24:43 +0000 Subject: [PATCH] Fix:osd/core:fixed validity check for position change git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4216 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/osd/core/osd_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/navit/navit/osd/core/osd_core.c b/navit/navit/osd/core/osd_core.c index 284bbca..eba7d85 100644 --- a/navit/navit/osd/core/osd_core.c +++ b/navit/navit/osd/core/osd_core.c @@ -370,11 +370,14 @@ osd_odometer_draw(struct odometer *this, struct navit *nav, osd_std_draw(&this->osd_item); if(this->bActive) { - vehicle_get_attr(curr_vehicle, attr_position_coord_geo,&position_attr, NULL); + if(!vehicle_get_attr(curr_vehicle, attr_position_coord_geo,&position_attr, NULL)) { + return; + } pro = projection_mg;//position_attr.u.pcoord->pro; transform_from_geo(pro, position_attr.u.coord_geo, &curr_coord); if (this->last_coord.x != -1 ) { + const double cStepDistLimit = 10000; struct timeval tv; double curr_time; gettimeofday(&tv,NULL); @@ -383,7 +386,7 @@ osd_odometer_draw(struct odometer *this, struct navit *nav, double dt = curr_time-this->last_update_time; double dCurrDist = 0; dCurrDist = transform_distance(pro, &curr_coord, &this->last_coord); - if(0last_coord.x) { + if(dCurrDist<=cStepDistLimit) { this->sum_dist += dCurrDist; } this->time_all = time(0)-this->last_click_time+this->sum_time; -- 2.7.4