Expose pronunciation in RouteStep
Uses name:pronunciation by default for cars.
This commit is contained in:
@@ -145,6 +145,8 @@ class BaseDataFacade
|
||||
|
||||
virtual std::string GetNameForID(const unsigned name_id) const = 0;
|
||||
|
||||
virtual std::string GetPronunciationForID(const unsigned name_id) const = 0;
|
||||
|
||||
virtual std::size_t GetCoreSize() const = 0;
|
||||
|
||||
virtual std::string GetTimestamp() const = 0;
|
||||
|
||||
@@ -591,6 +591,14 @@ class InternalDataFacade final : public BaseDataFacade
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string GetPronunciationForID(const unsigned name_id) const override final
|
||||
{
|
||||
// We store the pronounciation directly after the name of a street.
|
||||
// We do this to get around the street length limit of 255 which would hit
|
||||
// if we concatenate these.
|
||||
return GetNameForID(name_id + 1);
|
||||
}
|
||||
|
||||
virtual unsigned GetGeometryIndexForEdgeID(const unsigned id) const override final
|
||||
{
|
||||
return m_via_node_list.at(id);
|
||||
|
||||
@@ -660,6 +660,11 @@ class SharedDataFacade final : public BaseDataFacade
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string GetPronunciationForID(const unsigned name_id) const override final
|
||||
{
|
||||
return GetNameForID(name_id + 1);
|
||||
}
|
||||
|
||||
bool IsCoreNode(const NodeID id) const override final
|
||||
{
|
||||
if (m_is_core_node.size() > 0)
|
||||
|
||||
@@ -98,10 +98,12 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
|
||||
{
|
||||
BOOST_ASSERT(segment_duration >= 0);
|
||||
const auto name = facade.GetNameForID(step_name_id);
|
||||
const auto pronunciation = facade.GetPronunciationForID(step_name_id);
|
||||
const auto distance = leg_geometry.segment_distances[segment_index];
|
||||
|
||||
steps.push_back(RouteStep{step_name_id,
|
||||
name,
|
||||
std::move(name),
|
||||
std::move(pronunciation),
|
||||
NO_ROTARY_NAME,
|
||||
segment_duration / 10.0,
|
||||
distance,
|
||||
@@ -152,6 +154,7 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
|
||||
BOOST_ASSERT(duration >= 0);
|
||||
steps.push_back(RouteStep{step_name_id,
|
||||
facade.GetNameForID(step_name_id),
|
||||
facade.GetPronunciationForID(step_name_id),
|
||||
NO_ROTARY_NAME,
|
||||
duration / 10.,
|
||||
distance,
|
||||
@@ -175,6 +178,7 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
|
||||
|
||||
steps.push_back(RouteStep{source_node.name_id,
|
||||
facade.GetNameForID(source_node.name_id),
|
||||
facade.GetPronunciationForID(source_node.name_id),
|
||||
NO_ROTARY_NAME,
|
||||
duration / 10.,
|
||||
leg_geometry.segment_distances[segment_index],
|
||||
@@ -204,6 +208,7 @@ std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
|
||||
BOOST_ASSERT(!leg_geometry.locations.empty());
|
||||
steps.push_back(RouteStep{target_node.name_id,
|
||||
facade.GetNameForID(target_node.name_id),
|
||||
facade.GetPronunciationForID(target_node.name_id),
|
||||
NO_ROTARY_NAME,
|
||||
ZERO_DURATION,
|
||||
ZERO_DISTANCE,
|
||||
|
||||
@@ -49,6 +49,7 @@ struct RouteStep
|
||||
{
|
||||
unsigned name_id;
|
||||
std::string name;
|
||||
std::string pronunciation;
|
||||
std::string rotary_name;
|
||||
double duration;
|
||||
double distance;
|
||||
@@ -63,6 +64,7 @@ struct RouteStep
|
||||
inline RouteStep getInvalidRouteStep()
|
||||
{
|
||||
return {0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user