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>2012-12-19 01:43:55 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:48:07 +0300
commit79aba0667c1c5c4c4cd83be76d37a9328097ce35 (patch)
treec27043dfae638941f1c4ba74624d65cc7dcfe794 /storage
parente75cce943747338a0364b72477cfc639d3cf9caf (diff)
[search] Do address search in particular mwm when country (state) is matched.
Diffstat (limited to 'storage')
-rw-r--r--storage/country_decl.hpp1
-rw-r--r--storage/country_info.cpp14
-rw-r--r--storage/country_info.hpp1
3 files changed, 15 insertions, 1 deletions
diff --git a/storage/country_decl.hpp b/storage/country_decl.hpp
index 18316f6650..5759e26863 100644
--- a/storage/country_decl.hpp
+++ b/storage/country_decl.hpp
@@ -9,6 +9,7 @@ namespace storage
{
struct CountryDef
{
+ /// File name without extension (equal to english name - used in search for region).
string m_name;
m2::RectD m_rect;
diff --git a/storage/country_info.cpp b/storage/country_info.cpp
index e38f8e1771..c3f7e9dfb6 100644
--- a/storage/country_info.cpp
+++ b/storage/country_info.cpp
@@ -210,7 +210,8 @@ namespace storage
{
for (size_t i = 0; i < m_countries.size(); ++i)
{
- /// @todo Check for any matching now. Do it smarter in future.
+ /// Match english name with region file name (they are equal in almost all cases).
+ /// @todo Do it smarter in future.
string s = m_countries[i].m_name;
strings::AsciiToLower(s);
if (s.find(enName) != string::npos)
@@ -228,6 +229,17 @@ namespace storage
return false;
}
+ bool CountryInfoGetter::IsBelongToRegion(string const & fileName, IDSet const & regions) const
+ {
+ for (size_t i = 0; i < regions.size(); ++i)
+ {
+ if (m_countries[regions[i]].m_name == fileName)
+ return true;
+ }
+
+ return false;
+ }
+
namespace
{
class DoFreeCacheMemory
diff --git a/storage/country_info.hpp b/storage/country_info.hpp
index 0297fcfc1b..fc893af5a0 100644
--- a/storage/country_info.hpp
+++ b/storage/country_info.hpp
@@ -75,6 +75,7 @@ namespace storage
/// Search is case-insensitive.
void GetMatchedRegions(string const & enName, IDSet & regions) const;
bool IsBelongToRegion(m2::PointD const & pt, IDSet const & regions) const;
+ bool IsBelongToRegion(string const & fileName, IDSet const & regions) const;
//@}
/// m_cache is mutable.