diff options
author | Yuri Gorshenin <y@maps.me> | 2017-09-27 19:35:50 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2017-09-28 18:54:14 +0300 |
commit | 494d8e3a2d56e68af28fe2c5c5f5de01e94069d6 (patch) | |
tree | cd615b3541b4acbd1cddb4ba9392a764374fa273 /geometry | |
parent | e04d25505fb37abff651434ed4e29e7692af808f (diff) |
Review fixes.
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/bounding_box.cpp | 11 | ||||
-rw-r--r-- | geometry/bounding_box.hpp | 6 | ||||
-rw-r--r-- | geometry/calipers_box.cpp | 2 | ||||
-rw-r--r-- | geometry/calipers_box.hpp | 8 | ||||
-rw-r--r-- | geometry/diamond_box.cpp | 5 | ||||
-rw-r--r-- | geometry/diamond_box.hpp | 8 |
6 files changed, 8 insertions, 32 deletions
diff --git a/geometry/bounding_box.cpp b/geometry/bounding_box.cpp index d968239e2f..5a3c5dee69 100644 --- a/geometry/bounding_box.cpp +++ b/geometry/bounding_box.cpp @@ -1,7 +1,6 @@ #include "geometry/bounding_box.hpp" #include <algorithm> -#include <sstream> using namespace std; @@ -25,14 +24,4 @@ bool BoundingBox::HasPoint(double x, double y) const { return x >= m_min.x && x <= m_max.x && y >= m_min.y && y <= m_max.y; } - -string DebugPrint(BoundingBox const & bbox) -{ - ostringstream os; - os << "BoundingBox [ "; - os << "min: " << DebugPrint(bbox.Min()) << ", "; - os << "max: " << DebugPrint(bbox.Max()); - os << " ]"; - return os.str(); -} } // namespace m2 diff --git a/geometry/bounding_box.hpp b/geometry/bounding_box.hpp index 2e9209cfab..eaf48a85b6 100644 --- a/geometry/bounding_box.hpp +++ b/geometry/bounding_box.hpp @@ -5,7 +5,6 @@ #include "base/visitor.hpp" #include <limits> -#include <string> #include <vector> namespace m2 @@ -40,7 +39,8 @@ public: return m_min == rhs.m_min && m_max == rhs.m_max; } - DECLARE_VISITOR(visitor(m_min), visitor(m_max)) + DECLARE_VISITOR(visitor(m_min, "min"), visitor(m_max, "max")) + DECLARE_DEBUG_PRINT(BoundingBox) private: static_assert(std::numeric_limits<double>::has_infinity, ""); @@ -50,6 +50,4 @@ private: m2::PointD m_min = m2::PointD(kPositiveInfinity, kPositiveInfinity); m2::PointD m_max = m2::PointD(kNegativeInfinity, kNegativeInfinity); }; - -std::string DebugPrint(BoundingBox const & bbox); } // namespace m2 diff --git a/geometry/calipers_box.cpp b/geometry/calipers_box.cpp index a5ad7fe27b..ddbb42bc11 100644 --- a/geometry/calipers_box.cpp +++ b/geometry/calipers_box.cpp @@ -147,6 +147,4 @@ bool CalipersBox::HasPoint(PointD const & p) const } return true; } - -string DebugPrint(CalipersBox const & cbox) { return "CalipersBox " + ::DebugPrint(cbox.Points()); } } // namespace m2 diff --git a/geometry/calipers_box.hpp b/geometry/calipers_box.hpp index 6cf7299dc5..d66e354186 100644 --- a/geometry/calipers_box.hpp +++ b/geometry/calipers_box.hpp @@ -4,7 +4,6 @@ #include "base/visitor.hpp" -#include <string> #include <vector> namespace m2 @@ -19,7 +18,7 @@ class CalipersBox { public: CalipersBox() = default; - CalipersBox(std::vector<PointD> const & points); + explicit CalipersBox(std::vector<PointD> const & points); std::vector<PointD> const & Points() const { return m_points; } @@ -28,11 +27,10 @@ public: bool operator==(CalipersBox const & rhs) const { return m_points == rhs.m_points; } - DECLARE_VISITOR(visitor(m_points)) + DECLARE_VISITOR(visitor(m_points, "points")) + DECLARE_DEBUG_PRINT(CalipersBox) private: std::vector<PointD> m_points; }; - -std::string DebugPrint(CalipersBox const & cbox); } // namespace m2 diff --git a/geometry/diamond_box.cpp b/geometry/diamond_box.cpp index 07fc21e1a2..60e58fabe0 100644 --- a/geometry/diamond_box.cpp +++ b/geometry/diamond_box.cpp @@ -9,9 +9,4 @@ DiamondBox::DiamondBox(vector<PointD> const & points) for (auto const & p : points) Add(p); } - -string DebugPrint(DiamondBox const & dbox) -{ - return "DiamondBox [ " + ::DebugPrint(dbox.Points()) + " ]"; -} } // namespace m2 diff --git a/geometry/diamond_box.hpp b/geometry/diamond_box.hpp index 436eca4009..341249c591 100644 --- a/geometry/diamond_box.hpp +++ b/geometry/diamond_box.hpp @@ -5,7 +5,6 @@ #include "base/visitor.hpp" -#include <string> #include <vector> namespace m2 @@ -16,7 +15,7 @@ class DiamondBox { public: DiamondBox() = default; - DiamondBox(std::vector<PointD> const & points); + explicit DiamondBox(std::vector<PointD> const & points); void Add(PointD const & p) { return Add(p.x, p.y); } void Add(double x, double y) { return m_box.Add(x + y, x - y); } @@ -34,7 +33,8 @@ public: bool operator==(DiamondBox const & rhs) const { return m_box == rhs.m_box; } - DECLARE_VISITOR(visitor(m_box)) + DECLARE_VISITOR(visitor(Points(), "points")) + DECLARE_DEBUG_PRINT(DiamondBox) private: static m2::PointD ToOrig(m2::PointD const & p) @@ -44,6 +44,4 @@ private: BoundingBox m_box; }; - -std::string DebugPrint(DiamondBox const & dbox); } // namespace m2 |