#include <gtk/gtk.h>
#include <curl/multi.h>
-/* Route list */
-typedef enum {
- ROUTE_LATLON,
- ROUTE_DISTANCE,
- ROUTE_WAYPOINT,
- ROUTE_LAT,
- ROUTE_LON,
- ROUTE_NUM_COLUMNS
-} RouteList;
-
/** This enum defines the possible font sizes. */
typedef enum {
INFO_FONT_XXSMALL,
*/
#include <config.h>
+#include <glib.h>
#include <gtk/gtk.h>
+#include <sqlite3.h>
-#include "mapper-types.h"
#include "path.h"
+#include "position.h"
#include "utils.h"
-#include "track.h"
-#include "route.h"
#include "gps.h"
#include "settings.h"
#include "latlon.h"
Point *p;
gdouble lat,lon;
-g_return_val_if_fail(route, FALSE);
+g_return_val_if_fail(path, FALSE);
g_return_val_if_fail(pos, FALSE);
if (path->head==path->tail) {
return FALSE;
}
-p=path_find_last_point(route);
+p=path_find_last_point(path);
if (p) {
unit2latlon(p->unitx, p->unity, &lat, &lon);
position_set(pos, TRUE, lat, lon, 0);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
- ROUTE_LATLON, buffer1,
- ROUTE_DISTANCE, buffer2,
- ROUTE_WAYPOINT, wcurr->desc,
- ROUTE_LAT, lat2,
- ROUTE_LON, lon2,
+ PATH_LATLON, buffer1,
+ PATH_DISTANCE, buffer2,
+ PATH_WAYPOINT, wcurr->desc,
+ PATH_LAT, lat2,
+ PATH_LON, lon2,
-1);
lat1=lat2;
if (!path_has_waypoints(path))
return NULL;
-store=gtk_list_store_new(ROUTE_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
+store=gtk_list_store_new(PATH_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
unit2latlon(wcurr->point->unitx, wcurr->point->unity, lat1, lon1);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
- ROUTE_LATLON, buffer1,
- ROUTE_DISTANCE, buffer2,
- ROUTE_WAYPOINT, wcurr->desc,
- ROUTE_LAT, lat2,
- ROUTE_LON, lon2,
+ PATH_LATLON, buffer1,
+ PATH_DISTANCE, buffer2,
+ PATH_WAYPOINT, wcurr->desc,
+ PATH_LAT, lat2,
+ PATH_LON, lon2,
-1);
lat1=lat2;
PATH_TYPE_FRIEND,
} PathType;
+/* Path store items */
+typedef enum {
+ PATH_LATLON,
+ PATH_DISTANCE,
+ PATH_WAYPOINT,
+ PATH_LAT,
+ PATH_LON,
+ PATH_NUM_COLUMNS
+} PathStoreList;
+
+
/* Fixed ID's */
#define PATH_ID_MY_TRACK (1)
#define PATH_ID_MY_ROUTE (2)
gdouble path_get_distance_to(Path *path, Point *point, gdouble lat, gdouble lon);
+void path_find_nearest_point(Path *path);
gboolean path_update_nears(Path *route, Point *point, gboolean quick);
gboolean path_insert_break(Path *path);
g_return_val_if_fail(route, FALSE);
g_return_val_if_fail(point, FALSE);
-unit2latlon(_gps->data.unitx, _gps->data.unity, lat, lon);
+unit2latlon(point->unitx, point->unity, &lat, &lon);
sum=path_get_distance_to(route, point, lat, lon);
g_snprintf(buffer, sizeof(buffer), "%s: %.02f %s", _("Distance"), sum * UNITS_CONVERT[_units], UNITS_TEXT[_units]);
MACRO_BANNER_SHOW_INFO(_window, buffer);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), TRUE);
renderer=gtk_cell_renderer_text_new();
-column=gtk_tree_view_column_new_with_attributes(_("Location"), renderer, "text", ROUTE_LATLON, NULL);
+column=gtk_tree_view_column_new_with_attributes(_("Location"), renderer, "text", PATH_LATLON, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
renderer=gtk_cell_renderer_text_new();
-column=gtk_tree_view_column_new_with_attributes(_("Distance"), renderer, "text", ROUTE_DISTANCE, NULL);
+column=gtk_tree_view_column_new_with_attributes(_("Distance"), renderer, "text", PATH_DISTANCE, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
renderer=gtk_cell_renderer_text_new();
-column=gtk_tree_view_column_new_with_attributes(_("Waypoint"), renderer, "text", ROUTE_WAYPOINT, NULL);
+column=gtk_tree_view_column_new_with_attributes(_("Waypoint"), renderer, "text", PATH_WAYPOINT, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
return tree_view;