[routing] Route calculation on world graph in case of start and finish leaps.

This commit is contained in:
Vladimir Byko-Ianko 2017-05-19 15:14:09 +03:00 committed by Добрый Ээх
parent 451c081f8c
commit 899aa90144

View file

@ -305,7 +305,6 @@ IRouter::ResultCode IndexRouter::ProcessLeaps(vector<Segment> const & input,
WorldGraph & worldGraph = starter.GetGraph();
WorldGraph::Mode const worldRouteMode = worldGraph.GetMode();
worldGraph.SetMode(WorldGraph::Mode::SingleMwm);
for (size_t i = 0; i < input.size(); ++i)
{
@ -318,6 +317,19 @@ IRouter::ResultCode IndexRouter::ProcessLeaps(vector<Segment> const & input,
continue;
}
// In case of leaps from the start to its mwm transition and from finish mwm transition
// Route calculation should be made on the world graph (WorldGraph::Mode::NoLeaps).
if ((current.GetMwmId() == starter.GetStartVertex().GetMwmId()
|| current.GetMwmId() == starter.GetFinishVertex().GetMwmId())
&& worldRouteMode == WorldGraph::Mode::LeapsOnly)
{
worldGraph.SetMode(WorldGraph::Mode::NoLeaps);
}
else
{
worldGraph.SetMode(WorldGraph::Mode::SingleMwm);
}
++i;
CHECK_LESS(i, input.size(), ());
Segment const & next = input[i];