Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Gorbushin <m.gorbushin@corp.mail.ru>2019-08-12 19:20:28 +0300
committermpimenov <mpimenov@users.noreply.github.com>2019-08-13 18:12:39 +0300
commit5e17cdbe67f7b7ff72462995f99c25c6a1702e61 (patch)
tree44df6a22581139af1adf940240a2d54ccbdedde7 /routing/index_router.cpp
parent3cdbfa13fcc95a30aa2a067dcb9a2a7c27f6b6e7 (diff)
[routing] Changed IndexRouter::AreMwmsNear
In previous version start and finish could have only one mwm related to them, but after adding several fake segments, start and finish could be linked with different mwms, because of that AreMwmsNear returns false when start or finish placed near mwm's border. Because of that LeapsOnly is chosen instead of Joints mode.
Diffstat (limited to 'routing/index_router.cpp')
-rw-r--r--routing/index_router.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/routing/index_router.cpp b/routing/index_router.cpp
index 441820cf1a..2835ea4892 100644
--- a/routing/index_router.cpp
+++ b/routing/index_router.cpp
@@ -560,8 +560,8 @@ RouterResultCode IndexRouter::CalculateSubroute(Checkpoints const & checkpoints,
starter.GetGraph().SetMode(WorldGraphMode::NoLeaps);
break;
case VehicleType::Car:
- starter.GetGraph().SetMode(AreMwmsNear(starter.GetMwms()) ? WorldGraphMode::Joints
- : WorldGraphMode::LeapsOnly);
+ starter.GetGraph().SetMode(AreMwmsNear(starter) ? WorldGraphMode::Joints
+ : WorldGraphMode::LeapsOnly);
break;
case VehicleType::Count:
CHECK(false, ("Unknown vehicle type:", m_vehicleType));
@@ -1365,17 +1365,24 @@ RouterResultCode IndexRouter::RedressRoute(vector<Segment> const & segments,
return RouterResultCode::NoError;
}
-bool IndexRouter::AreMwmsNear(set<NumMwmId> const & mwmIds) const
+bool IndexRouter::AreMwmsNear(IndexGraphStarter const & starter) const
{
- for (auto const & outerId : mwmIds)
+ auto const & startMwmIds = starter.GetStartMwms();
+ auto const & finishMwmIds = starter.GetFinishMwms();
+ for (auto const startMwmId : startMwmIds)
{
- m2::RectD const rect = m_countryRectFn(m_numMwmIds->GetFile(outerId).GetName());
- size_t found = 0;
- m_numMwmTree->ForEachInRect(rect, [&](NumMwmId id) { found += mwmIds.count(id); });
- if (found != mwmIds.size())
- return false;
+ m2::RectD const & rect = m_countryRectFn(m_numMwmIds->GetFile(startMwmId).GetName());
+ bool found = false;
+ m_numMwmTree->ForEachInRect(rect,
+ [&finishMwmIds, &found](NumMwmId id) {
+ if (!found && finishMwmIds.count(id) > 0)
+ found = true;
+ });
+ if (found)
+ return true;
}
- return true;
+
+ return false;
}
bool IndexRouter::DoesTransitSectionExist(NumMwmId numMwmId) const