detect broken roundabout-taggings

This commit is contained in:
Moritz Kobitzsch
2016-09-05 16:23:30 +02:00
parent 7a523713c7
commit d3a6b5a77e
3 changed files with 78 additions and 1 deletions
@@ -270,6 +270,19 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
std::set<NodeID> roundabout_nodes; // needs to be sorted
// this value is a hard abort to deal with potential self-loops
const auto countRoundaboutFlags = [&](const NodeID at_node) {
// FIXME: this would be nicer as boost::count_if, but our integer range does not support
// these range based handlers
std::size_t count = 0;
for (const auto edge : node_based_graph.GetAdjacentEdgeRange(at_node))
{
const auto &edge_data = node_based_graph.GetEdgeData(edge);
if (edge_data.roundabout)
count++;
}
return count;
};
NodeID last_node = nid;
while (0 == roundabout_nodes.count(last_node))
{
@@ -277,6 +290,10 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
if (node_based_graph.GetOutDegree(last_node) > 2)
roundabout_nodes.insert(last_node);
// detect invalid/complex roundabout taggings
if (countRoundaboutFlags(last_node) != 2)
return RoundaboutType::None;
const auto eid = getNextOnRoundabout(last_node);
if (eid == SPECIAL_EDGEID)