[search] Add flag to final search results. Close #510.
This commit is contained in:
parent
84c9f1da64
commit
1d9c07ab83
4 changed files with 19 additions and 13 deletions
|
@ -119,6 +119,9 @@ bool IntermediateResult::LessViewportDistance(IntermediateResult const & r1, Int
|
|||
|
||||
Result IntermediateResult::GenerateFinalResult(storage::CountryInfoGetter const * pInfo) const
|
||||
{
|
||||
storage::CountryInfo info;
|
||||
m_region.GetRegion(pInfo, info);
|
||||
|
||||
switch (m_resultType)
|
||||
{
|
||||
case RESULT_FEATURE:
|
||||
|
@ -126,10 +129,10 @@ Result IntermediateResult::GenerateFinalResult(storage::CountryInfoGetter const
|
|||
#ifdef DEBUG
|
||||
+ ' ' + strings::to_string(static_cast<int>(m_searchRank))
|
||||
#endif
|
||||
, m_region.GetRegion(pInfo), m_type, m_rect, m_distance, m_direction);
|
||||
, info.m_name, info.m_flag, m_type, m_rect, m_distance, m_direction);
|
||||
|
||||
case RESULT_LATLON:
|
||||
return Result(m_str, m_region.GetRegion(pInfo), 0, m_rect, m_distance, m_direction);
|
||||
return Result(m_str, info.m_name, info.m_flag, 0, m_rect, m_distance, m_direction);
|
||||
|
||||
default:
|
||||
ASSERT_EQUAL ( m_resultType, RESULT_CATEGORY, () );
|
||||
|
@ -259,16 +262,13 @@ string IntermediateResult::DebugPrint() const
|
|||
return res;
|
||||
}
|
||||
|
||||
string IntermediateResult::RegionInfo::GetRegion(storage::CountryInfoGetter const * pInfo) const
|
||||
void IntermediateResult::RegionInfo::GetRegion(
|
||||
storage::CountryInfoGetter const * pInfo, storage::CountryInfo & info) const
|
||||
{
|
||||
storage::CountryInfo info;
|
||||
|
||||
if (!m_file.empty())
|
||||
pInfo->GetRegionInfo(m_file, info);
|
||||
else if (m_valid)
|
||||
pInfo->GetRegionInfo(m_point, info);
|
||||
|
||||
return info.m_name;
|
||||
}
|
||||
|
||||
} // namespace search::impl
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
|
||||
class FeatureType;
|
||||
|
||||
namespace storage { class CountryInfoGetter; }
|
||||
namespace storage
|
||||
{
|
||||
class CountryInfoGetter;
|
||||
struct CountryInfo;
|
||||
}
|
||||
|
||||
namespace search
|
||||
{
|
||||
|
@ -99,7 +103,7 @@ private:
|
|||
m_valid = true;
|
||||
}
|
||||
|
||||
string GetRegion(storage::CountryInfoGetter const * pInfo) const;
|
||||
void GetRegion(storage::CountryInfoGetter const * pInfo, storage::CountryInfo & info) const;
|
||||
} m_region;
|
||||
|
||||
m2::RectD m_rect;
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
namespace search
|
||||
{
|
||||
|
||||
Result::Result(string const & str, string const & region,
|
||||
Result::Result(string const & str, string const & region, string const & flag,
|
||||
uint32_t featureType, m2::RectD const & featureRect,
|
||||
double distanceFromCenter, double directionFromCenter)
|
||||
: m_str(str), m_region(region), m_featureRect(featureRect), m_featureType(featureType),
|
||||
: m_str(str), m_region(region), m_flag(flag), m_featureRect(featureRect),
|
||||
m_featureType(featureType),
|
||||
m_distanceFromCenter(distanceFromCenter), m_directionFromCenter(directionFromCenter)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
RESULT_SUGGESTION
|
||||
};
|
||||
|
||||
Result(string const & str, string const & region,
|
||||
Result(string const & str, string const & region, string const & flag,
|
||||
uint32_t featureType, m2::RectD const & featureRect,
|
||||
double distanceFromCenter, double directionFromCenter);
|
||||
Result(string const & str, string const & suggestionStr);
|
||||
|
@ -24,6 +24,7 @@ public:
|
|||
// String that is displayed in the GUI.
|
||||
char const * GetString() const { return m_str.c_str(); }
|
||||
char const * GetRegionString() const { return m_region.c_str(); }
|
||||
char const * GetRegionFlag() const { return m_flag.c_str(); }
|
||||
|
||||
// Type of the result.
|
||||
ResultType GetResultType() const;
|
||||
|
@ -48,7 +49,7 @@ public:
|
|||
char const * GetSuggestionString() const;
|
||||
|
||||
private:
|
||||
string m_str, m_region;
|
||||
string m_str, m_region, m_flag;
|
||||
m2::RectD m_featureRect;
|
||||
uint32_t m_featureType;
|
||||
double m_distanceFromCenter;
|
||||
|
|
Reference in a new issue