| 28 | } |
| 29 | |
| 30 | void insertRestriction(RestrictionGraph &rg, |
| 31 | const RestrictionID id, |
| 32 | const TurnRestriction *restriction) |
| 33 | { |
| 34 | const auto range = rg.GetRestrictions(id); |
| 35 | auto &node = rg.nodes[id]; |
| 36 | if (node.restrictions_begin_idx + range.size() != rg.restrictions.size()) |
| 37 | { |
| 38 | // Most nodes will only have zero or one restriction, so this copy will be infrequent |
| 39 | node.restrictions_begin_idx = rg.restrictions.size(); |
| 40 | std::copy(range.begin(), range.end(), std::back_inserter(rg.restrictions)); |
| 41 | } |
| 42 | rg.restrictions.push_back(restriction); |
| 43 | node.num_restrictions += 1; |
| 44 | } |
| 45 | |
| 46 | RestrictionID getOrInsertStartNode(RestrictionGraph &rg, NodeID from, NodeID to) |
| 47 | { |