#include "utils.h"
#include "map.h"
+#include "osm.h"
+#include "osm-db.h"
#include "route.h"
#include "gps.h"
#include "bt.h"
refresh_mark();
}
+void
+map_set_place_information(osm_place *m, osm_place *s)
+{
+gchar buffer[256];
+
+snprintf(buffer, sizeof(buffer), "Near %s in %s",
+ s->name ? s->name : "Unknown",
+ m->name ? m->name : "Unknown" );
+gtk_label_set_label(GTK_LABEL(_info_banner), buffer);
+}
+
static void map_print_int_latlon(gint x, gint y)
{
gint ux, uy;
+gint ilat, ilon;
gdouble lat,lon;
+osm_place mplace;
+osm_place splace;
ux = x2unit((gint) (x + 0.5));
uy = y2unit((gint) (y + 0.5));
unit2latlon(ux, uy, lat, lon);
-g_printf("IntPos: %d , %d\n", lat2mp_int(lat), lon2mp_int(lon));
+ilat=lat2mp_int(lat);
+ilon=lon2mp_int(lon);
+
+g_printf("IntPos: %d , %d\n", ilat, ilon);
+
+if (osm_find_nearest_place(NODE_PLACE_SUBURB, ilat, ilon, &splace)==TRUE)
+ g_printf("Near suburb: %s\n", splace.name);
+
+if (osm_find_nearest_place(NODE_PLACE_CITY, ilat, ilon, &mplace)==TRUE)
+ g_printf("Near city: %s\n", mplace.name);
+else if (osm_find_nearest_place(NODE_PLACE_TOWN, ilat, ilon, &mplace)==TRUE)
+ g_printf("Near town: %s\n", mplace.name);
+
+map_set_place_information(&mplace, &splace);
}
gboolean map_cb_scroll_event(GtkWidget * widget, GdkEventScroll * event)