| 92 | } |
| 93 | |
| 94 | void LoadRestrictions(string const & mwmFilePath, vector<Restriction> & restrictions, |
| 95 | vector<RestrictionUTurnForTests> & restrictionsUTurn) |
| 96 | { |
| 97 | FilesContainerR const cont(mwmFilePath); |
| 98 | if (!cont.IsExist(RESTRICTIONS_FILE_TAG)) |
| 99 | return; |
| 100 | |
| 101 | try |
| 102 | { |
| 103 | FilesContainerR::TReader const reader = cont.GetReader(RESTRICTIONS_FILE_TAG); |
| 104 | ReaderSource<FilesContainerR::TReader> src(reader); |
| 105 | RestrictionHeader header; |
| 106 | header.Deserialize(src); |
| 107 | |
| 108 | RestrictionVec restrictionsNo; |
| 109 | RestrictionVec restrictionsOnly; |
| 110 | vector<RestrictionUTurn> restrictionsNoUTurn; |
| 111 | vector<RestrictionUTurn> restrictionsOnlyUTurn; |
| 112 | RestrictionSerializer::Deserialize(header, restrictionsNo, restrictionsOnly, restrictionsNoUTurn, |
| 113 | restrictionsOnlyUTurn, src); |
| 114 | |
| 115 | for (auto const & r : restrictionsNo) |
| 116 | restrictions.emplace_back(Restriction::Type::No, vector<uint32_t>(r.begin(), r.end())); |
| 117 | |
| 118 | for (auto const & r : restrictionsOnly) |
| 119 | restrictions.emplace_back(Restriction::Type::Only, vector<uint32_t>(r.begin(), r.end())); |
| 120 | |
| 121 | for (auto const & r : restrictionsNoUTurn) |
| 122 | restrictionsUTurn.emplace_back(Restriction::Type::NoUTurn, r.m_featureId, r.m_viaIsFirstPoint); |
| 123 | |
| 124 | for (auto const & r : restrictionsOnlyUTurn) |
| 125 | restrictionsUTurn.emplace_back(Restriction::Type::OnlyUTurn, r.m_featureId, r.m_viaIsFirstPoint); |
| 126 | } |
| 127 | catch (Reader::OpenException const & e) |
| 128 | { |
| 129 | TEST(false, ("Error while reading", RESTRICTIONS_FILE_TAG, "section.", e.Msg())); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /// \brief Generates a restriction section, adds it to an empty mwm, |
| 134 | /// loads the restriction section and test loaded restrictions. |
no test coverage detected