mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[iOS][core] Add branch to search result list
Signed-off-by: eisa01 <eisa01@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
c9214d3130
commit
c039d599e4
@@ -732,6 +732,16 @@ Result Ranker::MakeResult(RankerResult const & rankerResult, bool needAddress, b
|
||||
case RankerResult::Type::Building:
|
||||
res.FromFeature(rankerResult.GetID(), rankerResult.GetBestType(),
|
||||
rankerResult.GetBestType(&m_params.m_preferredTypes), rankerResult.m_details);
|
||||
|
||||
// Extract branch metadata if available
|
||||
if (rankerResult.GetID().IsValid())
|
||||
{
|
||||
m_dataSource.ReadFeature([&](FeatureType & ft) {
|
||||
auto const branch = ft.GetMetadata(feature::Metadata::FMD_BRANCH);
|
||||
if (!branch.empty())
|
||||
res.SetBranch(std::string(branch));
|
||||
}, rankerResult.GetID());
|
||||
}
|
||||
break;
|
||||
case RankerResult::Type::LatLon: res.SetType(Result::Type::LatLon); break;
|
||||
case RankerResult::Type::Postcode: res.SetType(Result::Type::Postcode); break;
|
||||
|
||||
@@ -134,6 +134,11 @@ string const & Result::GetSuggestionString() const
|
||||
return m_suggestionStr;
|
||||
}
|
||||
|
||||
string Result::GetBranch() const
|
||||
{
|
||||
return m_branch;
|
||||
}
|
||||
|
||||
bool Result::IsEqualSuggest(Result const & r) const
|
||||
{
|
||||
return m_suggestionStr == r.m_suggestionStr;
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
void FromFeature(FeatureID const & id, uint32_t mainType, uint32_t matchedType, Details const & details);
|
||||
|
||||
void SetAddress(std::string && address) { m_address = std::move(address); }
|
||||
void SetBranch(std::string && branch) { m_branch = std::move(branch); }
|
||||
void SetType(Result::Type type) { m_resultType = type; }
|
||||
|
||||
// For Type::PureSuggest.
|
||||
@@ -75,6 +76,7 @@ public:
|
||||
std::string const & GetString() const { return m_str; }
|
||||
std::string const & GetAddress() const { return m_address; }
|
||||
std::string const & GetDescription() const { return m_details.m_description; }
|
||||
std::string GetBranch() const;
|
||||
|
||||
osm::YesNoUnknown IsOpenNow() const { return m_details.m_isOpenNow; }
|
||||
uint16_t GetMinutesUntilOpen() const { return m_details.m_minutesUntilOpen; }
|
||||
@@ -152,6 +154,7 @@ private:
|
||||
m2::PointD m_center;
|
||||
std::string m_str;
|
||||
std::string m_address;
|
||||
std::string m_branch;
|
||||
uint32_t m_mainType = 0;
|
||||
uint32_t m_matchedType = 0;
|
||||
std::string m_suggestionStr;
|
||||
|
||||
Reference in New Issue
Block a user