-void path_resize(Path * path, guint size)
+#include <config.h>
+
+#include "utils.h"
+#include "map.h"
+#include "route.h"
+#include "mapper-types.h"
+
+#include "track.h"
+
+void
+path_resize(Path * path, guint size)
{
- printf("%s()\n", __PRETTY_FUNCTION__);
-
- if (path->head + size != path->cap) {
- Point *old_head = path->head;
- WayPoint *curr;
- path->head = g_renew(Point, old_head, size);
- path->cap = path->head + size;
- if (path->head != old_head) {
- path->tail = path->head + (path->tail - old_head);
-
- /* Adjust all of the waypoints. */
- for (curr = path->whead - 1; curr++ != path->wtail;)
- curr->point =
- path->head + (curr->point - old_head);
- }
- }
+printf("%s()\n", __PRETTY_FUNCTION__);
+
+if (path->head + size != path->cap) {
+ Point *old_head = path->head;
+ WayPoint *curr;
+ path->head = g_renew(Point, old_head, size);
+ path->cap = path->head + size;
+ if (path->head != old_head) {
+ path->tail = path->head + (path->tail - old_head);
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+ /* Adjust all of the waypoints. */
+ for (curr = path->whead - 1; curr++ != path->wtail;)
+ curr->point =
+ path->head + (curr->point - old_head);
+ }
+}
+vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-void path_wresize(Path * path, guint wsize)
+void
+path_wresize(Path * path, guint wsize)
{
- printf("%s()\n", __PRETTY_FUNCTION__);
+printf("%s()\n", __PRETTY_FUNCTION__);
- if (path->whead + wsize != path->wcap) {
- WayPoint *old_whead = path->whead;
- path->whead = g_renew(WayPoint, old_whead, wsize);
- path->wtail = path->whead + (path->wtail - old_whead);
- path->wcap = path->whead + wsize;
- }
+if (path->whead + wsize != path->wcap) {
+ WayPoint *old_whead = path->whead;
+ path->whead = g_renew(WayPoint, old_whead, wsize);
+ path->wtail = path->whead + (path->wtail - old_whead);
+ path->wcap = path->whead + wsize;
+}
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
#include "file.h"
#include "track.h"
-
-void path_resize(Path * path, guint size)
-{
- printf("%s()\n", __PRETTY_FUNCTION__);
-
- if (path->head + size != path->cap) {
- Point *old_head = path->head;
- WayPoint *curr;
- path->head = g_renew(Point, old_head, size);
- path->cap = path->head + size;
- if (path->head != old_head) {
- path->tail = path->head + (path->tail - old_head);
-
- /* Adjust all of the waypoints. */
- for (curr = path->whead - 1; curr++ != path->wtail;)
- curr->point =
- path->head + (curr->point - old_head);
- }
- }
-
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
-}
-
-void path_wresize(Path * path, guint wsize)
-{
- printf("%s()\n", __PRETTY_FUNCTION__);
-
- if (path->whead + wsize != path->wcap) {
- WayPoint *old_whead = path->whead;
- path->whead = g_renew(WayPoint, old_whead, wsize);
- path->wtail = path->whead + (path->wtail - old_whead);
- path->wcap = path->whead + wsize;
- }
-
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
-}
-
-void track_clear()
+#include "path.h"
+
+struct sql_select_stmt {
+ sqlite3_stmt *select_track;
+ sqlite3_stmt *select_track_nodes;
+ sqlite3_stmt *insert_track;
+ sqlite3_stmt *insert_track_node;
+ sqlite3_stmt *delete_track_nodes;
+ sqlite3_stmt *delete_track;
+};
+static struct sql_select_stmt sql;
+
+void
+track_clear(void)
{
GtkWidget *confirm;
gtk_widget_destroy(confirm);
}
-gfloat track_calculate_distance_from(Point * point)
+gfloat
+track_calculate_distance_from(Point * point)
{
gfloat lat1, lon1, lat2, lon2;
gfloat sum = 0.0;
return sum;
}
-void track_show_distance_from(Point * point)
+void
+track_show_distance_from(Point * point)
{
gchar buffer[80];
gfloat sum;
MACRO_BANNER_SHOW_INFO(_window, buffer);
}
-void track_show_distance_from_last()
+void
+track_show_distance_from_last()
{
printf("%s()\n", __PRETTY_FUNCTION__);
printf("%s(): return\n", __PRETTY_FUNCTION__);
}
-void track_show_distance_from_first()
+void
+track_show_distance_from_first()
{
printf("%s()\n", __PRETTY_FUNCTION__);
* then _point_null is appended to _track with time zero (this produces a "break"
* in the track).
*/
-void track_add(time_t time, gboolean newly_fixed)
+void
+track_add(time_t time, gboolean newly_fixed)
{
gboolean show_directions = TRUE;
gint announce_thres_unsquared;
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-void track_insert_break(void)
+void
+track_insert_break(void)
{
- printf("%s()\n", __PRETTY_FUNCTION__);
-
- if (_track.tail->unity) {
- guint x1, y1;
+printf("%s()\n", __PRETTY_FUNCTION__);
- /* To mark a "waypoint" in a track, we'll add a (0, 0) point and then
- * another instance of the most recent track point. */
- MACRO_PATH_INCREMENT_TAIL(_track);
- *_track.tail = _point_null;
- MACRO_PATH_INCREMENT_TAIL(_track);
- *_track.tail = _track.tail[-2];
-
- /** Instead of calling map_render_paths(), we'll just add the waypoint
- * ourselves. */
- x1 = unit2bufx(_track.tail->unitx);
- y1 = unit2bufy(_track.tail->unity);
- /* Make sure this circle will be visible. */
- if ((x1 < BUF_WIDTH_PIXELS) && ((unsigned)y1 < BUF_HEIGHT_PIXELS))
- gdk_draw_arc(_map_pixmap, _gc[COLORABLE_TRACK_BREAK], FALSE, /* FALSE: not filled. */
- x1 - _draw_width, y1 - _draw_width, 2 * _draw_width, 2 * _draw_width, 0, /* start at 0 degrees. */
- 360 * 64);
- } else {
- MACRO_BANNER_SHOW_INFO(_window, _("Break already inserted."));
- }
+if (_track.tail->unity) {
+ guint x1, y1;
+
+/* To mark a "waypoint" in a track, we'll add a (0, 0) point and then
+ * another instance of the most recent track point. */
+MACRO_PATH_INCREMENT_TAIL(_track);
+*_track.tail = _point_null;
+MACRO_PATH_INCREMENT_TAIL(_track);
+*_track.tail = _track.tail[-2];
+
+/** Instead of calling map_render_paths(), we'll just add the waypoint
+ * ourselves. */
+x1 = unit2bufx(_track.tail->unitx);
+y1 = unit2bufy(_track.tail->unity);
+/* Make sure this circle will be visible. */
+if ((x1 < BUF_WIDTH_PIXELS) && ((unsigned)y1 < BUF_HEIGHT_PIXELS))
+ gdk_draw_arc(_map_pixmap, _gc[COLORABLE_TRACK_BREAK], FALSE, /* FALSE: not filled. */
+ x1 - _draw_width, y1 - _draw_width, 2 * _draw_width, 2 * _draw_width, 0, /* start at 0 degrees. */
+ 360 * 64);
+} else {
+ MACRO_BANNER_SHOW_INFO(_window, _("Break already inserted."));
+}
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-gboolean track_open(void)
+gboolean
+track_open(void)
{
- gchar *buffer;
- gint size;
- gboolean r = FALSE;
-
- if (open_file(&buffer, NULL, &size, NULL, &_track_file_uri, GTK_FILE_CHOOSER_ACTION_OPEN)) {
- if (parse_gpx(&_track, buffer, size, -1)) {
- map_force_redraw();
- MACRO_BANNER_SHOW_INFO(_window, _("Track Opened"));
- r = TRUE;
- } else {
- popup_error(_window, _("Error parsing GPX file."));
- }
- g_free(buffer);
+gchar *buffer;
+gint size;
+gboolean r = FALSE;
+
+if (open_file(&buffer, NULL, &size, NULL, &_track_file_uri, GTK_FILE_CHOOSER_ACTION_OPEN)) {
+ if (parse_gpx(&_track, buffer, size, -1)) {
+ map_force_redraw();
+ MACRO_BANNER_SHOW_INFO(_window, _("Track Opened"));
+ r = TRUE;
+ } else {
+ popup_error(_window, _("Error parsing GPX file."));
}
- return r;
+ g_free(buffer);
+}
+return r;
}
-gboolean track_save(void)
+gboolean
+track_save(void)
{
- GnomeVFSHandle *handle;
- gboolean r = FALSE;
-
- if (file_save(&_track_file_uri, &_track_file_uri, &handle)) {
- if (write_gpx(&_track, handle)) {
- MACRO_BANNER_SHOW_INFO(_window, _("Track Saved"));
- r = TRUE;
- } else {
- popup_error(_window, _("Error writing GPX file."));
- }
- gnome_vfs_close(handle);
+GnomeVFSHandle *handle;
+gboolean r = FALSE;
+
+if (file_save(&_track_file_uri, &_track_file_uri, &handle)) {
+ if (write_gpx(&_track, handle)) {
+ MACRO_BANNER_SHOW_INFO(_window, _("Track Saved"));
+ r = TRUE;
+ } else {
+ popup_error(_window, _("Error writing GPX file."));
}
- return r;
+ gnome_vfs_close(handle);
+}
+return r;
}
/**
* Add a text description at current point
*
*/
-void track_insert_mark_text(gchar *text)
+void
+track_insert_mark_text(gchar *text)
{
MACRO_PATH_INCREMENT_WTAIL(_track);
_track.wtail->point = _track.tail;
* Ask for a text description for the current point
*
*/
-
-gboolean track_insert_mark(void)
+gboolean
+track_insert_mark(void)
{
gfloat lat, lon;
gchar tmp1[16], tmp2[16], *p_latlon;
#include <glib.h>
#include <sqlite3.h>
-void track_add(time_t time, gboolean newly_fixed);
-void track_insert_break(void);
-gboolean track_insert_mark(void);
-gboolean track_save(void);
-gboolean track_open(void);
-
-void track_show_distance_from_first();
-void track_show_distance_from_last();
-void track_show_distance_from(Point * point);
-void path_wresize(Path * path, guint wsize);
-void path_resize(Path * path, guint size);
-
#define TRACK_SQL_SELECT_TRACKS "select id,name,sloc,eloc,sdate,edate from tracks order by sdate"
#define TRACK_SQL_INSERT_TRACK "insert into tracks (id,name,sloc,sdate) values (?,?,?,?);
#define TRACK_SQL_INSERT_TRACK_POINT "insert into trackpoints (tid,dt,lat,lon,alt,hdop,vdop,pdop,sat,fix) values (?,?,?,?,?,?,?,?,?,?)"
sqlite3_stmt *_select_track_points;
} track_sql;
+void track_add(time_t time, gboolean newly_fixed);
+void track_insert_break(void);
+gboolean track_insert_mark(void);
+gboolean track_save(void);
+gboolean track_open(void);
+void track_clear(void);
+
+void track_show_distance_from_first();
+void track_show_distance_from_last();
+void track_show_distance_from(Point * point);
+
#endif