Adapt test to returning ref, Take Pronunciation into Account, Fixes name change heuristic usage in UTurn check
This commit is contained in:
parent
ccdebccde1
commit
6ac9617d49
@ -36,9 +36,9 @@ Feature: Car - Street names in instructions
|
|||||||
| cd | Your Way | yourewaye | |
|
| cd | Your Way | yourewaye | |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | pronunciations | ref |
|
| from | to | route | pronunciations | ref |
|
||||||
| a | d | My Way,My Way | ,meyeway | ,A1 |
|
| a | d | My Way,My Way,My Way | ,meyeway,meyeway | ,A1,A1 |
|
||||||
| 1 | c | Your Way,Your Way | yourewaye,yourewaye | , |
|
| 1 | c | Your Way,Your Way | yourewaye,yourewaye | , |
|
||||||
|
|
||||||
# See #2860
|
# See #2860
|
||||||
Scenario: Car - same street name but different pronunciation
|
Scenario: Car - same street name but different pronunciation
|
||||||
|
@ -241,7 +241,7 @@ Feature: Slipways and Dedicated Turn Lanes
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route | turns | ref |
|
| waypoints | route | turns | ref |
|
||||||
| a,o | Schwarzwaldstrasse,Ettlinger Allee,Ettlinger Allee | depart,turn right,arrive | L561,, |
|
| a,o | Schwarzwaldstrasse,Ettlinger Allee,Ettlinger Allee | depart,turn right,arrive | L561,L561, |
|
||||||
|
|
||||||
Scenario: Traffic Lights everywhere
|
Scenario: Traffic Lights everywhere
|
||||||
#http://map.project-osrm.org/?z=18¢er=48.995336%2C8.383813&loc=48.995467%2C8.384548&loc=48.995115%2C8.382761&hl=en&alt=0
|
#http://map.project-osrm.org/?z=18¢er=48.995336%2C8.383813&loc=48.995467%2C8.384548&loc=48.995115%2C8.382761&hl=en&alt=0
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
/* A set of tools required for guidance in both pre and post-processing */
|
/* A set of tools required for guidance in both pre and post-processing */
|
||||||
|
|
||||||
#include "extractor/guidance/turn_instruction.hpp"
|
#include "extractor/guidance/turn_instruction.hpp"
|
||||||
|
#include "extractor/suffix_table.hpp"
|
||||||
#include "engine/guidance/route_step.hpp"
|
#include "engine/guidance/route_step.hpp"
|
||||||
#include "engine/phantom_node.hpp"
|
#include "engine/phantom_node.hpp"
|
||||||
#include "util/attributes.hpp"
|
#include "util/attributes.hpp"
|
||||||
#include "util/guidance/bearing_class.hpp"
|
#include "util/guidance/bearing_class.hpp"
|
||||||
#include "util/guidance/entry_class.hpp"
|
#include "util/guidance/entry_class.hpp"
|
||||||
|
#include "util/name_table.hpp"
|
||||||
#include "util/simple_logger.hpp"
|
#include "util/simple_logger.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -163,8 +165,10 @@ inline std::pair<std::string, std::string> getPrefixAndSuffix(const std::string
|
|||||||
template <typename SuffixTable>
|
template <typename SuffixTable>
|
||||||
inline bool requiresNameAnnounced(const std::string &from_name,
|
inline bool requiresNameAnnounced(const std::string &from_name,
|
||||||
const std::string &from_ref,
|
const std::string &from_ref,
|
||||||
|
const std::string &from_pronunciation,
|
||||||
const std::string &to_name,
|
const std::string &to_name,
|
||||||
const std::string &to_ref,
|
const std::string &to_ref,
|
||||||
|
const std::string &to_pronunciation,
|
||||||
const SuffixTable &suffix_table)
|
const SuffixTable &suffix_table)
|
||||||
{
|
{
|
||||||
// first is empty and the second is not
|
// first is empty and the second is not
|
||||||
@ -244,13 +248,17 @@ inline bool requiresNameAnnounced(const std::string &from_name,
|
|||||||
// " (Ref)" -> "Name "
|
// " (Ref)" -> "Name "
|
||||||
(from_name.empty() && !from_ref.empty() && !to_name.empty() && to_ref.empty());
|
(from_name.empty() && !from_ref.empty() && !to_name.empty() && to_ref.empty());
|
||||||
|
|
||||||
return !obvious_change || needs_announce;
|
const auto pronunciation_changes = from_pronunciation != to_pronunciation;
|
||||||
|
|
||||||
|
return !obvious_change || needs_announce || pronunciation_changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overload without suffix checking
|
// Overload without suffix checking
|
||||||
inline bool requiresNameAnnounced(const std::string &from_name,
|
inline bool requiresNameAnnounced(const std::string &from_name,
|
||||||
const std::string &from_ref,
|
const std::string &from_ref,
|
||||||
|
const std::string &from_pronunciation,
|
||||||
const std::string &to_name,
|
const std::string &to_name,
|
||||||
|
const std::string &to_pronunciation,
|
||||||
const std::string &to_ref)
|
const std::string &to_ref)
|
||||||
{
|
{
|
||||||
// Dummy since we need to provide a SuffixTable but do not have the data for it.
|
// Dummy since we need to provide a SuffixTable but do not have the data for it.
|
||||||
@ -261,7 +269,34 @@ inline bool requiresNameAnnounced(const std::string &from_name,
|
|||||||
bool isSuffix(const std::string &) const { return false; }
|
bool isSuffix(const std::string &) const { return false; }
|
||||||
} static const table;
|
} static const table;
|
||||||
|
|
||||||
return requiresNameAnnounced(from_name, from_ref, to_name, to_ref, table);
|
return requiresNameAnnounced(
|
||||||
|
from_name, from_ref, from_pronunciation, to_name, to_ref, to_pronunciation, table);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool requiresNameAnnounced(const NameID from_name_id,
|
||||||
|
const NameID to_name_id,
|
||||||
|
const util::NameTable &name_table,
|
||||||
|
const extractor::SuffixTable &suffix_table)
|
||||||
|
{
|
||||||
|
return requiresNameAnnounced(name_table.GetNameForID(from_name_id),
|
||||||
|
name_table.GetRefForID(from_name_id),
|
||||||
|
name_table.GetPronunciationForID(from_name_id),
|
||||||
|
name_table.GetNameForID(to_name_id),
|
||||||
|
name_table.GetRefForID(to_name_id),
|
||||||
|
name_table.GetPronunciationForID(to_name_id),
|
||||||
|
suffix_table);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool requiresNameAnnounced(const NameID from_name_id,
|
||||||
|
const NameID to_name_id,
|
||||||
|
const util::NameTable &name_table)
|
||||||
|
{
|
||||||
|
return requiresNameAnnounced(name_table.GetNameForID(from_name_id),
|
||||||
|
name_table.GetRefForID(from_name_id),
|
||||||
|
name_table.GetPronunciationForID(from_name_id),
|
||||||
|
name_table.GetNameForID(to_name_id),
|
||||||
|
name_table.GetRefForID(to_name_id),
|
||||||
|
name_table.GetPronunciationForID(to_name_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace guidance
|
} // namespace guidance
|
||||||
|
@ -30,6 +30,7 @@ class NameTable
|
|||||||
// (at time of writing this: get{Name,Ref,Pronunciation,Destinations}ForID(name_id);)
|
// (at time of writing this: get{Name,Ref,Pronunciation,Destinations}ForID(name_id);)
|
||||||
std::string GetNameForID(const unsigned name_id) const;
|
std::string GetNameForID(const unsigned name_id) const;
|
||||||
std::string GetRefForID(const unsigned name_id) const;
|
std::string GetRefForID(const unsigned name_id) const;
|
||||||
|
std::string GetPronunciationForID(const unsigned name_id) const;
|
||||||
};
|
};
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
@ -127,9 +127,9 @@ double turn_angle(const double entry_bearing, const double exit_bearing)
|
|||||||
// Treats e.g. "Name (Ref)" -> "Name" changes still as same name.
|
// Treats e.g. "Name (Ref)" -> "Name" changes still as same name.
|
||||||
bool isNoticeableNameChange(const RouteStep &lhs, const RouteStep &rhs)
|
bool isNoticeableNameChange(const RouteStep &lhs, const RouteStep &rhs)
|
||||||
{
|
{
|
||||||
// TODO: at some point we might want to think about pronunciation here.
|
// TODO: rotary_name is not handled at the moment.
|
||||||
// Also rotary_name is not handled at the moment.
|
return util::guidance::requiresNameAnnounced(
|
||||||
return util::guidance::requiresNameAnnounced(lhs.name, lhs.ref, rhs.name, rhs.ref);
|
lhs.name, lhs.ref, lhs.pronunciation, rhs.name, rhs.ref, rhs.pronunciation);
|
||||||
}
|
}
|
||||||
|
|
||||||
double nameSegmentLength(std::size_t at, const std::vector<RouteStep> &steps)
|
double nameSegmentLength(std::size_t at, const std::vector<RouteStep> &steps)
|
||||||
@ -372,10 +372,10 @@ bool isLinkroad(const RouteStep &step)
|
|||||||
|
|
||||||
bool isUTurn(const RouteStep &in_step, const RouteStep &out_step, const RouteStep &pre_in_step)
|
bool isUTurn(const RouteStep &in_step, const RouteStep &out_step, const RouteStep &pre_in_step)
|
||||||
{
|
{
|
||||||
const bool is_possible_candidate = in_step.distance <= MAX_COLLAPSE_DISTANCE ||
|
const bool is_possible_candidate =
|
||||||
choiceless(out_step, in_step) ||
|
in_step.distance <= MAX_COLLAPSE_DISTANCE || choiceless(out_step, in_step) ||
|
||||||
(isLinkroad(in_step) && out_step.name_id != EMPTY_NAMEID &&
|
(isLinkroad(in_step) && out_step.name_id != EMPTY_NAMEID &&
|
||||||
pre_in_step.name_id == out_step.name_id);
|
pre_in_step.name_id != EMPTY_NAMEID && !isNoticeableNameChange(pre_in_step, out_step));
|
||||||
const bool takes_u_turn = bearingsAreReversed(
|
const bool takes_u_turn = bearingsAreReversed(
|
||||||
util::bearing::reverseBearing(
|
util::bearing::reverseBearing(
|
||||||
in_step.intersections.front().bearings[in_step.intersections.front().in]),
|
in_step.intersections.front().bearings[in_step.intersections.front().in]),
|
||||||
|
@ -229,11 +229,8 @@ bool IntersectionGenerator::CanMerge(const NodeID node_at_intersection,
|
|||||||
|
|
||||||
// need to be same name
|
// need to be same name
|
||||||
if (second_data.name_id != EMPTY_NAMEID &&
|
if (second_data.name_id != EMPTY_NAMEID &&
|
||||||
util::guidance::requiresNameAnnounced(name_table.GetNameForID(first_data.name_id),
|
util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetRefForID(first_data.name_id),
|
first_data.name_id, second_data.name_id, name_table, street_name_suffix_table))
|
||||||
name_table.GetNameForID(second_data.name_id),
|
|
||||||
name_table.GetRefForID(second_data.name_id),
|
|
||||||
street_name_suffix_table))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// compatibility is required
|
// compatibility is required
|
||||||
@ -341,11 +338,8 @@ bool IntersectionGenerator::CanMerge(const NodeID node_at_intersection,
|
|||||||
const auto &third_data = node_based_graph.GetEdgeData(intersection[third_index].eid);
|
const auto &third_data = node_based_graph.GetEdgeData(intersection[third_index].eid);
|
||||||
|
|
||||||
if (third_data.name_id != EMPTY_NAMEID &&
|
if (third_data.name_id != EMPTY_NAMEID &&
|
||||||
util::guidance::requiresNameAnnounced(name_table.GetNameForID(third_data.name_id),
|
util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetRefForID(third_data.name_id),
|
third_data.name_id, first_data.name_id, name_table, street_name_suffix_table))
|
||||||
name_table.GetNameForID(first_data.name_id),
|
|
||||||
name_table.GetRefForID(first_data.name_id),
|
|
||||||
street_name_suffix_table))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// we only allow collapsing of a Y like fork. So the angle to the third index has to be
|
// we only allow collapsing of a Y like fork. So the angle to the third index has to be
|
||||||
|
@ -59,12 +59,8 @@ TurnType::Enum IntersectionHandler::findBasicTurnType(const EdgeID via_edge,
|
|||||||
if (!on_ramp && onto_ramp)
|
if (!on_ramp && onto_ramp)
|
||||||
return TurnType::OnRamp;
|
return TurnType::OnRamp;
|
||||||
|
|
||||||
const auto same_name =
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
!util::guidance::requiresNameAnnounced(name_table.GetNameForID(in_data.name_id),
|
in_data.name_id, out_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(in_data.name_id),
|
|
||||||
name_table.GetNameForID(out_data.name_id),
|
|
||||||
name_table.GetRefForID(out_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
if (in_data.name_id != EMPTY_NAMEID && out_data.name_id != EMPTY_NAMEID && same_name)
|
if (in_data.name_id != EMPTY_NAMEID && out_data.name_id != EMPTY_NAMEID && same_name)
|
||||||
{
|
{
|
||||||
@ -97,11 +93,8 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
|
|||||||
const auto &in_data = node_based_graph.GetEdgeData(via_edge);
|
const auto &in_data = node_based_graph.GetEdgeData(via_edge);
|
||||||
const auto &out_data = node_based_graph.GetEdgeData(road.eid);
|
const auto &out_data = node_based_graph.GetEdgeData(road.eid);
|
||||||
|
|
||||||
if (util::guidance::requiresNameAnnounced(name_table.GetNameForID(in_data.name_id),
|
if (util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetRefForID(in_data.name_id),
|
in_data.name_id, out_data.name_id, name_table, street_name_suffix_table))
|
||||||
name_table.GetNameForID(out_data.name_id),
|
|
||||||
name_table.GetRefForID(out_data.name_id),
|
|
||||||
street_name_suffix_table))
|
|
||||||
{
|
{
|
||||||
// obvious turn onto a through street is a merge
|
// obvious turn onto a through street is a merge
|
||||||
if (through_street)
|
if (through_street)
|
||||||
@ -367,11 +360,8 @@ bool IntersectionHandler::isThroughStreet(const std::size_t index,
|
|||||||
|
|
||||||
const bool have_same_name =
|
const bool have_same_name =
|
||||||
road_data.name_id != EMPTY_NAMEID &&
|
road_data.name_id != EMPTY_NAMEID &&
|
||||||
!util::guidance::requiresNameAnnounced(name_table.GetNameForID(data_at_index.name_id),
|
!util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetRefForID(data_at_index.name_id),
|
data_at_index.name_id, road_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetNameForID(road_data.name_id),
|
|
||||||
name_table.GetRefForID(road_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
const bool have_same_category =
|
const bool have_same_category =
|
||||||
data_at_index.road_classification == road_data.road_classification;
|
data_at_index.road_classification == road_data.road_classification;
|
||||||
@ -413,12 +403,8 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
const auto continue_class =
|
const auto continue_class =
|
||||||
node_based_graph.GetEdgeData(intersection[best_continue].eid).road_classification;
|
node_based_graph.GetEdgeData(intersection[best_continue].eid).road_classification;
|
||||||
|
|
||||||
const auto same_name =
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
!util::guidance::requiresNameAnnounced(name_table.GetNameForID(in_data.name_id),
|
in_data.name_id, out_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(in_data.name_id),
|
|
||||||
name_table.GetNameForID(out_data.name_id),
|
|
||||||
name_table.GetRefForID(out_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
if (same_name && (best_continue == 0 || (continue_class.GetPriority() >
|
if (same_name && (best_continue == 0 || (continue_class.GetPriority() >
|
||||||
out_data.road_classification.GetPriority() &&
|
out_data.road_classification.GetPriority() &&
|
||||||
@ -476,11 +462,7 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
const auto &road_data = node_based_graph.GetEdgeData(road.eid);
|
const auto &road_data = node_based_graph.GetEdgeData(road.eid);
|
||||||
|
|
||||||
const auto same_name = !util::guidance::requiresNameAnnounced(
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetNameForID(in_data.name_id),
|
in_data.name_id, road_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(in_data.name_id),
|
|
||||||
name_table.GetNameForID(road_data.name_id),
|
|
||||||
name_table.GetRefForID(road_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
if (same_name)
|
if (same_name)
|
||||||
{
|
{
|
||||||
@ -511,12 +493,11 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
return std::count_if(
|
return std::count_if(
|
||||||
intersection.begin() + 1, intersection.end(), [&](const ConnectedRoad &road) {
|
intersection.begin() + 1, intersection.end(), [&](const ConnectedRoad &road) {
|
||||||
const auto &road_data = node_based_graph.GetEdgeData(road.eid);
|
const auto &road_data = node_based_graph.GetEdgeData(road.eid);
|
||||||
const auto same_name = !util::guidance::requiresNameAnnounced(
|
const auto same_name =
|
||||||
name_table.GetNameForID(in_data.name_id),
|
!util::guidance::requiresNameAnnounced(in_data.name_id,
|
||||||
name_table.GetRefForID(in_data.name_id),
|
road_data.name_id,
|
||||||
name_table.GetNameForID(road_data.name_id),
|
name_table,
|
||||||
name_table.GetRefForID(road_data.name_id),
|
street_name_suffix_table);
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
return same_name &&
|
return same_name &&
|
||||||
angularDeviation(road.angle, STRAIGHT_ANGLE) < NARROW_TURN_ANGLE;
|
angularDeviation(road.angle, STRAIGHT_ANGLE) < NARROW_TURN_ANGLE;
|
||||||
@ -725,11 +706,7 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const auto same_name = !util::guidance::requiresNameAnnounced(
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetNameForID(turn_data.name_id),
|
turn_data.name_id, continue_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(turn_data.name_id),
|
|
||||||
name_table.GetNameForID(continue_data.name_id),
|
|
||||||
name_table.GetRefForID(continue_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
if (same_name && deviation_ratio < 1.5 * DISTINCTION_RATIO)
|
if (same_name && deviation_ratio < 1.5 * DISTINCTION_RATIO)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -121,12 +121,8 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
|
|||||||
{
|
{
|
||||||
const auto &out_data = node_based_graph.GetEdgeData(road.eid);
|
const auto &out_data = node_based_graph.GetEdgeData(road.eid);
|
||||||
|
|
||||||
const auto same_name =
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
!util::guidance::requiresNameAnnounced(name_table.GetNameForID(in_data.name_id),
|
in_data.name_id, out_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(in_data.name_id),
|
|
||||||
name_table.GetNameForID(out_data.name_id),
|
|
||||||
name_table.GetRefForID(out_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
if (road.angle != 0 && in_data.name_id != EMPTY_NAMEID &&
|
if (road.angle != 0 && in_data.name_id != EMPTY_NAMEID &&
|
||||||
out_data.name_id != EMPTY_NAMEID && same_name &&
|
out_data.name_id != EMPTY_NAMEID && same_name &&
|
||||||
@ -361,16 +357,13 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
|
|||||||
}
|
}
|
||||||
else if (intersection.size() == 3)
|
else if (intersection.size() == 3)
|
||||||
{
|
{
|
||||||
const auto &second_intersection_data =
|
const auto &second_intersection_data = node_based_graph.GetEdgeData(intersection[2].eid);
|
||||||
node_based_graph.GetEdgeData(intersection[2].eid);
|
const auto &first_intersection_data = node_based_graph.GetEdgeData(intersection[1].eid);
|
||||||
const auto &first_intersection_data =
|
const auto first_second_same_name =
|
||||||
node_based_graph.GetEdgeData(intersection[1].eid);
|
!util::guidance::requiresNameAnnounced(second_intersection_data.name_id,
|
||||||
const auto first_second_same_name = !util::guidance::requiresNameAnnounced(
|
first_intersection_data.name_id,
|
||||||
name_table.GetNameForID(second_intersection_data.name_id),
|
name_table,
|
||||||
name_table.GetRefForID(second_intersection_data.name_id),
|
street_name_suffix_table);
|
||||||
name_table.GetNameForID(first_intersection_data.name_id),
|
|
||||||
name_table.GetRefForID(first_intersection_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
// merging onto a passing highway / or two ramps merging onto the same highway
|
// merging onto a passing highway / or two ramps merging onto the same highway
|
||||||
if (num_valid_turns == 1)
|
if (num_valid_turns == 1)
|
||||||
|
@ -242,11 +242,7 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
|
|||||||
|
|
||||||
const auto announce = [&](unsigned id) {
|
const auto announce = [&](unsigned id) {
|
||||||
return util::guidance::requiresNameAnnounced(
|
return util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetNameForID(id),
|
id, edge_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(id),
|
|
||||||
name_table.GetNameForID(edge_data.name_id),
|
|
||||||
name_table.GetRefForID(edge_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (std::all_of(begin(roundabout_name_ids), end(roundabout_name_ids), announce))
|
if (std::all_of(begin(roundabout_name_ids), end(roundabout_name_ids), announce))
|
||||||
|
@ -154,11 +154,7 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
|
|||||||
// Test to see if the source edge and the one we're looking at are the same road
|
// Test to see if the source edge and the one we're looking at are the same road
|
||||||
|
|
||||||
const auto same_name = !util::guidance::requiresNameAnnounced(
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetNameForID(road_edge_data.name_id),
|
road_edge_data.name_id, source_edge_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(road_edge_data.name_id),
|
|
||||||
name_table.GetNameForID(source_edge_data.name_id),
|
|
||||||
name_table.GetRefForID(source_edge_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
return road_edge_data.road_classification == source_edge_data.road_classification &&
|
return road_edge_data.road_classification == source_edge_data.road_classification &&
|
||||||
road_edge_data.name_id != EMPTY_NAMEID && source_edge_data.name_id != EMPTY_NAMEID &&
|
road_edge_data.name_id != EMPTY_NAMEID && source_edge_data.name_id != EMPTY_NAMEID &&
|
||||||
@ -229,10 +225,9 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
|
|||||||
const auto same_name =
|
const auto same_name =
|
||||||
road_edge_data.name_id != EMPTY_NAMEID &&
|
road_edge_data.name_id != EMPTY_NAMEID &&
|
||||||
!util::guidance::requiresNameAnnounced(
|
!util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetNameForID(road_edge_data.name_id),
|
road_edge_data.name_id,
|
||||||
name_table.GetRefForID(road_edge_data.name_id),
|
link_data.name_id,
|
||||||
name_table.GetNameForID(link_data.name_id),
|
name_table,
|
||||||
name_table.GetRefForID(link_data.name_id),
|
|
||||||
street_name_suffix_table);
|
street_name_suffix_table);
|
||||||
|
|
||||||
return same_name;
|
return same_name;
|
||||||
@ -274,14 +269,10 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
|
|||||||
{
|
{
|
||||||
const auto &next_data = node_based_graph.GetEdgeData(next_road.eid);
|
const auto &next_data = node_based_graph.GetEdgeData(next_road.eid);
|
||||||
|
|
||||||
const auto same_name = next_data.name_id != EMPTY_NAMEID &&
|
const auto same_name =
|
||||||
source_edge_data.name_id != EMPTY_NAMEID &&
|
next_data.name_id != EMPTY_NAMEID && source_edge_data.name_id != EMPTY_NAMEID &&
|
||||||
!util::guidance::requiresNameAnnounced(
|
!util::guidance::requiresNameAnnounced(
|
||||||
name_table.GetNameForID(next_data.name_id),
|
next_data.name_id, source_edge_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(next_data.name_id),
|
|
||||||
name_table.GetNameForID(source_edge_data.name_id),
|
|
||||||
name_table.GetRefForID(source_edge_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
if (same_name)
|
if (same_name)
|
||||||
{
|
{
|
||||||
|
@ -112,12 +112,8 @@ bool TurnHandler::isObviousOfTwo(const EdgeID via_edge,
|
|||||||
|
|
||||||
const auto &road_data = node_based_graph.GetEdgeData(road.eid);
|
const auto &road_data = node_based_graph.GetEdgeData(road.eid);
|
||||||
|
|
||||||
const auto same_name =
|
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||||
!util::guidance::requiresNameAnnounced(name_table.GetNameForID(in_data.name_id),
|
in_data.name_id, road_data.name_id, name_table, street_name_suffix_table);
|
||||||
name_table.GetRefForID(in_data.name_id),
|
|
||||||
name_table.GetNameForID(road_data.name_id),
|
|
||||||
name_table.GetRefForID(road_data.name_id),
|
|
||||||
street_name_suffix_table);
|
|
||||||
|
|
||||||
if (turn_is_perfectly_straight && in_data.name_id != EMPTY_NAMEID &&
|
if (turn_is_perfectly_straight && in_data.name_id != EMPTY_NAMEID &&
|
||||||
road_data.name_id != EMPTY_NAMEID && same_name)
|
road_data.name_id != EMPTY_NAMEID && same_name)
|
||||||
|
@ -85,5 +85,22 @@ std::string NameTable::GetRefForID(const unsigned name_id) const
|
|||||||
return GetNameForID(name_id + OFFSET_REF);
|
return GetNameForID(name_id + OFFSET_REF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string NameTable::GetPronunciationForID(const unsigned name_id) const
|
||||||
|
{
|
||||||
|
// Way string data is stored in blocks based on `name_id` as follows:
|
||||||
|
//
|
||||||
|
// | name | destination | pronunciation | ref |
|
||||||
|
// ^ ^
|
||||||
|
// [range)
|
||||||
|
// ^ name_id + 2
|
||||||
|
//
|
||||||
|
// `name_id + offset` gives us the range of chars.
|
||||||
|
//
|
||||||
|
// Offset 0 is name, 1 is destination, 2 is pronunciation, 3 is ref.
|
||||||
|
// See datafacades and extractor callbacks for details.
|
||||||
|
const constexpr auto OFFSET_PRONUNCIATION = 2u;
|
||||||
|
return GetNameForID(name_id + OFFSET_PRONUNCIATION);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
|
Loading…
Reference in New Issue
Block a user