| 52 | namespace routing |
| 53 | { |
| 54 | RestrictionLoader::RestrictionLoader(MwmValue const & mwmValue, IndexGraph & graph) |
| 55 | : m_countryFileName(mwmValue.GetCountryFileName()) |
| 56 | { |
| 57 | if (!mwmValue.m_cont.IsExist(RESTRICTIONS_FILE_TAG)) |
| 58 | return; |
| 59 | |
| 60 | try |
| 61 | { |
| 62 | m_reader = std::make_unique<FilesContainerR::TReader>(mwmValue.m_cont.GetReader(RESTRICTIONS_FILE_TAG)); |
| 63 | ReaderSource<FilesContainerR::TReader> src(*m_reader); |
| 64 | m_header.Deserialize(src); |
| 65 | |
| 66 | RestrictionVec restrictionsOnly; |
| 67 | std::vector<RestrictionUTurn> restrictionsOnlyUTurn; |
| 68 | RestrictionSerializer::Deserialize(m_header, m_restrictions /* restriction No, without no_u_turn */, |
| 69 | restrictionsOnly, m_noUTurnRestrictions, restrictionsOnlyUTurn, src); |
| 70 | |
| 71 | ConvertRestrictionsOnlyToNo(graph, restrictionsOnly, m_restrictions); |
| 72 | ConvertRestrictionsOnlyUTurnToNo(graph, restrictionsOnlyUTurn, m_restrictions); |
| 73 | } |
| 74 | catch (Reader::OpenException const & e) |
| 75 | { |
| 76 | m_header.Reset(); |
| 77 | LOG(LERROR, ("File", m_countryFileName, "Error while reading", RESTRICTIONS_FILE_TAG, "section.", e.Msg())); |
| 78 | throw; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | bool RestrictionLoader::HasRestrictions() const |
| 83 | { |
nothing calls this directly
no test coverage detected