]> err.no Git - mapper/commitdiff
Query place only if have moved from the previously known way.
authorKaj-Michael Lang <milang@angel.tal.org>
Wed, 8 Aug 2007 10:39:23 +0000 (13:39 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Wed, 8 Aug 2007 10:39:23 +0000 (13:39 +0300)
src/map.c

index 3149943be24bcb8fe5e9e929d9db3c728e1a86d0..047bde09c81f45d7b65ed7a49437078891789859 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -1403,7 +1403,7 @@ map_update_location(gint x, gint y)
 {
 gint ilat, ilon;
 gdouble lat,lon, dist;
-gboolean fs;
+gboolean fs, check_place=FALSE;
 static gboolean inp=FALSE;
 
 /* We run the gtk mainloop in progress callback so we can be called again, we don't like that */
@@ -1422,17 +1422,22 @@ if (map_loc.street && osm_way_distance(ilat, ilon, map_loc.street->node_f, map_l
        if (dist>15000.0) {
                osm_way_free(map_loc.street);
                map_loc.street=osm_find_nearest_way(ilat, ilon);
+               check_place=FALSE;
+       } else {
+               check_place=FALSE;
        }
 } else {
        osm_way_free(map_loc.street);
        map_loc.street=osm_find_nearest_way(ilat, ilon);
+       check_place=TRUE;
 }
 
 _map_location_known=map_loc.street ? TRUE : FALSE;
 _map_location_dist=map_loc.street ? map_loc.street->dist : 900000.0;
 
-fs=osm_find_nearest_place(NODE_PLACE_SUBURB, ilat, ilon, &map_loc.secondary);
+if (check_place==TRUE) {
 
+fs=osm_find_nearest_place(NODE_PLACE_SUBURB, ilat, ilon, &map_loc.secondary);
 if (fs==TRUE && map_loc.secondary && map_loc.secondary->isin!=0) {
        if (osm_place_get(map_loc.secondary->isin, ilat, ilon, &map_loc.primary)==FALSE) {
                if (osm_find_nearest_place(NODE_PLACE_CITY, ilat, ilon, &map_loc.primary)==TRUE)
@@ -1459,6 +1464,7 @@ if (fs==TRUE && map_loc.secondary && map_loc.secondary->isin!=0) {
                g_printf("Unknown\n");
 
 }
+}
 
 map_set_place_information(map_loc.street, map_loc.primary, map_loc.secondary);
 osm_progress_set_widget(_db, NULL);