forked from organicmaps/organicmaps
Review fixes.
This commit is contained in:
parent
77df74e5a2
commit
163ca44231
5 changed files with 40 additions and 40 deletions
|
@ -87,6 +87,7 @@ public:
|
|||
class IsVillageChecker : public BaseChecker
|
||||
{
|
||||
IsVillageChecker();
|
||||
|
||||
public:
|
||||
template <typename TFn>
|
||||
void ForEachType(TFn && fn) const
|
||||
|
|
|
@ -80,7 +80,8 @@ UNIT_TEST(SearchQueryV2_Smoke)
|
|||
auto const losAlamosCity =
|
||||
make_shared<TestCity>(m2::PointD(10, 10), "Los Alamos", "en", 100 /* rank */);
|
||||
auto const mskCity = make_shared<TestCity>(m2::PointD(0, 0), "Moscow", "en", 100 /* rank */);
|
||||
auto const longPondVillage = make_shared<TestCity>(m2::PointD(15, 15), "Long Pond Village", "en", 10 /* rank */);
|
||||
auto const longPondVillage =
|
||||
make_shared<TestVillage>(m2::PointD(15, 15), "Long Pond Village", "en", 10 /* rank */);
|
||||
|
||||
auto const feynmanStreet = make_shared<TestStreet>(
|
||||
vector<m2::PointD>{m2::PointD(9.999, 9.999), m2::PointD(10, 10), m2::PointD(10.001, 10.001)},
|
||||
|
@ -95,8 +96,7 @@ UNIT_TEST(SearchQueryV2_Smoke)
|
|||
vector<m2::PointD>{m2::PointD(10.002, 9.998), m2::PointD(10.003, 9.997)}, "Bohr street",
|
||||
"en");
|
||||
auto const firstAprilStreet = make_shared<TestStreet>(
|
||||
vector<m2::PointD>{m2::PointD(14.998, 15), m2::PointD(15.002, 15)}, "1st April street",
|
||||
"en");
|
||||
vector<m2::PointD>{m2::PointD(14.998, 15), m2::PointD(15.002, 15)}, "1st April street", "en");
|
||||
|
||||
auto const feynmanHouse = make_shared<TestBuilding>(m2::PointD(10, 10), "Feynman house",
|
||||
"1 unit 1", *feynmanStreet, "en");
|
||||
|
@ -108,7 +108,8 @@ UNIT_TEST(SearchQueryV2_Smoke)
|
|||
"Hilbert house", "1 unit 2", *bohrStreet1, "en");
|
||||
auto const descartesHouse =
|
||||
make_shared<TestBuilding>(m2::PointD(10, 10), "Descartes house", "2", "en");
|
||||
auto const bornHouse = make_shared<TestBuilding>(m2::PointD(14.999, 15), "Born house", "8", *firstAprilStreet, "en");
|
||||
auto const bornHouse =
|
||||
make_shared<TestBuilding>(m2::PointD(14.999, 15), "Born house", "8", *firstAprilStreet, "en");
|
||||
|
||||
auto const busStop = make_shared<TestPOI>(m2::PointD(0, 0), "Bus stop", "en");
|
||||
auto const tramStop = make_shared<TestPOI>(m2::PointD(0.0001, 0.0001), "Tram stop", "en");
|
||||
|
@ -152,7 +153,6 @@ UNIT_TEST(SearchQueryV2_Smoke)
|
|||
builder.Add(*wonderlandCountry);
|
||||
builder.Add(*losAlamosCity);
|
||||
builder.Add(*mskCity);
|
||||
builder.Add(*longPondVillage);
|
||||
}
|
||||
|
||||
auto const wonderlandResult = engine.RegisterMap(wonderland);
|
||||
|
@ -269,7 +269,8 @@ UNIT_TEST(SearchQueryV2_Smoke)
|
|||
}
|
||||
|
||||
{
|
||||
TestSearchRequest request(engine, "long pond 1st april street 8", "en", search::SearchParams::ALL, viewport);
|
||||
TestSearchRequest request(engine, "long pond 1st april street 8", "en",
|
||||
search::SearchParams::ALL, viewport);
|
||||
request.Wait();
|
||||
vector<shared_ptr<MatchingRule>> rules = {make_shared<ExactMatch>(wonderlandId, bornHouse)};
|
||||
TEST(MatchResults(engine, rules, request.Results()), ());
|
||||
|
|
|
@ -103,9 +103,10 @@ string TestCity::ToString() const
|
|||
return os.str();
|
||||
}
|
||||
|
||||
// TestVillage ----------------------------------------------------------------------------------------
|
||||
// TestVillage
|
||||
// ----------------------------------------------------------------------------------------
|
||||
TestVillage::TestVillage(m2::PointD const & center, string const & name, string const & lang,
|
||||
uint8_t rank)
|
||||
uint8_t rank)
|
||||
: TestFeature(center, name, lang), m_rank(rank)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -128,10 +128,7 @@ public:
|
|||
return binary_search(m_categories.cbegin(), m_categories.cend(), category);
|
||||
}
|
||||
|
||||
vector<strings::UniString> const & GetCategories() const
|
||||
{
|
||||
return m_categories;
|
||||
}
|
||||
vector<strings::UniString> const & GetCategories() const { return m_categories; }
|
||||
|
||||
private:
|
||||
StreetCategories()
|
||||
|
@ -517,7 +514,8 @@ void Geocoder::GoImpl(vector<shared_ptr<MwmInfo>> & infos, bool inViewport)
|
|||
if (viewportCBV)
|
||||
{
|
||||
for (size_t i = 0; i < m_numTokens; ++i)
|
||||
m_addressFeatures[i] = coding::CompressedBitVector::Intersect(*m_addressFeatures[i], *viewportCBV);
|
||||
m_addressFeatures[i] =
|
||||
coding::CompressedBitVector::Intersect(*m_addressFeatures[i], *viewportCBV);
|
||||
}
|
||||
|
||||
m_streets = LoadStreets(*m_context);
|
||||
|
@ -526,9 +524,9 @@ void Geocoder::GoImpl(vector<shared_ptr<MwmInfo>> & infos, bool inViewport)
|
|||
auto citiesFromWorld = m_cities;
|
||||
FillVillageLocalities();
|
||||
MY_SCOPE_GUARD(remove_villages, [&]()
|
||||
{
|
||||
m_cities = citiesFromWorld;
|
||||
});
|
||||
{
|
||||
m_cities = citiesFromWorld;
|
||||
});
|
||||
|
||||
m_usedTokens.assign(m_numTokens, false);
|
||||
MatchRegions(REGION_TYPE_COUNTRY);
|
||||
|
@ -581,7 +579,8 @@ void Geocoder::PrepareAddressFeatures()
|
|||
{
|
||||
PrepareRetrievalParams(i, i + 1);
|
||||
m_addressFeatures[i] = Retrieval::RetrieveAddressFeatures(
|
||||
m_context->m_id, m_context->m_value, static_cast<my::Cancellable const &>(*this), m_retrievalParams);
|
||||
m_context->m_id, m_context->m_value, static_cast<my::Cancellable const &>(*this),
|
||||
m_retrievalParams);
|
||||
ASSERT(m_addressFeatures[i], ());
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +692,7 @@ void Geocoder::FillLocalitiesTable()
|
|||
++numCities;
|
||||
City city = l;
|
||||
city.m_rect = MercatorBounds::RectByCenterXYAndSizeInMeters(
|
||||
ft.GetCenter(), ftypes::GetRadiusByPopulation(ft.GetPopulation()));
|
||||
feature::GetCenter(ft), ftypes::GetRadiusByPopulation(ft.GetPopulation()));
|
||||
|
||||
#if defined(DEBUG)
|
||||
string name;
|
||||
|
@ -767,29 +766,25 @@ void Geocoder::FillVillageLocalities()
|
|||
FeatureType ft;
|
||||
m_context->m_vector.GetByIndex(l.m_featureId, ft);
|
||||
|
||||
switch (m_model.GetSearchType(ft))
|
||||
{
|
||||
case SearchModel::SEARCH_TYPE_VILLAGE:
|
||||
{
|
||||
if (numVillages < kMaxNumVillages && ft.GetFeatureType() == feature::GEOM_POINT)
|
||||
{
|
||||
++numVillages;
|
||||
City village = l;
|
||||
village.m_rect = MercatorBounds::RectByCenterXYAndSizeInMeters(
|
||||
ft.GetCenter(), ftypes::GetRadiusByPopulation(ft.GetPopulation()));
|
||||
if (m_model.GetSearchType(ft) != SearchModel::SEARCH_TYPE_VILLAGE)
|
||||
continue;
|
||||
if (ft.GetFeatureType() != feature::GEOM_POINT)
|
||||
continue;
|
||||
if (numVillages >= kMaxNumVillages)
|
||||
continue;
|
||||
|
||||
++numVillages;
|
||||
City village = l;
|
||||
village.m_rect = MercatorBounds::RectByCenterXYAndSizeInMeters(
|
||||
feature::GetCenter(ft), ftypes::GetRadiusByPopulation(ft.GetPopulation()));
|
||||
|
||||
#if defined(DEBUG)
|
||||
string name;
|
||||
ft.GetName(StringUtf8Multilang::DEFAULT_CODE, name);
|
||||
LOG(LDEBUG, ("Village =", name));
|
||||
string name;
|
||||
ft.GetName(StringUtf8Multilang::DEFAULT_CODE, name);
|
||||
LOG(LDEBUG, ("Village =", name));
|
||||
#endif
|
||||
|
||||
m_cities[{l.m_startToken, l.m_endToken}].push_back(village);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
m_cities[{l.m_startToken, l.m_endToken}].push_back(village);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1199,7 +1194,8 @@ void Geocoder::FindPaths()
|
|||
unique_ptr<coding::CompressedBitVector> Geocoder::LoadCategories(
|
||||
MwmContext & context, vector<strings::UniString> const & categories)
|
||||
{
|
||||
ASSERT(context.m_handle.IsAlive() && HasSearchIndex(context.m_value), ());
|
||||
ASSERT(context.m_handle.IsAlive(), ());
|
||||
ASSERT(HasSearchIndex(context.m_value), ());
|
||||
|
||||
m_retrievalParams.m_tokens.resize(1);
|
||||
m_retrievalParams.m_tokens[0].resize(1);
|
||||
|
@ -1211,7 +1207,8 @@ unique_ptr<coding::CompressedBitVector> Geocoder::LoadCategories(
|
|||
{
|
||||
m_retrievalParams.m_tokens[0][0] = category;
|
||||
auto cbv = Retrieval::RetrieveAddressFeatures(
|
||||
context.m_id, context.m_value, static_cast<my::Cancellable const &>(*this), m_retrievalParams);
|
||||
context.m_id, context.m_value, static_cast<my::Cancellable const &>(*this),
|
||||
m_retrievalParams);
|
||||
if (!coding::CompressedBitVector::IsEmpty(cbv))
|
||||
cbvs.push_back(move(cbv));
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
SEARCH_TYPE_STREET,
|
||||
SEARCH_TYPE_VILLAGE,
|
||||
SEARCH_TYPE_CITY,
|
||||
SEARCH_TYPE_STATE, // US or Canadian states
|
||||
SEARCH_TYPE_STATE, // US or Canadian states
|
||||
SEARCH_TYPE_COUNTRY,
|
||||
SEARCH_TYPE_COUNT
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue