@@ -83,15 +83,26 @@ void HierarchyItem::load_skip_list(const std::string &fname)
8383 s_skip_types = load_list (fname);
8484}
8585
86- bool HierarchyItem::keep () const
86+ void HierarchyItem::drop ()
8787{
88+ m_dropped = true ;
89+ }
90+
91+ bool HierarchyItem::keep (bool verbose) const
92+ {
93+ if (m_dropped)
94+ return false ;
95+
8896 if (m_type.find_first_not_of (allowed_type_chars) != std::string::npos)
8997 {
90- std::cout << " Dropping " << m_type << " \n " ;
98+ if (verbose)
99+ std::cout << " Dropping " << m_type << " \n " ;
91100 return false ;
92101 }
102+
93103 if (s_skip_types.count (m_type) > 0 )
94104 return false ;
105+
95106 return !m_name.empty () || s_priority_types.count (m_type) > 0 ;
96107}
97108
@@ -150,7 +161,7 @@ void HierarchyItem::set_parent(hindex parent, bool force)
150161 // c->set_parent(m_id, force);
151162}
152163
153- void HierarchyItem::cleanup_children (bool duplicate_only )
164+ void HierarchyItem::cleanup_children ()
154165{
155166 // as a result of this run, children that are supposed to be kept are staying in children
156167 // property. all disposed ones are still pointed to via Hierarchy map, but should not be accessed
@@ -193,10 +204,11 @@ void HierarchyItem::cleanup_children(bool duplicate_only)
193204 i->m_children .end ());
194205 for (auto &i_children : i->m_children )
195206 i_children->set_parent (item->m_id , true );
207+ i->drop ();
196208 }
197209
198210 if (had_duplicates)
199- item->cleanup_children (true );
211+ item->cleanup_children ();
200212
201213 m_children = children;
202214 }
@@ -271,8 +283,7 @@ void HierarchyItem::print_item(unsigned int offset) const
271283 std::cout << std::string (offset, ' ' ) << " - " << m_id << " " ;
272284 if (!m_housenumber.empty ())
273285 std::cout << " house " << m_housenumber << " " ;
274- for (const auto &i : m_data_name)
275- std::cout << i.first << " : " << i.second << " " ;
286+ std::cout << m_name << " " ;
276287 std::cout << " (" << m_my_index << " " << m_last_child_index << " : "
277288 << m_last_child_index - m_my_index << " : " << m_parent_id << " , " << m_country
278289 << " , osmid=" << m_osm_id << " )\n " ;
0 commit comments