#include "map-download.h"
#include "iap.h"
-void route_find_nearest_point();
+void route_find_nearest_point(void);
void cancel_autoroute(gboolean temporary);
+void route_show_distance_to_last(void);
+void route_set_destination_from_last(void);
typedef struct _OriginToggleInfo OriginToggleInfo;
struct _OriginToggleInfo {
route_find_nearest_point();
map_force_redraw();
}
+_dest.valid=FALSE;
gtk_widget_destroy(confirm);
}
map_force_redraw();
MACRO_BANNER_SHOW_INFO(_window, _("Route Opened"));
+ route_set_destination_from_last();
return TRUE;
} else {
popup_error(_window, _("Error parsing GPX file."));
MACRO_BANNER_SHOW_INFO(_window, _("Route Downloaded"));
g_free(rdl_data.bytes);
+ route_set_destination_from_last();
/* Success! Get out of the while loop. */
break;
}
}
+void
+route_set_destination_from_last(void)
+{
+Point *p;
+gdouble lat,lon;
+if (_route.head == _route.tail)
+ return;
+
+/* Find last non-zero point. */
+for (p = _route.tail; !p->unity; p--) {
+}
+unit2latlon(p->unitx, p->unity, lat, lon);
+_dest.valid=TRUE;
+_dest.lat=lat;
+_dest.lon=lon;
+}
+
void
-route_show_distance_to_last()
+route_show_distance_to_last(void)
{
+Point *p;
+
if (_route.head != _route.tail) {
/* Find last non-zero point. */
- Point *p;
for (p = _route.tail; !p->unity; p--) {
}
route_show_distance_to(p);