Fix:Core:Redraw map if route is created after vehicle update
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 29 Dec 2007 10:55:13 +0000 (10:55 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 29 Dec 2007 10:55:13 +0000 (10:55 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@678 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/src/navit.c
navit/src/route.c
navit/src/route.h

index 8cf7454..3ccc09c 100644 (file)
@@ -1168,6 +1168,7 @@ navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
        struct point cursor_pnt, *pnt=&cursor_pnt;
        enum projection pro;
        int border=16;
+       int route_path_set=0;
 
        if (! this_->ready)
                return;
@@ -1184,6 +1185,8 @@ navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
                navit_vehicle_draw(this_, nv, NULL);
                return;
        }
+       if (this_->route)
+               route_path_set=route_get_path_set(this_->route);
        if (this_->tracking && this_->tracking_flag) {
                if (tracking_update(this_->tracking, &nv->coord, nv->dir)) {
                        if (this_->route && nv->update_curr == 1) 
@@ -1197,7 +1200,6 @@ navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
                        route_set_position(this_->route, &cursor_pc);
                }
        }
-
        transform(this_->trans, pro, &nv->coord, &cursor_pnt, 1, 0);
        if (!transform_within_border(this_->trans, &cursor_pnt, border)) {
                if (!this_->cursor_flag)
@@ -1219,6 +1221,8 @@ navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
                navit_set_center_cursor(this_, &nv->coord, nv->dir, 50, 80);
                pnt=NULL;
        }
+       if (pnt && this_->route && !route_path_set && route_get_path_set(this_->route)) 
+               navit_draw(this_);
        if (nv->follow_curr > 1)
                nv->follow_curr--;
        else
index 61dac6d..7d4866a 100644 (file)
@@ -188,6 +188,12 @@ route_get_speedlist(struct route *this)
 }
 
 int
+route_get_path_set(struct route *this)
+{
+       return this->path2 != NULL;
+}
+
+int
 route_set_speed(struct route *this, enum item_type type, int value)
 {
        if (type < route_item_first || type > route_item_last) {
index 06575e0..d6a60b4 100644 (file)
@@ -43,6 +43,7 @@ struct mapset *route_get_mapset(struct route *this);
 struct route_info *route_get_pos(struct route *this);
 struct route_info *route_get_dst(struct route *this);
 int *route_get_speedlist(struct route *this);
+int route_get_path_set(struct route *this);
 int route_set_speed(struct route *this, enum item_type type, int value);
 int route_contains(struct route *this, struct item *item);
 void route_set_position(struct route *this, struct pcoord *pos);