forked from organicmaps/organicmaps
Routing callback logick improvements
This commit is contained in:
parent
b15f973c4a
commit
c68603248c
3 changed files with 15 additions and 5 deletions
|
@ -2120,7 +2120,8 @@ void Framework::BuildRoute(m2::PointD const & destination)
|
|||
for(string const & name : route.GetAbsentCountries())
|
||||
absentFiles.push_back(m_storage.FindIndexByFile(name));
|
||||
|
||||
RemoveRoute();
|
||||
if (code != IRouter::NeedMoreMaps)
|
||||
RemoveRoute();
|
||||
}
|
||||
CallRouteBuilded(code, absentFiles);
|
||||
});
|
||||
|
|
|
@ -186,11 +186,13 @@ void AsyncRouter::CalculateRouteImpl(TReadyCallback const & callback)
|
|||
// Check online response if we have.
|
||||
vector<string> absent;
|
||||
m_absentFetcher->GetAbsentCountries(absent);
|
||||
if (absent.empty() && code != IRouter::NoError)
|
||||
if (absent.empty())
|
||||
{
|
||||
GetPlatform().RunOnGuiThread(bind(callback, route, code));
|
||||
if (code != IRouter::NoError)
|
||||
GetPlatform().RunOnGuiThread(bind(callback, route, code));
|
||||
return;
|
||||
}
|
||||
|
||||
for (string const & country : absent)
|
||||
route.AddAbsentCountry(country);
|
||||
if (code != IRouter::NoError)
|
||||
|
|
|
@ -25,8 +25,15 @@ void OnlineAbsentFetcher::GetAbsentCountries(vector<string> & countries)
|
|||
for (auto point : static_cast<OnlineCrossFetcher *>(m_fetcherThread.GetRoutine())->GetMwmPoints())
|
||||
{
|
||||
string name = m_countryFunction(point);
|
||||
LOG(LINFO, ("Online recomends to download: ", name));
|
||||
countries.emplace_back(move(name));
|
||||
//TODO (ldragunov) rewrite when storage GetLocalCountryFile will be present.
|
||||
Platform & pl = GetPlatform();
|
||||
string const mwmName = name + DATA_FILE_EXTENSION;
|
||||
string const fPath = pl.WritablePathForFile(mwmName + ROUTING_FILE_EXTENSION);
|
||||
if (!pl.IsFileExistsByFullPath(fPath))
|
||||
{
|
||||
LOG(LINFO, ("Online recomends to download: ", name));
|
||||
countries.emplace_back(move(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace routing
|
||||
|
|
Loading…
Add table
Reference in a new issue