Logo Search packages:      
Sourcecode: navit version File versions

void route_set_position_from_tracking ( struct route this,
struct tracking *  tracking,
enum projection  pro 
)

Sets a route's current position based on coordinates from tracking.

Parameters:
this The route to set the current position of
tracking The tracking to get the coordinates from

Definition at line 735 of file route.c.

References street_data::c, route_info::c, street_data::count, street_data::item, route_info::lp, route_info::pos, route_info_distances(), route_info_free(), route_path_update(), route_info::street, street_data_dup(), coord::x, and coord::y.

{
      struct coord *c;
      struct route_info *ret;
      struct street_data *sd;

      dbg(2,"enter\n");
      c=tracking_get_pos(tracking);
      ret=g_new0(struct route_info, 1);
      if (!ret) {
            printf("%s:Out of memory\n", __FUNCTION__);
            return;
      }
      if (this->pos)
            route_info_free(this->pos);
      this->pos=NULL;
      ret->c=*c;
      ret->lp=*c;
      ret->pos=tracking_get_segment_pos(tracking);
      sd=tracking_get_street_data(tracking);
      if (sd) {
            ret->street=street_data_dup(sd);
            route_info_distances(ret, pro);
      }
      dbg(3,"c->x=0x%x, c->y=0x%x pos=%d item=(0x%x,0x%x)\n", c->x, c->y, ret->pos, ret->street->item.id_hi, ret->street->item.id_lo);
      dbg(3,"street 0=(0x%x,0x%x) %d=(0x%x,0x%x)\n", ret->street->c[0].x, ret->street->c[0].y, ret->street->count-1, ret->street->c[ret->street->count-1].x, ret->street->c[ret->street->count-1].y);
      this->pos=ret;
      if (this->dst) 
            route_path_update(this, 0, 1);
      dbg(2,"ret\n");
}


Generated by  Doxygen 1.6.0   Back to index