]> err.no Git - mapper/commitdiff
Bugfix. Don't add ways that are outside the bounding box.
authorKaj-Michael Lang <milang@angel.tal.org>
Sun, 14 Oct 2007 10:41:48 +0000 (13:41 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Sun, 14 Oct 2007 10:41:48 +0000 (13:41 +0300)
src/osm.c

index 3d47ec237acc4c8dc66e0d598676e52a91d35fb4..4a5627bda4b1c0492e0c9a84d79e1b3e06d5c1bc 100644 (file)
--- a/src/osm.c
+++ b/src/osm.c
@@ -733,10 +733,15 @@ w->ncnt=0;
 w->flags=0;
 
 /* Add to list of ways */
-osm_ways=g_slist_prepend(osm_ways, w);
 return w;
 }
 
+void
+osm_way_add_to_list(way *w)
+{
+osm_ways=g_slist_prepend(osm_ways, w);
+}
+
 void
 osm_way_new_node(way *w, gint nid)
 {
@@ -1011,8 +1016,10 @@ switch (t) {
        case IN_WNODE_TAG:
                ndref=atoi(get_attr_key_value(atts, "ref"));
                if (use_bbox==TRUE) {
-                       if (osm_find_node(ndref)==NULL)
+                       if (osm_find_node(ndref)==NULL) {
+                               cway->id=0;
                                return;
+                       }
                }
                osm_way_new_node(cway, ndref);
        break;
@@ -1207,6 +1214,11 @@ switch (t) {
                        cway->data->int_ref==NULL && cway->data->layer==0 && cway->data->speed==0)
                        osm_free_way_data(cway);
 
+               if (cway->id!=0)
+                       osm_way_add_to_list(cway);
+               else
+                       way_cnt--;
+
                if (way_cnt % 32767==0) {
                        g_printf("Ways: %d\n", way_cnt);
                }