diff --git a/map/framework.cpp b/map/framework.cpp index 77bb83248b..c3885a3ad0 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1687,36 +1687,29 @@ bool Framework::ShowMapForURL(string const & url) return false; } -size_t Framework::ForEachFeatureAtPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const +void Framework::ForEachFeatureAtPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const { constexpr double kSelectRectWidthInMeters = 1.1; constexpr double kMetersToLinearFeature = 3; constexpr int kScale = scales::GetUpperScale(); m2::RectD const rect = MercatorBounds::RectByCenterXYAndSizeInMeters(mercator, kSelectRectWidthInMeters); - size_t processedFeaturesCount = 0; m_model.ForEachFeature(rect, [&](FeatureType & ft) { switch (ft.GetFeatureType()) { case feature::GEOM_POINT: if (rect.IsPointInside(ft.GetCenter())) - { fn(ft); - ++processedFeaturesCount; - } break; case feature::GEOM_LINE: if (feature::GetMinDistanceMeters(ft, mercator) < kMetersToLinearFeature) - { fn(ft); - ++processedFeaturesCount; - } break; case feature::GEOM_AREA: - if (ft.GetLimitRect(kScale).IsPointInside(mercator) && feature::GetMinDistanceMeters(ft, mercator) == 0.0) + if (ft.GetLimitRect(kScale).IsPointInside(mercator) && + feature::GetMinDistanceMeters(ft, mercator) == 0.0) { fn(ft); - ++processedFeaturesCount; } break; case feature::GEOM_UNDEFINED: @@ -1724,7 +1717,6 @@ size_t Framework::ForEachFeatureAtPoint(TFeatureTypeFn && fn, m2::PointD const & break; } }, kScale); - return processedFeaturesCount; } unique_ptr Framework::GetFeatureAtPoint(m2::PointD const & mercator) const diff --git a/map/framework.hpp b/map/framework.hpp index 51175d52ed..a9ee3e993d 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -494,7 +494,7 @@ public: /// @returns nullptr if no feature was found at the given mercator point. unique_ptr GetFeatureAtPoint(m2::PointD const & mercator) const; using TFeatureTypeFn = function; - size_t ForEachFeatureAtPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const; + void ForEachFeatureAtPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const; /// Set parse to false if you don't need all feature fields ready. unique_ptr GetFeatureByID(FeatureID const & fid, bool parse = true) const; diff --git a/map/map_tests/feature_getters_tests.cpp b/map/map_tests/feature_getters_tests.cpp index 9e4f9309d1..58b84a165d 100644 --- a/map/map_tests/feature_getters_tests.cpp +++ b/map/map_tests/feature_getters_tests.cpp @@ -25,7 +25,7 @@ UNIT_TEST(Framework_ForEachFeatureAtPoint_And_Others) "amenity|parking|", "barrier|lift_gate|" }; - TEST_EQUAL(4, frm.ForEachFeatureAtPoint([&](FeatureType & ft) + frm.ForEachFeatureAtPoint([&](FeatureType & ft) { ft.ForEachType([&types](uint32_t type) { @@ -34,7 +34,7 @@ UNIT_TEST(Framework_ForEachFeatureAtPoint_And_Others) TEST(found != types.end(), ()); types.erase(found); }); - }, MercatorBounds::FromLatLon(53.882663, 27.537788)), ()); + }, MercatorBounds::FromLatLon(53.882663, 27.537788)); TEST_EQUAL(0, types.size(), ()); ftypes::IsBuildingChecker const & isBuilding = ftypes::IsBuildingChecker::Instance(); diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 8c6c7e9772..e6641e7a11 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -494,7 +494,7 @@ void DrawWidget::ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt) menu.addAction(QString::fromUtf8(s.c_str())); }; - m_framework->ForEachFeatureAtPoint([&](FeatureType const & ft) + m_framework->ForEachFeatureAtPoint([&](FeatureType & ft) { search::AddressInfo const info = m_framework->GetFeatureAddressInfo(ft);