prefer notification over new-name/suppressed types

This commit is contained in:
karenzshea 2016-09-15 10:37:28 -04:00 committed by Moritz Kobitzsch
parent 3d5a53566c
commit 1a96483f7b
2 changed files with 62 additions and 10 deletions

View File

@ -0,0 +1,57 @@
@routing @guidance @mode-change
Feature: Notification on turn onto mode change
Background:
Given the profile "car"
Given a grid size of 400 meters
Scenario: Turn onto a Ferry
Given the node map
| f | | | | |
| b | | | d | |
| a | | | | e |
And the ways
| nodes | highway | route | name |
| abf | primary | | |
| bd | | ferry | ferry |
| de | primary | | |
When I route I should get
| waypoints | route | turns | modes |
| a,e | ,ferry,, | depart,turn right,notification right,arrive | driving,ferry,driving,driving |
Scenario: Turn onto a Ferry
Given the node map
| h | | | g |
| a | c | | e |
| b | | | f |
And the ways
| nodes | highway | route | name |
| ac | primary | | |
| bah | primary | | |
| ec | | ferry | ferry |
| gef | primary | | |
When I route I should get
| waypoints | route | turns | modes |
| g,h | ,ferry,,, | depart,turn right,notification straight,turn right,arrive | driving,ferry,driving,driving,driving |
| b,g | ,,ferry,, | depart,turn right,notification straight,turn left,arrive | driving,driving,ferry,driving,driving |
Scenario: Straight onto a Ferry
Given the node map
| | | | | |
| | c | d | | i |
| a | | | | |
| | | | f | |
And the ways
| nodes | highway | route | name |
| ac | primary | | |
| dc | | ferry | ferry |
| df | primary | | |
When I route I should get
| waypoints | route | turns | modes |
| a,f | ,ferry,, | depart,notification right,notification right,arrive | driving,ferry,driving,driving |

View File

@ -1,5 +1,5 @@
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/coordinate_calculation.hpp"
@ -110,10 +110,7 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
else if (in_data.road_classification.IsRampClass() &&
out_data.road_classification.IsRampClass())
{
if (in_mode == out_mode)
return {TurnType::Suppressed, getTurnDirection(road.turn.angle)};
else
return {TurnType::Notification, getTurnDirection(road.turn.angle)};
return {in_mode == out_mode ? TurnType::Suppressed : TurnType::Notification, getTurnDirection(road.turn.angle)};
}
else
{
@ -140,15 +137,13 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
}
else
{
return {TurnType::NewName, getTurnDirection(road.turn.angle)};
return {in_mode == out_mode ? TurnType::NewName : TurnType::Notification, getTurnDirection(road.turn.angle)};
}
}
// name has not changed, suppress a turn here or indicate mode change
else
{
if (in_mode == out_mode)
return {TurnType::Suppressed, getTurnDirection(road.turn.angle)};
else
return {TurnType::Notification, getTurnDirection(road.turn.angle)};
return {in_mode == out_mode ? TurnType::Suppressed : TurnType::Notification, getTurnDirection(road.turn.angle)};
}
}
BOOST_ASSERT(type == TurnType::Continue);