forked from organicmaps/organicmaps
[search] High rank for Canada states.
This commit is contained in:
parent
51bf7b5d3e
commit
68ece84217
4 changed files with 22 additions and 4 deletions
|
@ -103,7 +103,10 @@ public:
|
|||
m2::RectD(-151.0, 63.0, -148.0, 66.0),
|
||||
// Hawaii
|
||||
m2::RectD(-179.3665041396082529, 17.740790096801504205,
|
||||
-153.92127500280855656, 31.043358939740215874)
|
||||
-153.92127500280855656, 31.043358939740215874),
|
||||
// Canada
|
||||
m2::RectD(-141.00315086636985029, 45.927730040557435132,
|
||||
-48.663019303849921471, 162.92387487639103938)
|
||||
};
|
||||
|
||||
bool isUSA = false;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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_")));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue