diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-02-07 16:06:45 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:16:53 +0300 |
commit | 54fa2ac1c7fff965b1a504a265db719cc89aafff (patch) | |
tree | 8618f54228577a0cac1b04c0cd8e1652d5b01b56 | |
parent | b7b08920aa17ddb2514fc7dc83a794d7ef11a193 (diff) |
Join ForEachPoint and ForEachPointRef.
Join ForEachTriangle and ForEachTriangleRef.
-rw-r--r-- | drape_frontend/rule_drawer.cpp | 6 | ||||
-rw-r--r-- | drape_frontend/watch/feature_processor.cpp | 8 | ||||
-rw-r--r-- | drape_frontend/watch/feature_styler.cpp | 2 | ||||
-rw-r--r-- | indexer/feature.hpp | 26 | ||||
-rw-r--r-- | indexer/feature_algo.cpp | 4 | ||||
-rw-r--r-- | indexer/feature_covering.cpp | 4 | ||||
-rw-r--r-- | map/mwm_tests/mwm_foreach_test.cpp | 4 |
7 files changed, 21 insertions, 33 deletions
diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index 32f39ca139..e1bbd058d6 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -188,7 +188,7 @@ void RuleDrawer::operator()(FeatureType const & f) ApplyAreaFeature apply(insertShape, f.GetID(), areaMinHeight, areaHeight, minVisibleScale, f.GetRank(), s.GetCaptionDescription()); - f.ForEachTriangleRef(apply, zoomLevel); + f.ForEachTriangle(apply, zoomLevel); if (s.PointStyleExists()) apply(feature::GetCenter(f, zoomLevel)); @@ -205,7 +205,7 @@ void RuleDrawer::operator()(FeatureType const & f) s.GetCaptionDescription(), m_currentScaleGtoP, zoomLevel >= kLineSimplifyLevelStart && zoomLevel <= kLineSimplifyLevelEnd, f.GetPointsCount()); - f.ForEachPointRef(apply, zoomLevel); + f.ForEachPoint(apply, zoomLevel); if (CheckCancelled()) return; @@ -218,7 +218,7 @@ void RuleDrawer::operator()(FeatureType const & f) { ASSERT(s.PointStyleExists(), ()); ApplyPointFeature apply(insertShape, f.GetID(), minVisibleScale, f.GetRank(), s.GetCaptionDescription(), 0.0f /* posZ */); - f.ForEachPointRef(apply, zoomLevel); + f.ForEachPoint(apply, zoomLevel); if (CheckCancelled()) return; diff --git a/drape_frontend/watch/feature_processor.cpp b/drape_frontend/watch/feature_processor.cpp index 9ab64e5c26..d8dc700e74 100644 --- a/drape_frontend/watch/feature_processor.cpp +++ b/drape_frontend/watch/feature_processor.cpp @@ -74,7 +74,7 @@ bool FeatureProcessor::operator()(FeatureType const & f) p.m_rect = &m_rect; functor_t fun(p); - f.ForEachPointRef(fun, m_zoom); + f.ForEachPoint(fun, m_zoom); if (fun.IsExist()) { isExist = true; @@ -93,7 +93,7 @@ bool FeatureProcessor::operator()(FeatureType const & f) p.m_rect = &m_rect; functor_t fun(p); - f.ForEachTriangleExRef(fun, m_zoom); + f.ForEachTriangleEx(fun, m_zoom); if (data.m_styler.m_hasPointStyles) fun.SetCenter(feature::GetCenter(f, m_zoom)); @@ -123,7 +123,7 @@ bool FeatureProcessor::operator()(FeatureType const & f) functor_t fun(p); - f.ForEachPointRef(fun, m_zoom); + f.ForEachPoint(fun, m_zoom); if (fun.IsExist()) { isExist = true; @@ -150,7 +150,7 @@ bool FeatureProcessor::operator()(FeatureType const & f) functor_t fun(p); - f.ForEachPointRef(fun, m_zoom); + f.ForEachPoint(fun, m_zoom); if (fun.IsExist()) { diff --git a/drape_frontend/watch/feature_styler.cpp b/drape_frontend/watch/feature_styler.cpp index d7b4d64e57..3976e19ea3 100644 --- a/drape_frontend/watch/feature_styler.cpp +++ b/drape_frontend/watch/feature_styler.cpp @@ -241,7 +241,7 @@ FeatureStyler::FeatureStyler(FeatureType const & f, p.m_intervals = &m_intervals; functor_t fun(p); - f.ForEachPointRef(fun, zoom); + f.ForEachPoint(fun, zoom); LayoutTexts(fun.m_length); } diff --git a/indexer/feature.hpp b/indexer/feature.hpp index 4f835947fd..f6f7e84bbd 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -195,8 +195,8 @@ public: bool IsEmptyGeometry(int scale) const; - template <typename FunctorT> - void ForEachPointRef(FunctorT & f, int scale) const + template <typename TFunctor> + void ForEachPoint(TFunctor && f, int scale) const { ParseGeometry(scale); @@ -225,14 +225,8 @@ public: return m_points[i]; } - template <typename FunctorT> - void ForEachPoint(FunctorT f, int scale) const - { - ForEachPointRef(f, scale); - } - - template <typename FunctorT> - void ForEachTriangleRef(FunctorT & f, int scale) const + template <typename TFunctor> + void ForEachTriangle(TFunctor && f, int scale) const { ParseTriangles(scale); @@ -243,17 +237,11 @@ public: } } - template <typename FunctorT> - void ForEachTriangle(FunctorT f, int scale) const - { - ForEachTriangleRef(f, scale); - } - - template <typename FunctorT> - void ForEachTriangleExRef(FunctorT & f, int scale) const + template <typename TFunctor> + void ForEachTriangleEx(TFunctor && f, int scale) const { f.StartPrimitive(m_triangles.size()); - ForEachTriangleRef(f, scale); + ForEachTriangle(forward<TFunctor>(f), scale); f.EndPrimitive(); } //@} diff --git a/indexer/feature_algo.cpp b/indexer/feature_algo.cpp index 2c64a7ba81..30c822b2d0 100644 --- a/indexer/feature_algo.cpp +++ b/indexer/feature_algo.cpp @@ -113,7 +113,7 @@ m2::PointD GetCenter(FeatureType const & f, int scale) case GEOM_LINE: { CalculateLineCenter doCalc; - f.ForEachPointRef(doCalc, scale); + f.ForEachPoint(doCalc, scale); return doCalc.GetCenter(); } @@ -121,7 +121,7 @@ m2::PointD GetCenter(FeatureType const & f, int scale) { ASSERT_EQUAL(type, GEOM_AREA, ()); CalculatePointOnSurface doCalc(f.GetLimitRect(scale)); - f.ForEachTriangleRef(doCalc, scale); + f.ForEachTriangle(doCalc, scale); return doCalc.GetCenter(); } } diff --git a/indexer/feature_covering.cpp b/indexer/feature_covering.cpp index 4503e1de88..cac448f734 100644 --- a/indexer/feature_covering.cpp +++ b/indexer/feature_covering.cpp @@ -126,8 +126,8 @@ vector<int64_t> CoverFeature(FeatureType const & f, int cellDepth, uint64_t cell int const scale = FeatureType::BEST_GEOMETRY; FeatureIntersector fIsect; - f.ForEachPointRef(fIsect, scale); - f.ForEachTriangleRef(fIsect, scale); + f.ForEachPoint(fIsect, scale); + f.ForEachTriangle(fIsect, scale); CHECK(!(fIsect.m_trg.empty() && fIsect.m_polyline.empty()) && f.GetLimitRect(scale).IsValid(), (f.DebugString(scale))); diff --git a/map/mwm_tests/mwm_foreach_test.cpp b/map/mwm_tests/mwm_foreach_test.cpp index b7ea80ada2..27f558f69c 100644 --- a/map/mwm_tests/mwm_foreach_test.cpp +++ b/map/mwm_tests/mwm_foreach_test.cpp @@ -152,8 +152,8 @@ class AccumulatorEtalon : public AccumulatorBase switch (f.GetFeatureType()) { case GEOM_POINT: check.TestPoint(f.GetCenter()); break; - case GEOM_LINE: f.ForEachPointRef(check, m_scale); break; - case GEOM_AREA: f.ForEachTriangleRef(check, m_scale); break; + case GEOM_LINE: f.ForEachPoint(check, m_scale); break; + case GEOM_AREA: f.ForEachTriangle(check, m_scale); break; default: CHECK ( false, () ); } |