From d61c088cf9927a960db7d24203856a4904c96bb1 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 13 Jun 2008 00:44:59 +0300 Subject: [PATCH] Path: Fix usage of latlon2unit and unit2latlon --- libs/libgtkmap/path.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/libs/libgtkmap/path.c b/libs/libgtkmap/path.c index 1ea01a7..acf7cf8 100644 --- a/libs/libgtkmap/path.c +++ b/libs/libgtkmap/path.c @@ -17,6 +17,16 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + +/** + * SECTION:path + * @short_description: A generic map path (track, route) + * @stability: unstable + * + * #Path is track or route object for displaying tracks or routes on GtkMaps. + * + */ + #include #include @@ -304,7 +314,7 @@ path_add_waypoint(Path *path, gdouble lat, gdouble lon, gchar *desc) { guint unitx, unity; -latlon2unit(lat, lon, unitx, unity); +latlon2unit(lat, lon, &unitx, &unity); MACRO_PATH_INCREMENT_TAIL(*path); path->tail->unitx=unitx; path->tail->unity=unity; @@ -338,13 +348,13 @@ path_add_latlon(Path *path, gdouble lat, gdouble lon, time_t ptime, gfloat speed { guint unitx, unity; -latlon2unit(lat, lon, unitx, unity); +latlon2unit(lat, lon, &unitx, &unity); if (abs((gint)unitx-path->tail->unitx) > path->sensitivity || abs((gint)unity-path->tail->unity) > path->sensitivity) { if (path->tail->unity && path->tail->unitx) { gdouble plat, plon; - unit2latlon(path->tail->unitx, path->tail->unity, lat, lon); + unit2latlon(path->tail->unitx, path->tail->unity, &plat, &plon); path->length+=calculate_distance(plat, plon, lat, lon); } MACRO_PATH_INCREMENT_TAIL(*path); @@ -573,7 +583,7 @@ path->next_way_dist_squared=-1; path->next_wpt=NULL; path->next_wpt_dist_squared=-1; -latlon2unit(lat, lon, p.unitx, p.unity); +latlon2unit(lat, lon, &p.unitx, &p.unity); path_update_nears(path, &p, FALSE); } @@ -591,7 +601,7 @@ Point pos = { 0, 0, 0, NAN }; g_return_val_if_fail(path, NULL); -latlon2unit(lat, lon, pos.unitx, pos.unity); +latlon2unit(lat, lon, &pos.unitx, &pos.unity); wcurr=wnear=path->whead; if (wcurr && wcurr->point && wcurr!=path->wtail) { @@ -704,7 +714,7 @@ if (point > path->near_point) { /* Skip _near_point in case we have already passed it. */ for (curr = path->near_point + 1; curr <= point; ++curr) { if (curr->unity) { - unit2latlon(curr->unitx, curr->unity, lat2, lon2); + unit2latlon(curr->unitx, curr->unity, &lat2, &lon2); sum += calculate_distance(lat1, lon1, lat2, lon2); lat1 = lat2; lon1 = lon2; @@ -715,7 +725,7 @@ if (point > path->near_point) { /* Skip near_point in case we have already passed it. */ for (curr = path->near_point - 1; curr >= point; --curr) { if (curr->unity) { - unit2latlon(curr->unitx, curr->unity, lat2, lon2); + unit2latlon(curr->unitx, curr->unity, &lat2, &lon2); sum += calculate_distance(lat1, lon1, lat2, lon2); lat1 = lat2; lon1 = lon2; @@ -723,7 +733,7 @@ if (point > path->near_point) { } } else { /* Waypoint _is_ the nearest point. */ - unit2latlon(path->near_point->unitx, path->near_point->unity, lat2, lon2); + unit2latlon(path->near_point->unitx, path->near_point->unity, &lat2, &lon2); sum += calculate_distance(lat1, lon1, lat2, lon2); } return sum; @@ -811,7 +821,7 @@ g_return_val_if_fail(way->point, FALSE); g_return_val_if_fail(lat, FALSE); g_return_val_if_fail(lon, FALSE); -unit2latlon(way->point->unitx, way->point->unity, tlat, tlon); +unit2latlon(way->point->unitx, way->point->unity, &tlat, &tlon); *lat=tlat; *lon=tlon; @@ -1376,7 +1386,7 @@ path_store_append_waypoint(GtkListStore *, WayPoint *w) gchar tmp1[16], tmp2[16]; gdouble lat2, lon2; -unit2latlon(wcurr->point->unitx, wcurr->point->unity, lat2, lon2); +unit2latlon(wcurr->point->unitx, wcurr->point->unity, &lat2, &lon2); lat_format(_degformat, lat2, tmp1); lon_format(_degformat, lon2, tmp2); @@ -1424,7 +1434,7 @@ if (!path_has_waypoints(path)) 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); +unit2latlon(wcurr->point->unitx, wcurr->point->unity, &lat1, &lon1); while (wcurr!=path->wtail) { if (!wcurr) @@ -1436,7 +1446,7 @@ while (wcurr!=path->wtail) { continue; } - unit2latlon(wcurr->point->unitx, wcurr->point->unity, lat2, lon2); + unit2latlon(wcurr->point->unitx, wcurr->point->unity, &lat2, &lon2); lat_format(degformat, lat2, tmp1); lon_format(degformat, lon2, tmp2); -- 2.39.5