Currently OSRM only supports turn restrictions with a single via-node or one via-way. OSM allows for multiple via-ways to represent longer and more complex restrictions. This PR extends the use of duplicate nodes for representng via-way turn restrictions to also support multi via-way restrictions. Effectively, this increases the edge-based graph size by the number of edges in multi via-way restrictions. However, given the low number of these restrictions it has little effect on total graph size. In addition, we add a new step in the extraction phase that constructs a restriction graph to support more complex relationships between restrictions, such as nested restrictions and overlapping restrictions.
32 lines
656 B
C++
32 lines
656 B
C++
#ifndef FOR_EACH_INDEXED_HPP
|
|
#define FOR_EACH_INDEXED_HPP
|
|
|
|
#include <iterator>
|
|
#include <numeric>
|
|
#include <utility>
|
|
|
|
namespace osrm
|
|
{
|
|
namespace util
|
|
{
|
|
|
|
template <typename ForwardIterator, typename Function>
|
|
void for_each_indexed(ForwardIterator first, ForwardIterator last, Function function)
|
|
{
|
|
for (size_t i = 0; first != last; ++first, ++i)
|
|
{
|
|
function(i, *first);
|
|
}
|
|
}
|
|
|
|
template <class ContainerT, typename Function>
|
|
void for_each_pair(ContainerT &container, Function function)
|
|
{
|
|
for_each_indexed(std::begin(container), std::end(container), function);
|
|
}
|
|
|
|
} // namespace util
|
|
} // namespace osrm
|
|
|
|
#endif /* FOR_EACH_INDEXED_HPP */
|