Removing turns in the case if (1) source and target names are the same; (2) the angle between is TurnSlightRight, TurnSlightLeft or GoStraight

This commit is contained in:
Vladimir Byko-Ianko 2014-12-11 12:02:11 +03:00 committed by Alex Zolotarev
parent d95477b121
commit e619d29e14
3 changed files with 13 additions and 0 deletions

View file

@ -997,6 +997,14 @@ void OsrmRouter::FixupTurns(vector<m2::PointD> const & points, Route::TurnsT & t
continue;
}
if (!t.m_srcName.empty()
&& t.m_srcName == t.m_trgName
&& turns::IsTurnSlightOrStraight(t.m_turn))
{
turnsDir.erase(turnsDir.begin() + idx);
continue;
}
++idx;
}
}

View file

@ -54,6 +54,10 @@ bool IsStayOnRoad(TurnDirection t)
return (t == turns::GoStraight || t == turns::StayOnRoundAbout);
}
bool IsTurnSlightOrStraight(TurnDirection t)
{
return (t == GoStraight || t == TurnSlightRight || t == TurnSlightLeft);
}
}
}

View file

@ -46,6 +46,7 @@ bool IsLeftTurn(TurnDirection t);
bool IsRightTurn(TurnDirection t);
bool IsLeftOrRightTurn(TurnDirection t);
bool IsStayOnRoad(TurnDirection t);
bool IsTurnSlightOrStraight(TurnDirection t);
}
}