7 #define MACRO_PATH_INIT(path) { \
8 (path).head = (path).tail = g_new(Point, ARRAY_CHUNK_SIZE); \
9 *((path).tail) = _point_null; \
10 (path).cap = (path).head + ARRAY_CHUNK_SIZE; \
11 (path).whead = g_new(WayPoint, ARRAY_CHUNK_SIZE); \
12 (path).wtail = (path).whead - 1; \
13 (path).wcap = (path).whead + ARRAY_CHUNK_SIZE; \
16 #define MACRO_PATH_FREE(path) if((path).head) { \
18 g_free((path).head); \
19 (path).head = (path).tail = (path).cap = NULL; \
20 for(curr = (path).whead - 1; curr++ != (path).wtail; ) \
22 g_free((path).whead); \
23 (path).whead = (path).wtail = (path).wcap = NULL; \
26 #define MACRO_PATH_INCREMENT_TAIL(route) { \
27 if(++(route).tail == (route).cap) \
28 path_resize(&(route), (route).cap - (route).head + ARRAY_CHUNK_SIZE);\
31 #define MACRO_PATH_INCREMENT_WTAIL(route) { \
32 if(++(route).wtail == (route).wcap) \
33 path_wresize(&(route), \
34 (route).wcap - (route).whead + ARRAY_CHUNK_SIZE); \
37 /** A lat/lon/alt position */
38 typedef struct _Position Position;
46 /** A general definition of a point in the Mapper unit system. */
47 typedef struct _Point Point;
55 /** A WayPoint, which is a Point with a description. */
56 typedef struct _WayPoint WayPoint;
62 /** A Path is a set of PathPoints and WayPoints. */
63 typedef struct _Path Path;
65 Point *head; /* points to first element in array; NULL if empty. */
66 Point *tail; /* points to last element in array. */
67 Point *cap; /* points after last slot in array. */
68 WayPoint *whead; /* points to first element in array; NULL if empty. */
69 WayPoint *wtail; /* points to last element in array. */
70 WayPoint *wcap; /* points after last slot in array. */
77 void path_resize(Path *path, guint size);
78 void path_wresize(Path *path, guint wsize);
80 GtkListStore *path_generate_store(Path *path);