[old-map-downloader] Routing section existance check.

This commit is contained in:
Lev Dragunov 2016-01-25 16:43:56 +03:00 committed by Sergey Yershov
parent 26467ff9fb
commit d9736eb224
2 changed files with 15 additions and 2 deletions

View file

@ -39,6 +39,12 @@ UNIT_TEST(CheckCrossSections)
continue;
}
FilesMappingContainer container(file.GetPath(MapOptions::CarRouting));
if (!container.IsExist(ROUTING_CROSS_CONTEXT_TAG))
{
noRouting++;
LOG(LINFO, ("Warning! Mwm file has not cross mwm section:", file.GetCountryName()));
continue;
}
crossReader.Load(container.GetReader(ROUTING_CROSS_CONTEXT_TAG));
bool error = false;

View file

@ -67,15 +67,22 @@ RoutingMapping::RoutingMapping(string const & countryFile, MwmSet & index)
return;
}
m_container.Open(localFile.GetPath(MapOptions::CarRouting));
if (!CheckMwmConsistency(localFile))
{
m_error = IRouter::ResultCode::InconsistentMWMandRoute;
m_container.Close();
m_handle = MwmSet::MwmHandle();
return;
}
m_container.Open(localFile.GetPath(MapOptions::CarRouting));
if (!m_container.IsExist(ROUTING_MATRIX_FILE_TAG))
{
m_error = IRouter::ResultCode::RouteFileNotExist;
m_handle = MwmSet::MwmHandle();
m_container.Close();
return;
}
m_mwmId = m_handle.GetId();
m_error = IRouter::ResultCode::NoError;
}