suppress name additions (xxx -> xxxbridge)
This commit is contained in:
parent
1544a08ea2
commit
fddb035539
120
features/guidance/bridges_and_tunnels.feature
Normal file
120
features/guidance/bridges_and_tunnels.feature
Normal file
@ -0,0 +1,120 @@
|
||||
@routing @car @bridge @tunnel @guidance
|
||||
Feature: Car - Guidance - Bridges and Tunnels
|
||||
Background:
|
||||
Given the profile "car"
|
||||
And a grid size of 100 meters
|
||||
|
||||
Scenario: Simple Bridge
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | bridge | name |
|
||||
| ab | primary | | Hauptstraße |
|
||||
| bc | primary | yes | Hauptstraßenbrücke |
|
||||
| cd | primary | | Hauptstraße |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| a | d | Hauptstraße,Hauptstraße | depart,arrive |
|
||||
|
||||
Scenario: Bridge with Immediate Turn
|
||||
Given the node map
|
||||
| | | | d |
|
||||
| a | | b | c |
|
||||
| | | | e |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | bridge | name |
|
||||
| ab | primary | | Hauptstraße |
|
||||
| bc | primary | yes | Hauptstraßenbrücke |
|
||||
| dce | primary | | Nebenstraße |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| a | d | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road left,arrive |
|
||||
| a | e | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road right,arrive |
|
||||
| e | a | Nebenstraße,Hauptstraßenbrücke,Hauptstraße | depart,turn left,arrive |
|
||||
| d | a | Nebenstraße,Hauptstraßenbrücke,Hauptstraße | depart,turn right,arrive |
|
||||
|
||||
Scenario: Bridge with Immediate Turn Front and Back
|
||||
Given the node map
|
||||
| f | | | d |
|
||||
| a | | b | c |
|
||||
| g | | | e |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | bridge | name |
|
||||
| ab | primary | | Hauptstraße |
|
||||
| bc | primary | yes | Hauptstraßenbrücke |
|
||||
| dce | primary | | Nebenstraße |
|
||||
| gaf | primary | | Anderestraße |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| f | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road left,arrive |
|
||||
| f | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road right,arrive |
|
||||
| g | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road left,arrive |
|
||||
| g | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road right,arrive |
|
||||
| e | f | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn left,end of road right,arrive |
|
||||
| e | g | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn left,end of road left,arrive |
|
||||
| d | f | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn right,end of road right,arrive |
|
||||
| d | g | Nebenstraße,Hauptstraßenbrücke,Anderestraße,Anderestraße | depart,turn right,end of road left,arrive |
|
||||
|
||||
Scenario: Simple Tunnel
|
||||
Given the node map
|
||||
| a | b | c | d |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | tunnel | name |
|
||||
| ab | primary | | Hauptstraße |
|
||||
| bc | primary | yes | Hauptstraßentunnel |
|
||||
| cd | primary | | Hauptstraße |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| a | d | Hauptstraße,Hauptstraße | depart,arrive |
|
||||
|
||||
Scenario: Tunnel with Immediate Turn
|
||||
Given the node map
|
||||
| | | | d |
|
||||
| a | | b | c |
|
||||
| | | | e |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | tunnel | name |
|
||||
| ab | primary | | Hauptstraße |
|
||||
| bc | primary | yes | Hauptstraßentunnel |
|
||||
| dce | primary | | Nebenstraße |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| a | d | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road left,arrive |
|
||||
| a | e | Hauptstraße,Nebenstraße,Nebenstraße | depart,end of road right,arrive |
|
||||
| e | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn left,arrive |
|
||||
| d | a | Nebenstraße,Hauptstraßentunnel,Hauptstraße | depart,turn right,arrive |
|
||||
|
||||
Scenario: Tunnel with Immediate Turn Front and Back
|
||||
Given the node map
|
||||
| f | | | d |
|
||||
| a | | b | c |
|
||||
| g | | | e |
|
||||
|
||||
And the ways
|
||||
| nodes | highway | bridge | name |
|
||||
| ab | primary | | Hauptstraße |
|
||||
| bc | primary | yes | Hauptstraßentunnel |
|
||||
| dce | primary | | Nebenstraße |
|
||||
| gaf | primary | | Anderestraße |
|
||||
|
||||
When I route I should get
|
||||
| from | to | route | turns |
|
||||
| f | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road left,arrive |
|
||||
| f | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn left,end of road right,arrive |
|
||||
| g | d | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road left,arrive |
|
||||
| g | e | Anderestraße,Hauptstraße,Nebenstraße,Nebenstraße | depart,turn right,end of road right,arrive |
|
||||
| e | f | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn left,end of road right,arrive |
|
||||
| e | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn left,end of road left,arrive |
|
||||
| d | f | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,end of road right,arrive |
|
||||
| d | g | Nebenstraße,Hauptstraßentunnel,Anderestraße,Anderestraße | depart,turn right,end of road left,arrive |
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm
|
||||
@ -75,20 +76,30 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
|
||||
// We need to skip the first segment because it is already covered by the
|
||||
// initial start of a route
|
||||
int segment_duration = 0;
|
||||
for (const auto &path_point : leg_data)
|
||||
|
||||
// some name changes are not announced in our processing. For these, we have to keep the
|
||||
// first name on the segment
|
||||
unsigned step_name_id = source_node.name_id;
|
||||
for (std::size_t leg_data_index = 0; leg_data_index < leg_data.size(); ++leg_data_index)
|
||||
{
|
||||
const auto &path_point = leg_data[leg_data_index];
|
||||
segment_duration += path_point.duration_until_turn;
|
||||
|
||||
// all changes to this check have to be matched with assemble_geometry
|
||||
if (path_point.turn_instruction.type != extractor::guidance::TurnType::NoTurn)
|
||||
{
|
||||
BOOST_ASSERT(segment_duration >= 0);
|
||||
const auto name = facade.GetNameForID(path_point.name_id);
|
||||
const auto name = facade.GetNameForID(step_name_id);
|
||||
const auto distance = leg_geometry.segment_distances[segment_index];
|
||||
steps.push_back(RouteStep{path_point.name_id, name, NO_ROTARY_NAME,
|
||||
steps.push_back(RouteStep{step_name_id, name, NO_ROTARY_NAME,
|
||||
segment_duration / 10.0, distance, path_point.travel_mode,
|
||||
maneuver, leg_geometry.FrontIndex(segment_index),
|
||||
leg_geometry.BackIndex(segment_index) + 1});
|
||||
if (leg_data_index + 1 < leg_data.size()){
|
||||
step_name_id = leg_data[leg_data_index + 1].name_id;
|
||||
} else {
|
||||
step_name_id = target_node.name_id;
|
||||
}
|
||||
maneuver = detail::stepManeuverFromGeometry(path_point.turn_instruction,
|
||||
leg_geometry, segment_index);
|
||||
segment_index++;
|
||||
@ -98,7 +109,7 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
|
||||
const auto distance = leg_geometry.segment_distances[segment_index];
|
||||
const int duration = segment_duration + target_duration;
|
||||
BOOST_ASSERT(duration >= 0);
|
||||
steps.push_back(RouteStep{target_node.name_id, facade.GetNameForID(target_node.name_id),
|
||||
steps.push_back(RouteStep{step_name_id, facade.GetNameForID(step_name_id),
|
||||
NO_ROTARY_NAME, duration / 10., distance, target_mode, maneuver,
|
||||
leg_geometry.FrontIndex(segment_index),
|
||||
leg_geometry.BackIndex(segment_index) + 1});
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
@ -335,7 +337,8 @@ inline bool requiresNameAnnounced(const std::string &from, const std::string &to
|
||||
|
||||
// check similarity of names
|
||||
const auto names_are_empty = from_name.empty() && to_name.empty();
|
||||
const auto names_are_equal = from_name == to_name;
|
||||
const auto name_is_contained = boost::starts_with(from_name,to_name) || boost::starts_with(to_name,from_name);
|
||||
const auto names_are_equal = from_name == to_name || name_is_contained;
|
||||
const auto name_is_removed = !from_name.empty() && to_name.empty();
|
||||
// references are contained in one another
|
||||
const auto refs_are_empty = from_ref.empty() && to_ref.empty();
|
||||
|
@ -55,6 +55,29 @@ void print(const std::vector<RouteStep> &steps)
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
void print(const std::vector<RouteStep> &steps)
|
||||
{
|
||||
std::cout << "Path\n";
|
||||
int segment = 0;
|
||||
for (const auto &step : steps)
|
||||
{
|
||||
const auto type = static_cast<int>(step.maneuver.instruction.type);
|
||||
const auto modifier = static_cast<int>(step.maneuver.instruction.direction_modifier);
|
||||
|
||||
std::cout << "\t[" << ++segment << "]: " << type << " " << modifier
|
||||
<< " Duration: " << step.duration << " Distance: " << step.distance
|
||||
<< " Geometry: " << step.geometry_begin << " " << step.geometry_end
|
||||
<< " exit: " << step.maneuver.exit
|
||||
<< " Intersections: " << step.maneuver.intersections.size() << " [";
|
||||
|
||||
for (auto intersection : step.maneuver.intersections)
|
||||
std::cout << "(" << intersection.duration << " " << intersection.distance << ")";
|
||||
|
||||
std::cout << "] name[" << step.name_id << "]: " << step.name << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
bool canMergeTrivially(const RouteStep &destination, const RouteStep &source)
|
||||
{
|
||||
return destination.maneuver.exit == 0 && destination.name_id == source.name_id &&
|
||||
|
Loading…
Reference in New Issue
Block a user