]> err.no Git - mapper/commitdiff
Add helper function to just check if location hasn't changed too much.
authorKaj-Michael Lang <milang@tal.org>
Tue, 8 Apr 2008 14:03:03 +0000 (17:03 +0300)
committerKaj-Michael Lang <milang@tal.org>
Tue, 8 Apr 2008 14:03:03 +0000 (17:03 +0300)
src/osm-db.c

index 055022603e5c7fa9fb19d81ff44489aa7dbe23b5..c1e4032a8ceccc6113d7d7f1b8577e487000d541 100644 (file)
@@ -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.