{
static gfloat z=5.0;
static gint last=5;
+gint b=0;
gint iz;
if (zoom_timeout_sid==0)
return FALSE;
+/* If location is known, use road type and speed for zoom setting */
+if (map_loc.valid && map_loc.street) {
+ switch (map_loc.street->type) {
+ case WAY_MOTORWAY:
+ case WAY_TRUNK:
+ b=2;
+ break;
+ case WAY_PRIMARY:
+ case WAY_SECONDARY:
+ b=1;
+ break;
+ default:
+ b=0;
+ break;
+ }
+}
+
z=(z+_gps->data.speed+1)/5;
+z+=b;
if (z>5) z=5.0; else if (z<1) z=1.0;
iz=(gint)roundf(z);
-#ifdef DEBUG
g_debug("Setting autozoom to: %f %d S:%f\n", z, iz, _gps->data.speed);
-#endif
if (iz>last)
iz=last+1;
else if (iz<last)
map_set_autozoom(gboolean az, gfloat speed)
{
if (az==TRUE) {
- MACRO_BANNER_SHOW_INFO(_window, "Autozoom enabled");
zoom_timeout_sid=g_timeout_add(speed<5 ? 2000 : 5000, (GSourceFunc) map_autozoomer, NULL);
+ MACRO_BANNER_SHOW_INFO(_window, "Autozoom enabled");
return;
} else {
if (zoom_timeout_sid) {
else
osm_set_way_range(2800);
+/* XXX: Don't pulse progress if we don't need to check location ! */
osm_progress_set_widget(_db, _progress_item);
osm_get_location_data(ilat, ilon, _gps->data.heading, &map_loc);
if (map_loc.valid)