Logo Search packages:      
Sourcecode: navit version File versions

static int rp_coord_get ( void *  priv_data,
struct coord c,
int  count 
) [static]

Returns the coordinates of a route graph item.

Parameters:
priv_data The route graph item's private data
c Pointer where to store the coordinates
count How many coordinates to get at a max?
Returns:
The number of coordinates retrieved

Definition at line 2717 of file route.c.

References route_graph_point::c, route_graph_segment::end, route_projection(), route_graph_point::seg, and route_graph_segment::start.

{
      struct map_rect_priv *mr = priv_data;
      struct route_graph_point *p = mr->point;
      struct route_graph_segment *seg = mr->rseg;
      int rc = 0,i,dir;
      struct route *r = mr->mpriv->route;
      enum projection pro = route_projection(r);

      if (pro == projection_none)
            return 0;
      for (i=0; i < count; i++) {
            if (mr->item.type == type_rg_point) {
                  if (mr->last_coord >= 1)
                        break;
                  if (pro != projection_mg)
                        transform_from_to(&p->c, pro,
                              &c[i],projection_mg);
                  else
                        c[i] = p->c;
            } else {
                  if (mr->last_coord >= 2)
                        break;
                  dir=0;
                  if (seg->end->seg == seg)
                        dir=1;
                  if (mr->last_coord)
                        dir=1-dir;
                  if (dir) {
                        if (pro != projection_mg)
                              transform_from_to(&seg->end->c, pro,
                                    &c[i],projection_mg);
                        else
                              c[i] = seg->end->c;
                  } else {
                        if (pro != projection_mg)
                              transform_from_to(&seg->start->c, pro,
                                    &c[i],projection_mg);
                        else
                              c[i] = seg->start->c;
                  }
            }
            mr->last_coord++;
            rc++;
      }
      return rc;
}


Generated by  Doxygen 1.6.0   Back to index