New vector for absent routing files

This commit is contained in:
Lev Dragunov 2015-07-06 16:47:10 +03:00 committed by Alex Zolotarev
parent 68aa0a0811
commit abf88139c6
3 changed files with 20 additions and 9 deletions

View file

@ -2098,7 +2098,8 @@ void Framework::BuildRoute(m2::PointD const & destination)
shared_ptr<State> const & state = GetLocationState();
if (!state->IsModeHasPosition())
{
CallRouteBuilded(IRouter::NoCurrentPosition, vector<storage::TIndex>());
CallRouteBuilded(IRouter::NoCurrentPosition, vector<storage::TIndex>(),
vector<storage::TIndex>());
return;
}
@ -2108,7 +2109,8 @@ void Framework::BuildRoute(m2::PointD const & destination)
m_routingSession.BuildRoute(state->Position(), destination,
[this] (Route const & route, IRouter::ResultCode code)
{
vector<storage::TIndex> absentFiles;
vector<storage::TIndex> absentCountries;
vector<storage::TIndex> absentRoutingIndexes;
if (code == IRouter::NoError)
{
InsertRoute(route);
@ -2118,12 +2120,18 @@ void Framework::BuildRoute(m2::PointD const & destination)
else
{
for(string const & name : route.GetAbsentCountries())
absentFiles.push_back(m_storage.FindIndexByFile(name));
{
storage::TIndex fileIndex = m_storage.FindIndexByFile(name);
if (m_storage.GetLatestLocalFile(fileIndex))
absentRoutingIndexes.push_back(fileIndex);
else
absentCountries.push_back(fileIndex);
}
if (code != IRouter::NeedMoreMaps)
RemoveRoute();
}
CallRouteBuilded(code, absentFiles);
CallRouteBuilded(code, absentCountries, absentRoutingIndexes);
});
}
@ -2240,11 +2248,11 @@ void Framework::MatchLocationToRoute(location::GpsInfo & location, location::Rou
m_routingSession.MatchLocationToRoute(location, routeMatchingInfo);
}
void Framework::CallRouteBuilded(IRouter::ResultCode code, vector<storage::TIndex> const & absentFiles)
void Framework::CallRouteBuilded(IRouter::ResultCode code, vector<storage::TIndex> const & absentCountries, vector<storage::TIndex> const & absentRoutingFiles)
{
if (code == IRouter::Cancelled)
return;
m_routingCallback(code, absentFiles);
m_routingCallback(code, absentCountries, absentRoutingFiles);
}
string Framework::GetRoutingErrorMessage(IRouter::ResultCode code)

View file

@ -558,7 +558,8 @@ public:
bool IsRouteBuilt() const { return m_routingSession.IsBuilt(); }
bool IsRouteBuilding() const { return m_routingSession.IsBuilding(); }
void BuildRoute(m2::PointD const & destination);
typedef function<void (routing::IRouter::ResultCode, vector<storage::TIndex> const &)> TRouteBuildingCallback;
typedef function<void(routing::IRouter::ResultCode, vector<storage::TIndex> const &,
vector<storage::TIndex> const &)> TRouteBuildingCallback;
void SetRouteBuildingListener(TRouteBuildingCallback const & callback) { m_routingCallback = callback; }
void FollowRoute() { GetLocationState()->StartRouteFollow(); }
void CloseRouting();
@ -579,7 +580,9 @@ private:
void InsertRoute(routing::Route const & route);
void CheckLocationForRouting(location::GpsInfo const & info);
void MatchLocationToRoute(location::GpsInfo & info, location::RouteMatchingInfo & routeMatchingInfo) const;
void CallRouteBuilded(routing::IRouter::ResultCode code, vector<storage::TIndex> const & absentFiles);
void CallRouteBuilded(routing::IRouter::ResultCode code,
vector<storage::TIndex> const & absentCountries,
vector<storage::TIndex> const & absentRoutingFiles);
string GetRoutingErrorMessage(routing::IRouter::ResultCode code);
TRouteBuildingCallback m_routingCallback;

View file

@ -102,7 +102,7 @@ namespace qt
layout.DownloadMap(idx, static_cast<TMapOptions>(opt));
});
m_framework->SetRouteBuildingListener([] (routing::IRouter::ResultCode, vector<storage::TIndex> const &)
m_framework->SetRouteBuildingListener([] (routing::IRouter::ResultCode, vector<storage::TIndex> const &, vector<storage::TIndex> const &)
{
});
}