Add support for multiple via-way restrictions (#5907)

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.
This commit is contained in:
Michael Bell
2020-12-20 21:59:57 +00:00
committed by GitHub
parent eb1d399f3b
commit 5266ac1635
48 changed files with 3170 additions and 1406 deletions
+4 -11
View File
@@ -11,7 +11,6 @@
#include "util/guidance/turn_lanes.hpp"
#include "util/log.hpp"
#include <boost/numeric/conversion/cast.hpp>
#include <boost/optional/optional.hpp>
#include <boost/tokenizer.hpp>
@@ -19,8 +18,6 @@
#include "osrm/coordinate.hpp"
#include <cstring>
#include <iterator>
#include <limits>
#include <string>
#include <vector>
@@ -69,10 +66,9 @@ void ExtractorCallbacks::ProcessNode(const osmium::Node &input_node,
}
}
void ExtractorCallbacks::ProcessRestriction(const InputConditionalTurnRestriction &restriction)
void ExtractorCallbacks::ProcessRestriction(const InputTurnRestriction &restriction)
{
external_memory.restrictions_list.push_back(restriction);
// util::Log() << restriction.toString();
}
void ExtractorCallbacks::ProcessManeuverOverride(const InputManeuverOverride &override)
@@ -477,12 +473,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
return OSMNodeID{static_cast<std::uint64_t>(ref.ref())};
});
external_memory.way_start_end_id_list.push_back(
{OSMWayID{static_cast<std::uint32_t>(input_way.id())},
OSMNodeID{static_cast<std::uint64_t>(nodes[0].ref())},
OSMNodeID{static_cast<std::uint64_t>(nodes[1].ref())},
OSMNodeID{static_cast<std::uint64_t>(nodes[nodes.size() - 2].ref())},
OSMNodeID{static_cast<std::uint64_t>(nodes.back().ref())}});
auto way_id = OSMWayID{static_cast<std::uint64_t>(input_way.id())};
external_memory.ways_list.push_back(way_id);
external_memory.way_node_id_offsets.push_back(external_memory.used_node_id_list.size());
}
} // namespace extractor