}
void
-map_set_place_information(osm_place *m, osm_place *s)
+map_set_place_information(osm_place *s, osm_place *mp, osm_place *sp)
{
gchar buffer[256];
-snprintf(buffer, sizeof(buffer), "Near %s in %s",
- s->name ? s->name : "Unknown",
- m->name ? m->name : "Unknown" );
+snprintf(buffer, sizeof(buffer), "On %s%s%s%s%s",
+ s->name ? s->name : "Unknown street",
+ sp->name ? " in " : "",
+ sp->name ? sp->name : "",
+ mp->name ? " near " : "",
+ mp->name ? mp->name : "");
gtk_label_set_label(GTK_LABEL(_info_banner), buffer);
}
+/* XXX: */
static void map_print_int_latlon(gint x, gint y)
{
gint ux, uy;
gint ilat, ilon;
gdouble lat,lon;
+osm_place street;
osm_place mplace;
osm_place splace;
ilat=lat2mp_int(lat);
ilon=lon2mp_int(lon);
+street.name=NULL;
+street.isin=0;
+mplace.name=NULL;
+splace.name=NULL;
+
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 (splace.isin!=0) {
#if 0
- osm_get_place(splace.isin, &mplace);
+osm_find_nearest_way(ilat, ilon, &street);
#endif
+
+if (osm_find_nearest_place(NODE_PLACE_SUBURB, ilat, ilon, &splace)==TRUE)
+ g_printf("Near suburb: %s (%d)\n", splace.name, splace.isin);
+
+if (splace.isin!=0 && street.isin==0) {
+ if (osm_place_get(splace.isin, ilat, ilon, &mplace)==FALSE) {
+ 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);
+ else
+ g_printf("Unknown\n");
+ } else {
+ g_printf("In %s\n", mplace.name);
+ }
+} else if (street.isin!=0) {
+ if (osm_place_get(street.isin, ilat, ilon, &mplace)==FALSE) {
+
+ } else {
+ g_printf("In %s\n", mplace.name);
+ }
+} else {
+ 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);
+ else
+ g_printf("Unknown\n");
+
}
-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);
+map_set_place_information(&street, &mplace, &splace);
}
gboolean map_cb_scroll_event(GtkWidget * widget, GdkEventScroll * event)