]> err.no Git - mapper/commitdiff
Add some data fields to the path struct
authorKaj-Michael Lang <milang@onion.tal.org>
Fri, 7 Mar 2008 13:06:38 +0000 (15:06 +0200)
committerKaj-Michael Lang <milang@onion.tal.org>
Fri, 7 Mar 2008 13:06:38 +0000 (15:06 +0200)
src/path.h

index 108c25a03d27d224df914cc33139549d994b775c..65e19c1eaeb5e4bc8376d58fb9eebf98b3a636e6 100644 (file)
@@ -5,33 +5,33 @@
 #include <gtk/gtk.h>
 
 #define MACRO_PATH_INIT(path) { \
-    (path).head = (path).tail = g_new0(Point, ARRAY_CHUNK_SIZE); \
-    *((path).tail) = _point_null; \
-    (path).cap = (path).head + ARRAY_CHUNK_SIZE; \
-    (path).whead = g_new0(WayPoint, ARRAY_CHUNK_SIZE); \
-    (path).wtail = (path).whead - 1; \
-    (path).wcap = (path).whead + ARRAY_CHUNK_SIZE; \
+       (path).head = (path).tail = g_new0(Point, ARRAY_CHUNK_SIZE); \
+       *((path).tail) = _point_null; \
+       (path).cap = (path).head + ARRAY_CHUNK_SIZE; \
+       (path).whead = g_new0(WayPoint, ARRAY_CHUNK_SIZE); \
+       (path).wtail = (path).whead - 1; \
+       (path).wcap = (path).whead + ARRAY_CHUNK_SIZE; \
+       (path).length=(path).maxspeed=(path).tspeed=(path).avgspeed=(path).points=0; \
 }
 
 #define MACRO_PATH_FREE(path) if((path).head) { \
-    WayPoint *curr; \
-    g_free((path).head); \
-    (path).head = (path).tail = (path).cap = NULL; \
-    for(curr = (path).whead - 1; curr++ != (path).wtail; ) \
-        g_free(curr->desc); \
-    g_free((path).whead); \
-    (path).whead = (path).wtail = (path).wcap = NULL; \
+       WayPoint *curr; \
+       g_free((path).head); \
+       (path).head = (path).tail = (path).cap = NULL; \
+       for(curr = (path).whead - 1; curr++ != (path).wtail; ) \
+               g_free(curr->desc); \
+       g_free((path).whead); \
+       (path).whead = (path).wtail = (path).wcap = NULL; \
 }
 
 #define MACRO_PATH_INCREMENT_TAIL(route) { \
-    if(++(route).tail == (route).cap) \
-        path_resize(&(route), (route).cap - (route).head + ARRAY_CHUNK_SIZE);\
+       if(++(route).tail == (route).cap) \
+               path_resize(&(route), (route).cap - (route).head + ARRAY_CHUNK_SIZE);\
 }
 
 #define MACRO_PATH_INCREMENT_WTAIL(route) { \
-    if(++(route).wtail == (route).wcap) \
-        path_wresize(&(route), \
-                (route).wcap - (route).whead + ARRAY_CHUNK_SIZE); \
+       if(++(route).wtail == (route).wcap) \
+               path_wresize(&(route), (route).wcap - (route).whead + ARRAY_CHUNK_SIZE); \
 }
 
 /** A lat/lon/alt position */
@@ -68,6 +68,11 @@ struct _Path {
        WayPoint *whead;        /* points to first element in array; NULL if empty. */
        WayPoint *wtail;        /* points to last element in array. */
        WayPoint *wcap;         /* points after last slot in array. */
+       guint32 points;
+       gdouble length;
+       gdouble tspeed;
+       gdouble avgspeed;
+       gfloat maxspeed;
 };
 
 Point _point_null;