- add function to count directed outgoing edges
- generate correct instruction for staying on a roundabout
- move test from @bug namespace to the general one
This commit is contained in:
Dennis Luxen 2014-05-20 15:40:14 +02:00
parent 69ad3f3365
commit 9a2d701e2e
3 changed files with 15 additions and 3 deletions

View File

@ -728,7 +728,7 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u,
if (data1.roundabout && data2.roundabout)
{
// Is a turn possible? If yes, we stay on the roundabout!
if (1 == m_node_based_graph->GetOutDegree(v))
if (1 == m_node_based_graph->GetDirectedOutDegree(v))
{
// No turn possible.
return TurnInstruction::NoTurn;

View File

@ -117,6 +117,19 @@ template <typename EdgeDataT> class DynamicGraph
unsigned GetOutDegree(const NodeIterator n) const { return m_nodes[n].edges; }
unsigned GetDirectedOutDegree(const NodeIterator n) const
{
unsigned degree = 0;
for(EdgeIterator edge = BeginEdges(n); edge < EndEdges(n); ++edge)
{
if (GetEdgeData(edge).forward)
{
++degree;
}
}
return degree;
}
NodeIterator GetTarget(const EdgeIterator e) const { return NodeIterator(m_edges[e].target); }
void SetTarget(const EdgeIterator e, const NodeIterator n) { m_edges[e].target = n; }

View File

@ -35,7 +35,6 @@ Feature: Roundabout Instructions
| v | t | vd,tb | head,enter_roundabout-2,destination |
| v | u | vd,uc | head,enter_roundabout-3,destination |
@bug
Scenario: Testbot - Roundabout with oneway links
Given the node map
| | | p | o | | |