roundabout for segregated entry roads

This commit is contained in:
Moritz Kobitzsch
2016-04-15 17:18:55 +02:00
committed by Patrick Niklaus
parent be5b49e391
commit e59a7926a2
5 changed files with 172 additions and 29 deletions
@@ -208,6 +208,15 @@ Intersection IntersectionGenerator::mergeSegregatedRoads(Intersection intersecti
if (intersection.size() == 1)
return intersection;
const bool is_connected_to_roundabout = [this,&intersection]() {
for (const auto &road : intersection)
{
if (node_based_graph.GetEdgeData(road.turn.eid).roundabout)
return true;
}
return false;
}();
// check for merges including the basic u-turn
// these result in an adjustment of all other angles
if (mergable(0, intersection.size() - 1))
@@ -216,8 +225,24 @@ Intersection IntersectionGenerator::mergeSegregatedRoads(Intersection intersecti
(360 - intersection[intersection.size() - 1].turn.angle) / 2;
for (std::size_t i = 1; i + 1 < intersection.size(); ++i)
intersection[i].turn.angle += correction_factor;
// FIXME if we have a left-sided country, we need to switch this off and enable it below
intersection[0] = merge(intersection.front(), intersection.back());
intersection[0].turn.angle = 0;
if (is_connected_to_roundabout)
{
// We are merging a u-turn against the direction of a roundabout
//
// -----------> roundabout
// / \
// out in
//
// These cases have to be disabled, even if they are not forbidden specifically by a
// relation
intersection[0].entry_allowed = false;
}
intersection.pop_back();
}