diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-08-03 16:59:01 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:58:53 +0300 |
commit | 4fb687a3794a06b1d33b5d8766497fc7f4370846 (patch) | |
tree | 1d28b0a85aeda4d6a6199f3516d1ae833aa25ed1 /routing | |
parent | 97cfc302448d85b23726df787a4c523c26d20414 (diff) |
PR fixes
Diffstat (limited to 'routing')
-rw-r--r-- | routing/async_router.cpp | 2 | ||||
-rw-r--r-- | routing/road_graph_router.cpp | 24 |
2 files changed, 16 insertions, 10 deletions
diff --git a/routing/async_router.cpp b/routing/async_router.cpp index 95bddddaca..444eee16ca 100644 --- a/routing/async_router.cpp +++ b/routing/async_router.cpp @@ -32,6 +32,8 @@ string ToString(IRouter::ResultCode code) case IRouter::NeedMoreMaps: return "NeedMoreMaps"; case IRouter::FileTooOld: return "FileTooOld"; } + ASSERT(false, ()); + return "Routing result code case error."; } map<string, string> PrepareStatisticsData(string const & routerName, diff --git a/routing/road_graph_router.cpp b/routing/road_graph_router.cpp index e6b3642f07..a5de4fea4b 100644 --- a/routing/road_graph_router.cpp +++ b/routing/road_graph_router.cpp @@ -26,7 +26,7 @@ namespace // you risk to find a feature that you cannot in fact reach because of // an obstacle. Using only the closest feature minimizes (but not // eliminates) this risk. -size_t const kMaxRoadCandidates = 1; +size_t constexpr kMaxRoadCandidates = 1; uint64_t constexpr kMinPedestrianMwmVersion = 150713; IRouter::ResultCode Convert(IRoutingAlgorithm::Result value) @@ -50,15 +50,16 @@ void Convert(vector<Junction> const & path, vector<m2::PointD> & geometry) } // Check if the found edges lays on mwm with pedestrian routing support. -string CheckMwmAge(vector<pair<Edge, m2::PointD>> const & vicinities) +bool CheckMwmVersion(vector<pair<Edge, m2::PointD>> const & vicinities, vector<string> & mwmNames) { + mwmNames.clear(); for (auto const & vicinity : vicinities) { auto const mwmInfo = vicinity.first.GetFeatureId().m_mwmId.GetInfo(); if (mwmInfo->GetVersion() < kMinPedestrianMwmVersion) - return mwmInfo->GetCountryName(); + mwmNames.push_back(mwmInfo->GetCountryName()); } - return ""; + return !mwmNames.empty(); } } // namespace @@ -91,10 +92,12 @@ IRouter::ResultCode RoadGraphRouter::CalculateRoute(m2::PointD const & startPoin if (finalVicinity.empty()) return EndPointNotFound; - auto mwmName = CheckMwmAge(finalVicinity); - if (!mwmName.empty()) + //TODO (ldragunov) Remove this check after several releases. (Estimated in november) + vector<string> mwmNames; + if (CheckMwmVersion(finalVicinity, mwmNames)) { - route.AddAbsentCountry(mwmName); + for (auto const & name : mwmNames) + route.AddAbsentCountry(name); return FileTooOld; } @@ -104,10 +107,11 @@ IRouter::ResultCode RoadGraphRouter::CalculateRoute(m2::PointD const & startPoin if (startVicinity.empty()) return StartPointNotFound; - mwmName = CheckMwmAge(startVicinity); - if (!mwmName.empty()) + //TODO (ldragunov) Remove this check after several releases. (Estimated in november) + if (CheckMwmVersion(startVicinity, mwmNames)) { - route.AddAbsentCountry(mwmName); + for (auto const & name : mwmNames) + route.AddAbsentCountry(name); return FileTooOld; } |