From a764697ab08316ed97fd504e084968a6429e71b6 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 8 Apr 2008 17:03:03 +0300 Subject: [PATCH] Add helper function to just check if location hasn't changed too much. --- src/osm-db.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/osm-db.c b/src/osm-db.c index 0550226..c1e4032 100644 --- a/src/osm-db.c +++ b/src/osm-db.c @@ -320,6 +320,7 @@ osmdb=NULL; osm_db_ok=FALSE; memset(&sql, 0, sizeof(sql)); g_hash_table_destroy(pcache.cache); +pcache.cache=NULL; pcache.hit=0; pcache.miss=0; g_timer_destroy(dbt); @@ -1004,6 +1005,19 @@ return FALSE; /******************************************************************************/ +/** + * Check if we have moved away from the last known street + */ +gboolean +osm_check_location(osm_location *map_loc, gint lat, gint lon) +{ +gdouble dist; +if (map_loc->street && osm_way_distance(lat, lon, map_loc->street->node_f, map_loc->street->node_t, &dist)==TRUE) { + return (dist>(gdouble)way_dist_range) ? FALSE : TRUE; +} else + return FALSE; +} + /** * Try to figure out where the given lat,lon is. Fills in the given struct, * with street, secondary (suburb) and primary (city,town,village) location. -- 2.39.5