From 10ecbc3603688e46a61c773956f556f3d272ebc8 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Wed, 8 Aug 2007 13:39:23 +0300 Subject: [PATCH] Query place only if have moved from the previously known way. --- src/map.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/map.c b/src/map.c index 3149943..047bde0 100644 --- 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); -- 2.39.5