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; \
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), (route).wcap - (route).whead + ARRAY_CHUNK_SIZE); \
36 /** A lat/lon/alt position */
37 typedef struct _Position Position;
44 gfloat angle; /* Course from current position to this one */
46 guint type; /* Type of 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 Path *path_new(void);
103 void path_free(Path *p);
105 void path_insert_mark_text(Path *path, gchar *text);
107 void path_resize(Path *path, guint size);
108 void path_wresize(Path *path, guint wsize);
110 GtkListStore *path_generate_store(Path *path);