Logo Search packages:      
Sourcecode: navit version File versions

static void route_info_distances ( struct route_info ri,
enum projection  pro 
) [static]

This will calculate all the distances stored in a route_info.

ri The route_info to calculate the distances for
pro The projection used for this route

Definition at line 691 of file route.c.

References street_data::c, route_info::c, street_data::count, route_info::lenextra, route_info::lenneg, route_info::lenpos, route_info::lp, route_info::percent, route_info::pos, and route_info::street.

Referenced by route_set_destination(), route_set_position(), and route_set_position_from_tracking().

      int npos=ri->pos+1;
      struct street_data *sd=ri->street;
      /* 0 1 2 X 3 4 5 6 pos=2 npos=3 count=7 0,1,2 3,4,5,6*/
      ri->lenextra=transform_distance(pro, &ri->lp, &ri->c);
      ri->lenneg=transform_polyline_length(pro, sd->c, npos)+transform_distance(pro, &sd->c[ri->pos], &ri->lp);
      ri->lenpos=transform_polyline_length(pro, sd->c+npos, sd->count-npos)+transform_distance(pro, &sd->c[npos], &ri->lp);
      if (ri->lenneg || ri->lenpos)

Generated by  Doxygen 1.6.0   Back to index