Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 84ce97a31e | |||
| 7e0c9f7340 | |||
| 917a36eaee | |||
| 7620d419c6 | |||
| 50c90b29d2 | |||
| 0e77cf53f6 |
@@ -17,6 +17,7 @@
|
||||
- Guidance: add support for throughabouts
|
||||
- Bugfixes
|
||||
- Properly save/retrieve datasource annotations for road segments ([#4346](https://github.com/Project-OSRM/osrm-backend/issues/4346)
|
||||
- Fix conditional restriction grammer parsing so it works for single-day-of-week restrictions ([#4357](https://github.com/Project-OSRM/osrm-backend/pull/4357))
|
||||
- Algorithm)
|
||||
- BREAKING: the file format requires re-processing due to the changes on via-ways
|
||||
- Added support for via-way restrictions
|
||||
|
||||
@@ -739,3 +739,45 @@ Feature: Car - Turn restrictions
|
||||
| from | to | route | turns |
|
||||
| a | c | albic,dobe,dobe,albic,albic | depart,turn left,continue uturn,turn left,arrive |
|
||||
| a | e | albic,dobe,dobe | depart,turn left,arrive |
|
||||
|
||||
@no_turning @conditionals
|
||||
Scenario: Car - Conditional restriction with multiple time windows
|
||||
Given the extract extra arguments "--parse-conditional-restrictions"
|
||||
# 5pm Wed 02 May, 2017 GMT
|
||||
Given the contract extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493744400"
|
||||
|
||||
Given the node map
|
||||
"""
|
||||
a f
|
||||
| |
|
||||
b - e - h
|
||||
| | |
|
||||
c d - g
|
||||
1
|
||||
"""
|
||||
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
| bc |
|
||||
| de |
|
||||
| ef |
|
||||
| be |
|
||||
| eh |
|
||||
| gh |
|
||||
| dg |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | way:via | restriction:conditional |
|
||||
| restriction | ab | be | ef | no_uturn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||
|
||||
And the relations
|
||||
| type | way:from | way:to | node:via | restriction:conditional |
|
||||
| restriction | ed | dg | d | no_uturn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | # |
|
||||
| a | f | ab,be,ef,ef | currently we do not handle conditional via-ways, this test will have to change when we do |
|
||||
| f | 1 | ef,eh,gh,dg,dg | |
|
||||
|
||||
|
||||
@@ -166,7 +166,9 @@ inline void write(storage::io::FileWriter &writer, const WayRestriction &restric
|
||||
inline void read(storage::io::FileReader &reader, TurnRestriction &restriction)
|
||||
{
|
||||
reader.ReadInto(restriction.is_only);
|
||||
if (restriction.Type() == RestrictionType::WAY_RESTRICTION)
|
||||
std::uint32_t restriction_type;
|
||||
reader.ReadInto(restriction_type);
|
||||
if (restriction_type == RestrictionType::WAY_RESTRICTION)
|
||||
{
|
||||
WayRestriction way_restriction;
|
||||
read(reader, way_restriction);
|
||||
@@ -174,7 +176,7 @@ inline void read(storage::io::FileReader &reader, TurnRestriction &restriction)
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT(restriction.Type() == RestrictionType::NODE_RESTRICTION);
|
||||
BOOST_ASSERT(restriction_type == RestrictionType::NODE_RESTRICTION);
|
||||
NodeRestriction node_restriction;
|
||||
read(reader, node_restriction);
|
||||
restriction.node_or_way = std::move(node_restriction);
|
||||
@@ -184,6 +186,8 @@ inline void read(storage::io::FileReader &reader, TurnRestriction &restriction)
|
||||
inline void write(storage::io::FileWriter &writer, const TurnRestriction &restriction)
|
||||
{
|
||||
writer.WriteOne(restriction.is_only);
|
||||
const std::uint32_t restriction_type = restriction.Type();
|
||||
writer.WriteOne(restriction_type);
|
||||
if (restriction.Type() == RestrictionType::WAY_RESTRICTION)
|
||||
{
|
||||
write(writer, mapbox::util::get<WayRestriction>(restriction.node_or_way));
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "osrm",
|
||||
"version": "5.10.0-rc.1",
|
||||
"version": "5.10.0-rc.2",
|
||||
"private": false,
|
||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
||||
"dependencies": {
|
||||
|
||||
@@ -765,7 +765,7 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
// translate the turn from one segment onto another into a node restriction (the ways can only
|
||||
// be connected at a single location)
|
||||
auto const get_node_restriction_from_OSM_ids = [&](
|
||||
auto const from_id, auto const to_id, const OSMNodeID via_node = MAX_OSM_NODEID) {
|
||||
auto const from_id, auto const to_id, const OSMNodeID via_node) {
|
||||
auto const from_segment_itr = referenced_ways.find(from_id);
|
||||
if (from_segment_itr->second.way_id != from_id)
|
||||
{
|
||||
@@ -792,9 +792,9 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
auto const &external = external_type.AsWayRestriction();
|
||||
// check if we were able to resolve all the involved ways
|
||||
auto const from_restriction =
|
||||
get_node_restriction_from_OSM_ids(external.from, external.via);
|
||||
get_node_restriction_from_OSM_ids(external.from, external.via, MAX_OSM_NODEID);
|
||||
auto const to_restriction =
|
||||
get_node_restriction_from_OSM_ids(external.via, external.to);
|
||||
get_node_restriction_from_OSM_ids(external.via, external.to, MAX_OSM_NODEID);
|
||||
|
||||
// failed to translate either of the involved nodes?
|
||||
if (!from_restriction.Valid() || !to_restriction.Valid())
|
||||
|
||||
@@ -128,7 +128,7 @@ RestrictionParser::TryParse(const osmium::Relation &relation) const
|
||||
restriction_container.is_only = is_only_restriction;
|
||||
|
||||
boost::optional<std::uint64_t> from = boost::none, via = boost::none, to = boost::none;
|
||||
bool is_node_restriction;
|
||||
bool is_node_restriction = true;
|
||||
|
||||
for (const auto &member : relation.members())
|
||||
{
|
||||
|
||||
@@ -343,6 +343,7 @@ int RestrictionsCheckCommand(const char *executable, const std::vector<std::stri
|
||||
// For each conditional restriction if condition is active than print a line
|
||||
for (auto &value : conditional_restrictions)
|
||||
{
|
||||
|
||||
const auto &location = value.location;
|
||||
const auto &restriction = value.restriction;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user