From 09a415a5aa6ff41a9cecf4f609b89a3e99558f03 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Mon, 5 Nov 2007 19:20:48 +0200 Subject: [PATCH] Use lat, lon for location query --- src/map.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/map.c b/src/map.c index 386fa43..1ca3299 100644 --- a/src/map.c +++ b/src/map.c @@ -86,7 +86,7 @@ struct _map_tile_rdata { void map_render_paths(); void map_force_redraw(); -static void map_update_location(gint x, gint y, gboolean force); +static void map_update_location(gdouble lat, gdouble lon, gboolean force); void map_draw_position_icon(Position *pos); /******************************************************************************/ @@ -552,13 +552,14 @@ gtk_widget_queue_draw_area(_map_widget, gboolean map_update_location_from_gps(void) { -map_update_location(_pos.unitx, _pos.unity, FALSE); +map_update_location(_gps.lat, _gps.lon, FALSE); return FALSE; } gboolean map_update_location_from_center(void) { +gdouble lat, lon; /* Force re-validation of place if user is clicking around */ map_loc.valid=FALSE; /* XXX: hmm, not the right place for this */ @@ -567,7 +568,8 @@ if (_gps.fix<2) { _pos.unity=_center.unity; unit2latlon(_pos.unitx, _pos.unity, _gps.lat, _gps.lon); } -map_update_location(_center.unitx, _center.unity, TRUE); +unit2latlon(_center.unitx, _center.unity, lat, lon); +map_update_location(lat, lon, TRUE); return FALSE; } @@ -916,15 +918,12 @@ return TRUE; int map_zoom(gint zdir) { -gchar buffer[80]; gint nzoom; -nzoom = _zoom + zdir; - +nzoom=_zoom+zdir; if ((nzoom > 0) && (nzoom < MAX_ZOOM - 1)) { map_set_zoom(nzoom); } - return nzoom; } @@ -1073,10 +1072,9 @@ if (_next_way && _next_way->point) { } static void -map_update_location(gint x, gint y, gboolean force) +map_update_location(gdouble lat, gdouble lon, gboolean force) { gint ilat, ilon; -gdouble lat,lon; static gboolean inp=FALSE; /* We run the gtk mainloop in progress callback so we can be called again, we don't like that */ @@ -1084,7 +1082,6 @@ if (inp==TRUE) return; inp=TRUE; -unit2latlon(x, y, lat, lon); ilat=lat2mp_int(lat); ilon=lon2mp_int(lon); -- 2.39.5