]> err.no Git - mapper/commitdiff
Dummy street place.
authorKaj-Michael Lang <milang@angel.tal.org>
Sun, 22 Jul 2007 15:08:39 +0000 (18:08 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Sun, 22 Jul 2007 15:08:39 +0000 (18:08 +0300)
Get location from isin value if known.

src/map.c

index f3a3c996e4600ede6cf8c2eb7b65282ae0e8a25f..68fc3e99127350ba4efd930da2392d845218995f 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -1355,21 +1355,26 @@ static void map_draw_track(gint x, gint y)
 }
 
 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;
 
@@ -1380,21 +1385,48 @@ unit2latlon(ux, uy, lat, lon);
 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)