Logo Search packages:      
Sourcecode: navit version File versions

static int get_item_seg_coords ( struct item *  i,
struct coord c,
int  max,
struct coord start,
struct coord end 
) [static]

Gets all the coordinates of an item.

This will get all the coordinates of the item i and return them in c, up to max coordinates. Additionally it is possible to limit the coordinates returned to all the coordinates of the item between the two coordinates start end end.

Make shure that whatever c points to has enough memory allocated to hold max coordinates!

i The item to get the coordinates of
c Pointer to memory allocated for holding the coordinates
max Maximum number of coordinates to return
start First coordinate to get
end Last coordinate to get
The number of coordinates returned

Definition at line 1144 of file route.c.

References map_rect_destroy(), map_rect_get_item_byid(), map_rect_new(), coord::x, and coord::y.

Referenced by route_path_add_item_from_graph().

      struct map_rect *mr;
      struct item *item;
      int rc = 0, p = 0;
      struct coord c1;
      mr=map_rect_new(i->map, NULL);
      if (!mr)
            return 0;
      item = map_rect_get_item_byid(mr, i->id_hi, i->id_lo);
      if (item) {
            rc = item_coord_get(item, &c1, 1);
            while (rc && (c1.x != start->x || c1.y != start->y)) {
                  rc = item_coord_get(item, &c1, 1);
            while (rc && p < max) {
                  c[p++] = c1;
                  if (c1.x == end->x && c1.y == end->y)
                  rc = item_coord_get(item, &c1, 1);
      return p;

Generated by  Doxygen 1.6.0   Back to index