diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-05-30 18:32:01 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:39:16 +0300 |
commit | 79339afac9b7d24ef9cf450829528d1e7e6de251 (patch) | |
tree | 206590f0b956e5b225949751a82d979bcf8e3a89 /geometry | |
parent | 3f5fa6b6cb1500af7be154fa51dda0d8829cb59d (diff) |
added logging to m4::Tree
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/tree4d.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/geometry/tree4d.hpp b/geometry/tree4d.hpp index 8e9c66de15..6df5ae9589 100644 --- a/geometry/tree4d.hpp +++ b/geometry/tree4d.hpp @@ -4,7 +4,9 @@ #include "point2d.hpp" #include "../base/stl_add.hpp" +#include "../base/logging.hpp" +#include "../std/sstream.hpp" #include "../std/kdtree.hpp" namespace m4 @@ -47,6 +49,19 @@ namespace m4 return (m_val == r.m_val); } + string DebugPrint() const + { + ostringstream out; + + out << m_val.get() << ", (" + << m_pts[0] << ", " + << m_pts[1] << ", " + << m_pts[2] << ", " + << m_pts[3] << ")"; + + return out.str(); + } + double operator[](size_t i) const { return m_pts[i]; } m2::RectD GetRect() const { return m2::RectD(m_pts[0], m_pts[1], m_pts[2], m_pts[3]); } @@ -193,5 +208,21 @@ namespace m4 size_t GetSize() const { return m_tree.size(); } void Clear() { m_tree.clear(); } + + string DebugPrint() const + { + ostringstream out; + for (typename tree_t::const_iterator it = m_tree.begin(); + it != m_tree.end(); + ++it) + out << it->DebugPrint() << ", "; + return out.str(); + } }; + + template <typename T, typename Traits> + string DebugPrint(Tree<T, Traits> const & t) + { + return t.DebugPrint(); + } } |