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 /indexer/city_boundary.hpp | |
parent | e04d25505fb37abff651434ed4e29e7692af808f (diff) |
Review fixes.
Diffstat (limited to 'indexer/city_boundary.hpp')
-rw-r--r-- | indexer/city_boundary.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/indexer/city_boundary.hpp b/indexer/city_boundary.hpp new file mode 100644 index 0000000000..920a7e202a --- /dev/null +++ b/indexer/city_boundary.hpp @@ -0,0 +1,39 @@ +#pragma once + +#include "geometry/bounding_box.hpp" +#include "geometry/calipers_box.hpp" +#include "geometry/diamond_box.hpp" +#include "geometry/point2d.hpp" + +#include "base/visitor.hpp" + +#include <vector> + +namespace indexer +{ +struct CityBoundary +{ + CityBoundary() = default; + + explicit CityBoundary(std::vector<m2::PointD> const & ps) : m_bbox(ps), m_cbox(ps), m_dbox(ps) {} + + bool HasPoint(m2::PointD const & p) const + { + return m_bbox.HasPoint(p) && m_dbox.HasPoint(p) && m_cbox.HasPoint(p); + } + + bool HasPoint(double x, double y) const { return HasPoint(m2::PointD(x, y)); } + + bool operator==(CityBoundary const & rhs) const + { + return m_bbox == rhs.m_bbox && m_cbox == rhs.m_cbox && m_dbox == rhs.m_dbox; + } + + DECLARE_VISITOR(visitor(m_bbox), visitor(m_cbox), visitor(m_dbox)) + DECLARE_DEBUG_PRINT(CityBoundary) + + m2::BoundingBox m_bbox; + m2::CalipersBox m_cbox; + m2::DiamondBox m_dbox; +}; +} // namespace indexer |