Skip to content

Commit dede965

Browse files
committed
Add info regarding root on error
1 parent 7b3939c commit dede965

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

importer/src/hierarchy.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ void Hierarchy::print(bool full) const
167167
{
168168
if (full)
169169
item->print_branch(0);
170+
else
171+
item->print_item(0);
170172
root_ids.insert(item->id());
171173
}
172174

importer/src/hierarchyitem.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void HierarchyItem::write(sqlite3pp::database &db) const
266266
c->write(db);
267267
}
268268

269-
void HierarchyItem::print_branch(unsigned int offset) const
269+
void HierarchyItem::print_item(unsigned int offset) const
270270
{
271271
std::cout << std::string(offset, ' ') << "- " << m_id << " ";
272272
if (!m_housenumber.empty())
@@ -278,22 +278,11 @@ void HierarchyItem::print_branch(unsigned int offset) const
278278
<< ", osmid=" << m_osm_id << ")\n";
279279
if (m_children.size())
280280
std::cout << std::string(offset + 2, ' ') << "|\n";
281-
for (auto c : m_children)
282-
c->print_branch(offset + 3);
283281
}
284282

285283
void HierarchyItem::print_branch(unsigned int offset) const
286284
{
287-
std::cout << std::string(offset, ' ') << "- " << m_id << " ";
288-
if (!m_housenumber.empty())
289-
std::cout << "house " << m_housenumber << " ";
290-
for (const auto &i : m_data_name)
291-
std::cout << i.first << ": " << i.second << " ";
292-
std::cout << "(" << m_my_index << " " << m_last_child_index << ": "
293-
<< m_last_child_index - m_my_index << ": " << m_parent_id << ", " << m_country
294-
<< ", osmid=" << m_osm_id << ")\n";
295-
if (m_children.size())
296-
std::cout << std::string(offset + 2, ' ') << "|\n";
285+
print_item(offset);
297286
for (auto c : m_children)
298287
c->print_branch(offset + 3);
299288
}

importer/src/hierarchyitem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class HierarchyItem
3131
sqlid index(sqlid idx, sqlid parent);
3232
void write(sqlite3pp::database &db) const;
3333

34+
void print_item(unsigned int offset) const;
3435
void print_branch(unsigned int offset) const;
3536

3637
public:

importer/src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ int main(int argc, char *argv[])
209209
if (!found)
210210
{
211211
std::cerr << "Missing parent with ID " << parent << ". Stopping import\n";
212+
hierarchy.print(false);
212213
return -1;
213214
}
214215

0 commit comments

Comments
 (0)