Expose pronunciation in RouteStep

Uses name:pronunciation by default for cars.
This commit is contained in:
Patrick Niklaus
2016-05-26 03:35:38 +02:00
parent 9cdc9008aa
commit 0a53775fb3
17 changed files with 76 additions and 9 deletions
+2
View File
@@ -196,6 +196,8 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
route_step.values["distance"] = std::round(step.distance * 10) / 10.;
route_step.values["duration"] = std::round(step.duration * 10) / 10.;
route_step.values["name"] = std::move(step.name);
if (!step.pronunciation.empty())
route_step.values["pronunciation"] = std::move(step.pronunciation);
if (!step.rotary_name.empty())
route_step.values["rotary_name"] = std::move(step.rotary_name);
+9 -3
View File
@@ -146,9 +146,9 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
const constexpr auto MAX_STRING_LENGTH = 255u;
// Get the unique identifier for the street name
const auto string_map_iterator = string_map.find(parsed_way.name);
const auto name_iterator = string_map.find(parsed_way.name);
unsigned name_id = external_memory.name_lengths.size();
if (string_map.end() == string_map_iterator)
if (string_map.end() == name_iterator)
{
auto name_length = std::min<unsigned>(MAX_STRING_LENGTH, parsed_way.name.size());
@@ -158,11 +158,17 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
std::back_inserter(external_memory.name_char_data));
external_memory.name_lengths.push_back(name_length);
auto pronunciation_length = std::min<unsigned>(255u, parsed_way.pronunciation.size());
std::copy(parsed_way.pronunciation.c_str(), parsed_way.pronunciation.c_str() + pronunciation_length,
std::back_inserter(external_memory.name_char_data));
external_memory.name_lengths.push_back(pronunciation_length);
string_map.insert(std::make_pair(parsed_way.name, name_id));
}
else
{
name_id = string_map_iterator->second;
name_id = name_iterator->second;
}
const bool split_edge = (parsed_way.forward_speed > 0) &&
+1
View File
@@ -135,6 +135,7 @@ void ScriptingEnvironment::InitContext(ScriptingEnvironment::Context &context)
.def_readwrite("forward_speed", &ExtractionWay::forward_speed)
.def_readwrite("backward_speed", &ExtractionWay::backward_speed)
.def_readwrite("name", &ExtractionWay::name)
.def_readwrite("pronunciation", &ExtractionWay::pronunciation)
.def_readwrite("roundabout", &ExtractionWay::roundabout)
.def_readwrite("is_access_restricted", &ExtractionWay::is_access_restricted)
.def_readwrite("is_startpoint", &ExtractionWay::is_startpoint)