From 927a1f19ab8661d34f02a6402a2facd707192834 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 7 Mar 2008 15:08:56 +0200 Subject: [PATCH] Format displayed lat,lon properly in path store generation. Add some debuging. --- src/path.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/path.c b/src/path.c index 04b39a1..9dc7d01 100644 --- a/src/path.c +++ b/src/path.c @@ -89,6 +89,7 @@ GtkTreeIter iter; GtkListStore *store; gchar buffer1[80]; gchar buffer2[32]; +gchar tmp1[16], tmp2[16]; gdouble lat1, lon1, lat2, lon2; gdouble sum=0.0; @@ -105,17 +106,24 @@ if (!wcurr->point) unit2latlon(wcurr->point->unitx, wcurr->point->unity, lat1, lon1); -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(ROUTE_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_DOUBLE); while (wcurr!=path->wtail) { - if (!wcurr) + if (!wcurr) { break; + } - if (!wcurr->point) - break; + if (!wcurr->point) { + g_debug("No point for waypoint (%s) skipping", wcurr->desc); + wcurr++; + continue; + } unit2latlon(wcurr->point->unitx, wcurr->point->unity, lat2, lon2); - g_snprintf(buffer1, sizeof(buffer1), "%.05f,%.05f", lat2, lon2); + lat_format(_degformat, lat2, tmp1); + lon_format(_degformat, lon2, tmp2); + + g_snprintf(buffer1, sizeof(buffer1), "%s,%s", tmp1, tmp2); sum += calculate_distance(lat1, lon1, lat2, lon2); g_snprintf(buffer2, sizeof(buffer2), "%.02f %s", sum * UNITS_CONVERT[_units], UNITS_TEXT[_units]); -- 2.39.5