\brief We store |Only| restriction in mwm, like Only, featureId_1, ... , featureId_N We convert such restriction to |No| following way: For each M, greater than 1, and M first features: featureId_1, ... , featureId_(M - 1), featureId_M, ... We create restrictionNo from features: featureId_1, ... , featureId_(M - 1), featureId_K where featureId_K - has common joint with featureId_(M - 1) and feat
| 114 | /// featureId_1, ... , featureId_(M - 1), featureId_K |
| 115 | /// where featureId_K - has common joint with featureId_(M - 1) and featureId_M. |
| 116 | void ConvertRestrictionsOnlyToNo(IndexGraph const & graph, RestrictionVec const & restrictionsOnly, |
| 117 | RestrictionVec & restrictionsNo) |
| 118 | { |
| 119 | for (std::vector<uint32_t> const & restriction : restrictionsOnly) |
| 120 | { |
| 121 | CHECK_GREATER_OR_EQUAL(restriction.size(), 2, ()); |
| 122 | |
| 123 | if (!IsRestrictionFromRoads(graph, restriction)) |
| 124 | continue; |
| 125 | |
| 126 | for (size_t i = 1; i < restriction.size(); ++i) |
| 127 | { |
| 128 | auto const curFeatureId = restriction[i]; |
| 129 | auto const prevFeatureId = restriction[i - 1]; |
| 130 | |
| 131 | // Looking for a joint of an intersection of prev and cur features. |
| 132 | Joint::Id const common = GetCommonEndJoint(graph.GetRoad(curFeatureId), graph.GetRoad(prevFeatureId)); |
| 133 | |
| 134 | if (common == Joint::kInvalidId) |
| 135 | break; |
| 136 | |
| 137 | std::vector<uint32_t> commonFeatures; |
| 138 | commonFeatures.resize(i + 1); |
| 139 | std::copy(restriction.begin(), restriction.begin() + i, commonFeatures.begin()); |
| 140 | |
| 141 | graph.ForEachPoint(common, [&](RoadPoint const & rp) |
| 142 | { |
| 143 | if (rp.GetFeatureId() != curFeatureId) |
| 144 | { |
| 145 | commonFeatures.back() = rp.GetFeatureId(); |
| 146 | restrictionsNo.emplace_back(commonFeatures); |
| 147 | } |
| 148 | }); |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | void ConvertRestrictionsOnlyUTurnToNo(IndexGraph & graph, std::vector<RestrictionUTurn> const & restrictionsOnlyUTurn, |
| 154 | RestrictionVec & restrictionsNo) |