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-02-03 15:31:32 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:33:01 +0300
commit68ece84217fa2b94c28b13ea02186fdd15e9f4d5 (patch)
treec0cd1d35cde44727fbb862c7ef6edacad4f6d080 /storage
parent51bf7b5d3ef10029f4947cdd918f9d1535fa0d31 (diff)
[search] High rank for Canada states.
Diffstat (limited to 'storage')
-rw-r--r--storage/country_info.cpp13
-rw-r--r--storage/country_info.hpp2
-rw-r--r--storage/storage_tests/country_info_test.cpp6
3 files changed, 18 insertions, 3 deletions
diff --git a/storage/country_info.cpp b/storage/country_info.cpp
index e55fc3ff12..74074f6b37 100644
--- a/storage/country_info.cpp
+++ b/storage/country_info.cpp
@@ -123,7 +123,7 @@ namespace storage
{
for (size_t i = 0; i < m_countries.size(); ++i)
{
- if (m_countries[i].m_name.find("USA_") != string::npos)
+ if (m_countries[i].m_name.find("USA_") == 0)
{
if (m_countries[i].m_name == "USA_Alaska")
rects[1] = m_countries[i].m_rect;
@@ -134,4 +134,15 @@ namespace storage
}
}
}
+
+ m2::RectD CountryInfoGetter::CalcLimitRect(string const & prefix) const
+ {
+ m2::RectD r;
+ for (size_t i = 0; i < m_countries.size(); ++i)
+ {
+ if (m_countries[i].m_name.find(prefix) == 0)
+ r.Add(m_countries[i].m_rect);
+ }
+ return r;
+ }
}
diff --git a/storage/country_info.hpp b/storage/country_info.hpp
index 1231c43f70..119037aa72 100644
--- a/storage/country_info.hpp
+++ b/storage/country_info.hpp
@@ -51,5 +51,7 @@ namespace storage
/// 1 - Alaska;\n
/// 2 - Hawaii;\n
void CalcUSALimitRect(m2::RectD rects[3]) const;
+
+ m2::RectD CalcLimitRect(string const & prefix) const;
};
}
diff --git a/storage/storage_tests/country_info_test.cpp b/storage/storage_tests/country_info_test.cpp
index c418bca091..e6c17fcc0f 100644
--- a/storage/storage_tests/country_info_test.cpp
+++ b/storage/storage_tests/country_info_test.cpp
@@ -62,14 +62,16 @@ UNIT_TEST(CountryInfo_ValidName_Smoke)
TEST(IsEmptyName(id2info, "UK_Northern Ireland"), ());
}
-UNIT_TEST(CountryInfo_USARect)
+UNIT_TEST(CountryInfo_SomeRects)
{
scoped_ptr<CountryInfoT> getter(GetCountryInfo());
m2::RectD rects[3];
getter->CalcUSALimitRect(rects);
- LOG(LINFO, ("Continental: ", rects[0]));
+ LOG(LINFO, ("USA Continental: ", rects[0]));
LOG(LINFO, ("Alaska: ", rects[1]));
LOG(LINFO, ("Hawaii: ", rects[2]));
+
+ LOG(LINFO, ("Canada: ", getter->CalcLimitRect("Canada_")));
}