diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2018-07-09 11:11:05 +0300 |
---|---|---|
committer | Maksim Andrianov <maksimandrianov1@gmail.com> | 2018-07-09 14:02:48 +0300 |
commit | c49409b14554a3e9f34642274105d6c3cc9ce2b4 (patch) | |
tree | 0b11430740edd67e2c2b60c8b0a36d30b76316e9 /search | |
parent | 2e96ce5efa5bc60347c2d430bf7c1893c32b094d (diff) |
[generator] Set mwm bounds rect to rect around region borders, not features which cross region border.
Diffstat (limited to 'search')
-rw-r--r-- | search/geocoder.cpp | 14 | ||||
-rw-r--r-- | search/locality_finder.cpp | 8 | ||||
-rw-r--r-- | search/nested_rects_cache.cpp | 2 | ||||
-rw-r--r-- | search/search_tests/locality_finder_test.cpp | 2 | ||||
-rw-r--r-- | search/search_tests_support/helpers.cpp | 2 |
5 files changed, 11 insertions, 17 deletions
diff --git a/search/geocoder.cpp b/search/geocoder.cpp index b1d0a7cf91..913c2e7a73 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -284,7 +284,7 @@ struct KeyedMwmInfo { KeyedMwmInfo(shared_ptr<MwmInfo> const & info, m2::RectD const & pivot) : m_info(info) { - auto const & rect = m_info->m_limitRect; + auto const & rect = m_info->m_bordersRect; m_similarity = GetSimilarity(pivot, rect); m_distance = GetDistanceMeters(pivot.Center(), rect); } @@ -325,9 +325,8 @@ size_t OrderCountries(m2::RectD const & pivot, vector<shared_ptr<MwmInfo>> & inf for (auto const & info : keyedInfos) infos.emplace_back(info.m_info); - auto intersects = [&](shared_ptr<MwmInfo> const & info) -> bool - { - return pivot.IsIntersect(info->m_limitRect); + auto intersects = [&](shared_ptr<MwmInfo> const & info) -> bool { + return pivot.IsIntersect(info->m_bordersRect); }; auto const sep = stable_partition(infos.begin(), infos.end(), intersects); @@ -427,10 +426,9 @@ void Geocoder::GoInViewport() vector<shared_ptr<MwmInfo>> infos; m_dataSource.GetMwmsInfo(infos); - my::EraseIf(infos, [this](shared_ptr<MwmInfo> const & info) - { - return !m_params.m_pivot.IsIntersect(info->m_limitRect); - }); + my::EraseIf(infos, [this](shared_ptr<MwmInfo> const & info) { + return !m_params.m_pivot.IsIntersect(info->m_bordersRect); + }); GoImpl(infos, true /* inViewport */); } diff --git a/search/locality_finder.cpp b/search/locality_finder.cpp index 9da35b437b..8f9f0d932f 100644 --- a/search/locality_finder.cpp +++ b/search/locality_finder.cpp @@ -286,12 +286,8 @@ void LocalityFinder::UpdateMaps() switch (info->GetType()) { - case MwmInfo::WORLD: - m_worldId = id; - break; - case MwmInfo::COUNTRY: - m_maps.Add(id, info->m_limitRect); - break; + case MwmInfo::WORLD: m_worldId = id; break; + case MwmInfo::COUNTRY: m_maps.Add(id, info->m_bordersRect); break; case MwmInfo::COASTS: break; } } diff --git a/search/nested_rects_cache.cpp b/search/nested_rects_cache.cpp index 5ac54d9a21..6e5b87fe5a 100644 --- a/search/nested_rects_cache.cpp +++ b/search/nested_rects_cache.cpp @@ -56,7 +56,7 @@ double NestedRectsCache::GetDistanceToFeatureMeters(FeatureID const & id) const if (auto const & info = id.m_mwmId.GetInfo()) { - auto const & rect = info->m_limitRect; + auto const & rect = info->m_bordersRect; return max(MercatorBounds::DistanceOnEarth(rect.Center(), m_position), GetRadiusMeters(static_cast<RectScale>(scale))); } diff --git a/search/search_tests/locality_finder_test.cpp b/search/search_tests/locality_finder_test.cpp index 1d2383da4e..4b805918a8 100644 --- a/search/search_tests/locality_finder_test.cpp +++ b/search/search_tests/locality_finder_test.cpp @@ -47,7 +47,7 @@ public: MwmSet::MwmId const & id = p.first; TEST(id.IsAlive(), ()); - m_worldRect = id.GetInfo()->m_limitRect; + m_worldRect = id.GetInfo()->m_bordersRect; m_boundariesTable.Load(); } catch (RootException const & ex) diff --git a/search/search_tests_support/helpers.cpp b/search/search_tests_support/helpers.cpp index 3816f3650e..ed34586d5c 100644 --- a/search/search_tests_support/helpers.cpp +++ b/search/search_tests_support/helpers.cpp @@ -93,7 +93,7 @@ void SearchTest::OnMwmBuilt(MwmInfo const & info) { switch (info.GetType()) { - case MwmInfo::COUNTRY: RegisterCountry(info.GetCountryName(), info.m_limitRect); break; + case MwmInfo::COUNTRY: RegisterCountry(info.GetCountryName(), info.m_bordersRect); break; case MwmInfo::WORLD: m_engine.LoadCitiesBoundaries(); break; case MwmInfo::COASTS: break; } |