Implements Exit Numbers + Names (junction:ref way tag for now)
This commit is contained in:
committed by
Patrick Niklaus
parent
6d78c11fd2
commit
7d900e3b5a
@@ -46,7 +46,8 @@ inline void print(const engine::guidance::RouteStep &step)
|
||||
std::cout << ")";
|
||||
}
|
||||
std::cout << "] name[" << step.name_id << "]: " << step.name << " Ref: " << step.ref
|
||||
<< " Pronunciation: " << step.pronunciation << "Destination: " << step.destinations;
|
||||
<< " Pronunciation: " << step.pronunciation << "Destination: " << step.destinations
|
||||
<< "Exits: " << step.exits;
|
||||
}
|
||||
|
||||
inline void print(const std::vector<engine::guidance::RouteStep> &steps)
|
||||
|
||||
@@ -44,9 +44,11 @@ template <typename SuffixTable>
|
||||
inline bool requiresNameAnnounced(const std::string &from_name,
|
||||
const std::string &from_ref,
|
||||
const std::string &from_pronunciation,
|
||||
const std::string &from_exits,
|
||||
const std::string &to_name,
|
||||
const std::string &to_ref,
|
||||
const std::string &to_pronunciation,
|
||||
const std::string &to_exits,
|
||||
const SuffixTable &suffix_table)
|
||||
{
|
||||
// first is empty and the second is not
|
||||
@@ -128,17 +130,20 @@ inline bool requiresNameAnnounced(const std::string &from_name,
|
||||
(!from_name.empty() && from_ref.empty() && to_name.empty() && !to_ref.empty());
|
||||
|
||||
const auto pronunciation_changes = from_pronunciation != to_pronunciation;
|
||||
const auto exits_change = from_exits != to_exits;
|
||||
|
||||
return !obvious_change || needs_announce || pronunciation_changes;
|
||||
return !obvious_change || needs_announce || pronunciation_changes || exits_change;
|
||||
}
|
||||
|
||||
// Overload without suffix checking
|
||||
inline bool requiresNameAnnounced(const std::string &from_name,
|
||||
const std::string &from_ref,
|
||||
const std::string &from_pronunciation,
|
||||
const std::string &from_exits,
|
||||
const std::string &to_name,
|
||||
const std::string &to_ref,
|
||||
const std::string &to_pronunciation)
|
||||
const std::string &to_pronunciation,
|
||||
const std::string &to_exits)
|
||||
{
|
||||
// Dummy since we need to provide a SuffixTable but do not have the data for it.
|
||||
// (Guidance Post-Processing does not keep the suffix table around at the moment)
|
||||
@@ -148,8 +153,15 @@ inline bool requiresNameAnnounced(const std::string &from_name,
|
||||
bool isSuffix(const std::string &) const { return false; }
|
||||
} static const table;
|
||||
|
||||
return requiresNameAnnounced(
|
||||
from_name, from_ref, from_pronunciation, to_name, to_ref, to_pronunciation, table);
|
||||
return requiresNameAnnounced(from_name,
|
||||
from_ref,
|
||||
from_pronunciation,
|
||||
from_exits,
|
||||
to_name,
|
||||
to_ref,
|
||||
to_pronunciation,
|
||||
to_exits,
|
||||
table);
|
||||
}
|
||||
|
||||
inline bool requiresNameAnnounced(const NameID from_name_id,
|
||||
@@ -163,9 +175,13 @@ inline bool requiresNameAnnounced(const NameID from_name_id,
|
||||
return requiresNameAnnounced(name_table.GetNameForID(from_name_id).to_string(),
|
||||
name_table.GetRefForID(from_name_id).to_string(),
|
||||
name_table.GetPronunciationForID(from_name_id).to_string(),
|
||||
name_table.GetExitsForID(from_name_id).to_string(),
|
||||
//
|
||||
name_table.GetNameForID(to_name_id).to_string(),
|
||||
name_table.GetRefForID(to_name_id).to_string(),
|
||||
name_table.GetPronunciationForID(to_name_id).to_string(),
|
||||
name_table.GetExitsForID(to_name_id).to_string(),
|
||||
//
|
||||
suffix_table);
|
||||
// FIXME: converts StringViews to strings since the name change heuristics mutates in place
|
||||
}
|
||||
@@ -180,8 +196,11 @@ inline bool requiresNameAnnounced(const NameID from_name_id,
|
||||
return requiresNameAnnounced(name_table.GetNameForID(from_name_id).to_string(),
|
||||
name_table.GetRefForID(from_name_id).to_string(),
|
||||
name_table.GetPronunciationForID(from_name_id).to_string(),
|
||||
name_table.GetExitsForID(from_name_id).to_string(),
|
||||
//
|
||||
name_table.GetNameForID(to_name_id).to_string(),
|
||||
name_table.GetRefForID(to_name_id).to_string(),
|
||||
name_table.GetExitsForID(to_name_id).to_string(),
|
||||
name_table.GetPronunciationForID(to_name_id).to_string());
|
||||
// FIXME: converts StringViews to strings since the name change heuristics mutates in place
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ class NameTable
|
||||
// This class provides a limited view over all the string data we serialize out.
|
||||
// The following functions are a subset of what is available.
|
||||
// See the data facades for they provide full access to this serialized string data.
|
||||
// (at time of writing this: get{Name,Ref,Pronunciation,Destinations}ForID(name_id);)
|
||||
util::StringView GetNameForID(const NameID id) const;
|
||||
util::StringView GetDestinationsForID(const NameID id) const;
|
||||
util::StringView GetExitsForID(const NameID id) const;
|
||||
util::StringView GetRefForID(const NameID id) const;
|
||||
util::StringView GetPronunciationForID(const NameID id) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user