diff options
author | vng <viktor.govako@gmail.com> | 2010-12-29 02:28:10 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:08:51 +0300 |
commit | e82bdfd361c80bcee7997681b5bce7b100b82ab7 (patch) | |
tree | 240c364f25130f613193664a9181d857bb4fe51c /geometry/tree4d.hpp | |
parent | 01e8135397f30bf9107228bd4006c8e0ec10d76b (diff) |
Filter texts by rect.
Diffstat (limited to 'geometry/tree4d.hpp')
-rw-r--r-- | geometry/tree4d.hpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/geometry/tree4d.hpp b/geometry/tree4d.hpp index 7e22ed290f..c03dbb61ad 100644 --- a/geometry/tree4d.hpp +++ b/geometry/tree4d.hpp @@ -10,7 +10,7 @@ namespace m4 { - template <class T, class TTraits> + template <class T> class Tree { struct value_t @@ -44,10 +44,8 @@ namespace m4 public: template <class TCompare> - void ReplaceIf(T const & obj, TCompare comp) + void ReplaceIf(T const & obj, m2::RectD const & rect, TCompare comp) { - m2::RectD const rect = TTraits::GetLimitRect(obj); - region_t rgn; for (size_t i = 0; i < 4; ++i) { @@ -96,11 +94,19 @@ namespace m4 m_tree.insert(value_t(obj, rect)); } + template <class TCompare> + void ReplaceIf(T const & obj, TCompare comp) + { + ReplaceIf(obj, obj.GetLimitRect(), comp); + } + template <class ToDo> void ForEach(ToDo toDo) const { for (tree_t::const_iterator i = m_tree.begin(); i != m_tree.end(); ++i) toDo((*i).m_val); } + + void Clear() { m_tree.clear(); } }; } |