7 #define MACRO_PATH_INIT(path) { \
8 (path).head = (path).tail = g_new0(Point, ARRAY_CHUNK_SIZE); \
9 *((path).tail) = _point_null; \
10 (path).cap = (path).head + ARRAY_CHUNK_SIZE; \
11 (path).whead = g_new0(WayPoint, ARRAY_CHUNK_SIZE); \
12 (path).wtail = (path).whead - 1; \
13 (path).wcap = (path).whead + ARRAY_CHUNK_SIZE; \
14 (path).length=(path).maxspeed=(path).tspeed=(path).avgspeed=(path).points=0; \
17 #define MACRO_PATH_FREE(path) if((path).head) { \
19 g_free((path).head); \
20 (path).head = (path).tail = (path).cap = NULL; \
21 for(curr = (path).whead - 1; curr++ != (path).wtail; ) \
23 g_free((path).whead); \
24 (path).whead = (path).wtail = (path).wcap = NULL; \
27 #define MACRO_PATH_INCREMENT_TAIL(route) { \
28 if(++(route).tail == (route).cap) \
29 path_resize(&(route), (route).cap - (route).head + ARRAY_CHUNK_SIZE);\
32 #define MACRO_PATH_INCREMENT_WTAIL(route) { \
33 if(++(route).wtail == (route).wcap) \
34 path_wresize(&(route), (route).wcap - (route).whead + ARRAY_CHUNK_SIZE); \
37 /** A lat/lon/alt position */
38 typedef struct _Position Position;
49 /** A general definition of a point in the Mapper unit system. */
50 typedef struct _Point Point;
58 /** A WayPoint, which is a Point with a description. */
59 typedef struct _WayPoint WayPoint;
65 /** A Path is a set of PathPoints and WayPoints. */
66 typedef struct _Path Path;
69 Point *head; /* points to first element in array; NULL if empty. */
70 Point *tail; /* points to last element in array. */
71 Point *cap; /* points after last slot in array. */
74 WayPoint *whead; /* points to first element in array; NULL if empty. */
75 WayPoint *wtail; /* points to last element in array. */
76 WayPoint *wcap; /* points after last slot in array. */
85 /* GPX metadata fields */
98 /* Special positions */
102 void path_resize(Path *path, guint size);
103 void path_wresize(Path *path, guint wsize);
105 GtkListStore *path_generate_store(Path *path);