]> err.no Git - mapper/commitdiff
Query poi
authorKaj-Michael Lang <milang@angel.tal.org>
Sun, 22 Jul 2007 16:11:31 +0000 (19:11 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Sun, 22 Jul 2007 16:11:31 +0000 (19:11 +0300)
src/map.c
src/poi.c

index 68fc3e99127350ba4efd930da2392d845218995f..b75d1bfebec0811920d17dd2ba585e35f99ffc5b 100644 (file)
--- 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)
index fb21849490260d75e8009610dab15edf39f391d3..209d4568291c6b03851d336670e95d8023594474 100644 (file)
--- 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);