handle sliproads at traffic lights

This commit is contained in:
Moritz Kobitzsch 2016-06-27 17:05:13 +02:00 committed by Patrick Niklaus
parent ec02cdc4cc
commit 311b348d09
No known key found for this signature in database
GPG Key ID: E426891B5F978B1B
2 changed files with 81 additions and 16 deletions

View File

@ -57,20 +57,21 @@ Feature: Slipways and Dedicated Turn Lanes
Scenario: Inner city expressway with on road
Given the node map
| a | b | | | | c |
| | | | | f | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | d |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | e |
| a | b | | | | c | g |
| | | | | f | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | d | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | e | |
And the ways
| nodes | highway | name |
| abc | primary | road |
| cg | primary | road |
| bfd | trunk_link | |
| cde | trunk | trunk |
@ -123,3 +124,46 @@ Feature: Slipways and Dedicated Turn Lanes
When I route I should get
| waypoints | route | turns |
| a,f | road,road,road | depart,continue uturn,arrive |
Scenario: Schwarzwaldstrasse Autobahn
Given the node map
| | | | | i | | | | | | h | | | | | g |
| | | j | | | | | | | | | | | | | |
| a | | | | | | | k | | | | | | | | |
| | | | b | | r | c | | d | | e | | | | | f |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | l | | | | | | | | | | |
| | | | | | m | | | | | | | | | | |
| | | | | | | n | | q | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | o | | p | | | | | | | |
And the nodes
# the traffic light at `l` is not actually in the data, but necessary for the test to check everything
# http://www.openstreetmap.org/#map=19/48.99211/8.40336
| node | highway |
| r | traffic_signals |
| l | traffic_signals |
And the ways
| nodes | highway | name | ref | oneway |
| abrcd | secondary | Schwarzwaldstrasse | L561 | yes |
| hija | secondary | Schwarzwaldstrasse | L561 | yes |
| def | secondary | Ettlinger Strasse | | yes |
| gh | secondary | Ettlinger Strasse | | yes |
| blmn | secondary_link | | L561 | yes |
| hkc | secondary_link | Ettlinger Strasse | | yes |
| qdki | secondary_link | Ettlinger Allee | | yes |
| cn | secondary_link | Ettlinger Allee | | yes |
| no | primary | Ettlinger Allee | | yes |
| pq | primary | Ettlinger Allee | | yes |
| qe | secondary_link | Ettlinger Allee | | yes |
When I route I should get
| waypoints | route | turns |
| a,o | Schwarzwaldstrasse (L561),Ettlinger Allee,Ettlinger Allee | depart,turn right,arrive |

View File

@ -1,6 +1,6 @@
#include "extractor/guidance/turn_analysis.hpp"
#include "extractor/guidance/classification_data.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/turn_analysis.hpp"
#include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp"
@ -164,7 +164,6 @@ Intersection TurnAnalysis::handleSliproads(const EdgeID source_edge_id,
});
const bool hasNext = next_road != intersection.end();
if (!hasNext)
{
return intersection;
@ -177,10 +176,21 @@ Intersection TurnAnalysis::handleSliproads(const EdgeID source_edge_id,
return intersection;
}
const auto next_road_next_intersection =
intersection_generator(intersection_node_id, next_road->turn.eid);
auto next_intersection_node = node_based_graph.GetTarget(next_road->turn.eid);
const auto next_intersection_node = node_based_graph.GetTarget(next_road->turn.eid);
const auto next_road_next_intersection = [&]() {
auto intersection = intersection_generator(intersection_node_id, next_road->turn.eid);
auto in_edge = next_road->turn.eid;
//skip over traffic lights
if(intersection.size() == 2)
{
const auto node = node_based_graph.GetTarget(in_edge);
in_edge = intersection[1].turn.eid;
next_intersection_node = node_based_graph.GetTarget(in_edge);
intersection = intersection_generator(node, in_edge);
}
return intersection;
}();
std::unordered_set<NameID> target_road_names;
@ -194,7 +204,18 @@ Intersection TurnAnalysis::handleSliproads(const EdgeID source_edge_id,
{
if (linkTest(road))
{
auto target_intersection = intersection_generator(intersection_node_id, road.turn.eid);
const auto target_intersection = [&](NodeID node, EdgeID eid) {
auto intersection = intersection_generator(node, eid);
//skip over traffic lights
if(intersection.size() == 2)
{
node = node_based_graph.GetTarget(eid);
eid = intersection[1].turn.eid;
intersection = intersection_generator(node, eid);
}
return intersection;
}(intersection_node_id, road.turn.eid);
for (const auto &candidate_road : target_intersection)
{
const auto &candidate_data = node_based_graph.GetEdgeData(candidate_road.turn.eid);