| 211 | |
| 212 | template <typename builder_type> |
| 213 | void buildGraph(RestrictionGraph &rg, const std::vector<TurnRestriction> &restrictions) |
| 214 | { |
| 215 | const auto run_builder = [&](const auto &restriction) |
| 216 | { |
| 217 | builder_type builder(rg); |
| 218 | |
| 219 | builder.start(restriction.turn_path.From(), restriction.turn_path.FirstVia()); |
| 220 | if (restriction.turn_path.Type() == TurnPathType::VIA_WAY_TURN_PATH) |
| 221 | { |
| 222 | const auto &via_way_path = restriction.turn_path.AsViaWayPath(); |
| 223 | util::for_each_pair(via_way_path.via, |
| 224 | [&](NodeID from, NodeID to) { builder.next(from, to); }); |
| 225 | } |
| 226 | builder.end(restriction); |
| 227 | }; |
| 228 | |
| 229 | std::for_each(restrictions.begin(), restrictions.end(), run_builder); |
| 230 | } |
| 231 | } // namespace restriction_graph_details |
| 232 | |
| 233 | RestrictionGraph constructRestrictionGraph(const std::vector<TurnRestriction> &turn_restrictions) |