From: Kaj-Michael Lang Date: Sun, 14 Oct 2007 10:41:48 +0000 (+0300) Subject: Bugfix. Don't add ways that are outside the bounding box. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53ecd41e407304185d748a9ec3dd7d28ecf329c3;p=mapper Bugfix. Don't add ways that are outside the bounding box. --- diff --git a/src/osm.c b/src/osm.c index 3d47ec2..4a5627b 100644 --- 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); }