From: Kaj-Michael Lang Date: Thu, 9 Aug 2007 16:24:29 +0000 (+0300) Subject: Fixes X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a2eb6dbea6a99a13a3d9c64d1d92377cd271217;p=mapper Fixes --- diff --git a/src/latlon.c b/src/latlon.c index 025246f..6cb53b0 100644 --- a/src/latlon.c +++ b/src/latlon.c @@ -38,10 +38,10 @@ return (gdouble)lon/LATLON_MAX*180; gdouble mp_int2lat(gint lat) { - +return 0; } -gint +gulong calculate_idistance(gint lat1, gint lon1, gint lat2, gint lon2) { return lrint(sqrt((double)((lat1-lat2)*(lat1-lat2)+(lon1-lon2)*(lon1-lon2)))); @@ -50,7 +50,7 @@ return lrint(sqrt((double)((lat1-lat2)*(lat1-lat2)+(lon1-lon2)*(lon1-lon2)))); /** * Quick distance for comparing, skips the final square root */ -gint +gulong calculate_idistance_cmp(gint lat1, gint lon1, gint lat2, gint lon2) { return ((lat1-lat2)*(lat1-lat2)+(lon1-lon2)*(lon1-lon2)); diff --git a/src/latlon.h b/src/latlon.h index 52f39ca..1e4a581 100644 --- a/src/latlon.h +++ b/src/latlon.h @@ -11,6 +11,7 @@ gint32 lon2mp_int(gdouble lon); gint32 lat2mp_int(gdouble lat); gdouble calculate_distance(gdouble lat1, gdouble lon1, gdouble lat2, gdouble lon2); -gint calculate_idistance(gint lat1, gint lon1, gint lat2, gint lon2); +gulong calculate_idistance(gint lat1, gint lon1, gint lat2, gint lon2); +gulong calculate_idistance_cmp(gint lat1, gint lon1, gint lat2, gint lon2); #endif diff --git a/src/osm.h b/src/osm.h index d475d87..fe4eac0 100644 --- a/src/osm.h +++ b/src/osm.h @@ -173,7 +173,8 @@ struct _osm_location { osm_way *street; osm_place *primary; osm_place *secondary; - gdouble valid; + gboolean changed; + gboolean valid; gint lat; gint lon; }; diff --git a/src/route.c b/src/route.c index 50f9aa9..daf865e 100644 --- a/src/route.c +++ b/src/route.c @@ -26,6 +26,7 @@ #include "mapper-types.h" #include "map.h" #include "file.h" +#include "latlon.h" void route_find_nearest_point(); void cancel_autoroute(gboolean temporary); @@ -698,8 +699,7 @@ gboolean route_show_distance_to(Point * point) if (curr->unity) { unit2latlon(curr->unitx, curr->unity, lat2, lon2); - sum += - calculate_distance(lat1, lon1, lat2, lon2); + sum += calculate_distance(lat1, lon1, lat2, lon2); lat1 = lat2; lon1 = lon2; } @@ -711,8 +711,7 @@ gboolean route_show_distance_to(Point * point) if (curr->unity) { unit2latlon(curr->unitx, curr->unity, lat2, lon2); - sum += - calculate_distance(lat1, lon1, lat2, lon2); + sum += calculate_distance(lat1, lon1, lat2, lon2); lat1 = lat2; lon1 = lon2; } diff --git a/src/track.c b/src/track.c index 776c551..c255470 100644 --- a/src/track.c +++ b/src/track.c @@ -10,6 +10,7 @@ #include "file.h" #include "track.h" +#include "latlon.h" #include "path.h" struct sql_select_stmt { @@ -50,8 +51,6 @@ track_calculate_distance_from(Point * point) for (curr = _track.tail; curr > point; --curr) { if (curr->unity) { unit2latlon(curr->unitx, curr->unity, lat2, lon2); - g_printf("B:[%f %f %f %f (%f)]\n", lat1, lon1, lat2, - lon2, sum); sum += calculate_distance(lat1, lon1, lat2, lon2); lat1 = lat2; lon1 = lon2; @@ -361,4 +360,5 @@ while (GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog))) { break; } gtk_widget_destroy(dialog); +return TRUE; }