]> err.no Git - mapper/commitdiff
Fixes
authorKaj-Michael Lang <milang@onion.tal.org>
Thu, 9 Aug 2007 16:24:29 +0000 (19:24 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Thu, 9 Aug 2007 16:24:29 +0000 (19:24 +0300)
src/latlon.c
src/latlon.h
src/osm.h
src/route.c
src/track.c

index 025246f7fac642f32a25ead73039c9b709da2fb6..6cb53b048c1f0789a2ba41571c789ef996012456 100644 (file)
@@ -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));
index 52f39ca2fd93c305743b4305865f8be5230af014..1e4a581b8a1c57ba960e6404c4ab34ca17c04146 100644 (file)
@@ -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
index d475d87ba07a1c38a703578ff358449eeec0e59f..fe4eac06a84f88c249b88eb62ee5541ef94b40a2 100644 (file)
--- 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;
 };
index 50f9aa9a64193829c59fbfdb1ec07341d28634fc..daf865e056a8027250ceaf2d93d6376d8bec9054 100644 (file)
@@ -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;
                        }
index 776c551b22f67e7e91b2cc8eef7bb2eea4a1d5ac..c2554703c3b5ab9a14c8b8a6a437438cedc61efd 100644 (file)
@@ -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;
 }