Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2014-05-15 15:28:40 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:15:32 +0300
commit4ae69054f4c4035b30cd85f7085cfa0277241ab3 (patch)
treeac339d1ebda8b9dbc92aef1186640ab6b75e443d /search/result.cpp
parent80498aa751ffdb6a1c85c36a95e77f552ebf6aac (diff)
[search] Implement suggestions for countries, cities, streets.
Diffstat (limited to 'search/result.cpp')
-rw-r--r--search/result.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/search/result.cpp b/search/result.cpp
index d1b3249185..cf9e9d38f1 100644
--- a/search/result.cpp
+++ b/search/result.cpp
@@ -28,8 +28,8 @@ Result::Result(m2::PointD const & fCenter,
{
}
-Result::Result(string const & str, string const & suggestionStr)
- : m_str(str), m_suggestionStr(suggestionStr)
+Result::Result(string const & str, string const & suggest)
+ : m_str(str), m_suggestionStr(suggest)
{
}
@@ -70,23 +70,33 @@ char const * Result::GetSuggestionString() const
bool Result::operator== (Result const & r) const
{
ResultType const type = GetResultType();
- if (type == r.GetResultType() && type != RESULT_SUGGESTION)
+ if (type == r.GetResultType())
{
- // This function is used to filter duplicate results in cases:
- // - emitted Wrold.mwm and Country.mwm
- // - after additional search in all mwm
- // so it's suitable here to test for 500m
- return (m_str == r.m_str && m_region == r.m_region &&
- m_featureType == r.m_featureType &&
- PointDistance(m_center, r.m_center) < 500.0);
+ if (type == RESULT_SUGGESTION)
+ return m_suggestionStr == r.m_suggestionStr;
+ else
+ {
+ // This function is used to filter duplicate results in cases:
+ // - emitted World.mwm and Country.mwm
+ // - after additional search in all mwm
+ // so it's suitable here to test for 500m
+ return (m_str == r.m_str && m_region == r.m_region &&
+ m_featureType == r.m_featureType &&
+ PointDistance(m_center, r.m_center) < 500.0);
+ }
}
return false;
}
-void Results::AddResultCheckExisting(Result const & r)
+bool Results::AddResultCheckExistingEx(Result const & r)
{
if (find(m_vec.begin(), m_vec.end(), r) == m_vec.end())
+ {
AddResult(r);
+ return true;
+ }
+ else
+ return false;
}
////////////////////////////////////////////////////////////////////////////////////