From: Kaj-Michael Lang Date: Mon, 7 Apr 2008 14:04:36 +0000 (+0300) Subject: Use road type (if known) as auto zoom base value: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f03121270e704ce6b4650182f29d05b804e74c20;p=mapper Use road type (if known) as auto zoom base value: - On "fast" roads zoom out more - On "moderate" roads stay close - On "slow" roads zoom in close --- diff --git a/src/map.c b/src/map.c index f9e549f..69182dd 100644 --- a/src/map.c +++ b/src/map.c @@ -1145,17 +1145,34 @@ map_autozoomer(void) { 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 (izdata.fix>1 && !force) 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)