From 0375309a25eff8d92dca23511bfd3abb23aa9dc5 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Sun, 22 Jul 2007 19:11:31 +0300 Subject: [PATCH] Query poi --- src/map.c | 14 ++++++++++---- src/poi.c | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/map.c b/src/map.c index 68fc3e9..b75d1bf 100644 --- a/src/map.c +++ b/src/map.c @@ -27,6 +27,7 @@ #include "map.h" #include "osm.h" #include "osm-db.h" +#include "poi.h" #include "route.h" #include "gps.h" #include "bt.h" @@ -1355,15 +1356,17 @@ static void map_draw_track(gint x, gint y) } void -map_set_place_information(osm_place *s, osm_place *mp, osm_place *sp) +map_set_place_information(osm_place *s, osm_place *mp, osm_place *sp, PoiInfo *p) { gchar buffer[256]; -snprintf(buffer, sizeof(buffer), "On %s%s%s%s%s", +snprintf(buffer, sizeof(buffer), "On %s%s%s%s%s%s%s", s->name ? s->name : "Unknown street", + (p && p->label) ? " near " : "", + (p && p->label) ? p->label : "", sp->name ? " in " : "", sp->name ? sp->name : "", - mp->name ? " near " : "", + mp->name ? " in City " : "", mp->name ? mp->name : ""); gtk_label_set_label(GTK_LABEL(_info_banner), buffer); } @@ -1377,6 +1380,7 @@ gdouble lat,lon; osm_place street; osm_place mplace; osm_place splace; +PoiInfo *p; ux = x2unit((gint) (x + 0.5)); uy = y2unit((gint) (y + 0.5)); @@ -1396,6 +1400,8 @@ g_printf("IntPos: %d , %d\n", ilat, ilon); osm_find_nearest_way(ilat, ilon, &street); #endif +p=poi_find_nearest(lat, lon); + if (osm_find_nearest_place(NODE_PLACE_SUBURB, ilat, ilon, &splace)==TRUE) g_printf("Near suburb: %s (%d)\n", splace.name, splace.isin); @@ -1426,7 +1432,7 @@ if (splace.isin!=0 && street.isin==0) { } -map_set_place_information(&street, &mplace, &splace); +map_set_place_information(&street, &mplace, &splace, p); } gboolean map_cb_scroll_event(GtkWidget * widget, GdkEventScroll * event) diff --git a/src/poi.c b/src/poi.c index fb21849..209d456 100644 --- a/src/poi.c +++ b/src/poi.c @@ -192,8 +192,8 @@ poi_db_prepare(sqlite3 *db) "select p.lat, p.lon, p.label, c.label, c.icon, c.color" " from poi p, category c " " where c.enabled = 1 and p.cat_id = c.cat_id " - " and p.lat between $LAT-0.15 and $LAT+0.15 " - " and p.lon between $LON-0.15 and $LAT+0.15 " + " and p.lat between $LAT-0.11 and $LAT+0.11 " + " and p.lon between $LON-0.11 and $LAT+0.11 " " order by (($LAT - p.lat) * ($LAT - p.lat) " "+ ($LON - p.lon) * ($LON - p.lon)) limit 1", -1, &_stmt_select_nearest_poi, NULL); -- 2.39.5