@@ -160,7 +160,6 @@ bool c_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
160160 if (o.type () == osmium::item_type::relation &&
161161 strcmp (" type" , k) == 0 ) {
162162 out_tags.emplace_back (k, v);
163- filter = false ;
164163 continue ;
165164 }
166165 /* Allow named islands to appear as polygons */
@@ -206,11 +205,10 @@ bool c_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
206205
207206bool c_tagtransform_t::filter_rel_member_tags (
208207 taglist_t const &rel_tags, osmium::memory::Buffer const &members,
209- rolelist_t const &member_roles, int *member_superseded , int *make_boundary ,
210- int *make_polygon, int * roads, export_list const &exlist,
211- taglist_t &out_tags, bool allow_typeless)
208+ rolelist_t const &member_roles, int *make_boundary , int *make_polygon ,
209+ int *roads, export_list const &exlist, taglist_t &out_tags ,
210+ bool allow_typeless)
212211{
213- auto const &infos = exlist.get (osmium::item_type::way);
214212 // if it has a relation figure out what kind it is
215213 const std::string *type = rel_tags.get (" type" );
216214 bool is_route = false , is_boundary = false , is_multipolygon = false ;
@@ -239,6 +237,10 @@ bool c_tagtransform_t::filter_rel_member_tags(
239237 out_tags.push_dedupe (rel_tag);
240238 }
241239
240+ if (out_tags.empty ()) {
241+ return true ;
242+ }
243+
242244 if (is_route) {
243245 const std::string *netw = rel_tags.get (" network" );
244246 int networknr = -1 ;
@@ -313,109 +315,9 @@ bool c_tagtransform_t::filter_rel_member_tags(
313315 *make_boundary = 1 ;
314316 } else if (is_multipolygon) {
315317 *make_polygon = 1 ;
316-
317- // Check if the relation has any polygon-like tags. In that case
318- // we have a new-style polygon.
319- bool newstyle_mp = false ;
320- for (const auto &tag : out_tags) {
321- if (tag.key == " area" ) {
322- newstyle_mp = true ;
323- } else {
324- for (const auto &info : infos) {
325- if (info.name == tag.key ) {
326- newstyle_mp = info.flags & FLAG_POLYGON;
327- break ;
328- }
329- }
330- }
331- if (newstyle_mp) {
332- break ;
333- }
334- }
335-
336- // Old-style MP: copy the tags from the outer way(s). Only use tags
337- // that appear in all outer rings.
338- if (!newstyle_mp) {
339- taglist_t poly_tags;
340- bool first_outerway = true ;
341- size_t i = 0 ;
342- for (auto const &w : members.select <osmium::Way>()) {
343- if (member_roles[i] && strcmp (member_roles[i], " inner" ) == 0 )
344- continue ;
345-
346- /* insert all tags of the first outerway to the potential list of copied tags. */
347- if (first_outerway) {
348- for (auto const &tag : w.tags ()) {
349- poly_tags.emplace_back (tag.key (), tag.value ());
350- }
351- first_outerway = false ;
352- } else {
353- /* Check if all of the tags in the list of potential tags are present on this way,
354- otherwise remove from the list of potential tags. Tags need to be present on
355- all outer ways to be copied over to the relation */
356- auto it = poly_tags.begin ();
357- while (it != poly_tags.end ()) {
358- if (!w.tags ().has_key (it->key .c_str ()))
359- /* This tag is not present on all member outer ways, so don't copy it over to relation */
360- it = poly_tags.erase (it);
361- else
362- ++it;
363- }
364- }
365- ++i;
366- }
367- // Copy the list identified outer way tags over to the relation
368- // filtering for wanted tags on the way.
369- bool filter;
370- int flags = 0 ;
371- for (const auto &poly_tag : poly_tags) {
372- if (check_key (infos, poly_tag.key .c_str (), &filter, &flags,
373- false )) {
374- out_tags.push_dedupe (poly_tag);
375- }
376- }
377-
378- if (!(flags & FLAG_POLYGON)) {
379- out_tags.clear ();
380- return true ;
381- }
382- }
383- }
384-
385- if (out_tags.empty ()) {
386- return true ;
387- }
388-
389- /* If we are creating a multipolygon then we
390- mark each member so that we can skip them during iterate_ways
391- but only if the polygon-tags look the same as the outer ring */
392- if (make_polygon) {
393- size_t i = 0 ;
394- for (auto const &w : members.select <osmium::Way>()) {
395- member_superseded[i] = 1 ;
396- for (const auto &member_tag : w.tags ()) {
397- auto const *v = out_tags.get (member_tag.key ());
398- bool filt;
399- int flag;
400- if ((!v && check_key (infos, member_tag.key (), &filt, &flag, false ))
401- || (v && *v != member_tag.value ())) {
402- /* z_order and osm_ are automatically generated tags, so ignore them */
403- if (strcmp (member_tag.key (), " z_order" ) &&
404- strcmp (member_tag.key (), " osm_user" ) &&
405- strcmp (member_tag.key (), " osm_version" ) &&
406- strcmp (member_tag.key (), " osm_uid" ) &&
407- strcmp (member_tag.key (), " osm_changeset" ) &&
408- strcmp (member_tag.key (), " osm_timestamp" )) {
409- member_superseded[i] = 0 ;
410- break ;
411- }
412- }
413- }
414- ++i;
415- }
416318 }
417319
418320 add_z_order (out_tags, roads);
419321
420- return 0 ;
322+ return false ;
421323}
0 commit comments