diff --git a/Device/Mask/Line.cpp b/Device/Mask/Line.cpp index b006bf857384c6e57ceafcd68c783471aa1cc8d7..93ebca92e8cd9d308c5a1a1ea1cefb794d42292a 100644 --- a/Device/Mask/Line.cpp +++ b/Device/Mask/Line.cpp @@ -17,14 +17,11 @@ #include "Base/Utils/Algorithms.h" #include <boost/geometry.hpp> -#include <boost/geometry/geometries/linestring.hpp> -#include <boost/geometry/geometries/point_xy.hpp> #include <limits> -using namespace boost::geometry; -typedef model::d2::point_xy<double> point_t; -typedef model::box<point_t> box_t; -typedef model::linestring<point_t> line_t; +typedef boost::geometry::model::d2::point_xy<double> point_t; +// typedef model::box<point_t> box_t; +typedef boost::geometry::model::linestring<point_t> line_t; Line::Line(double x1, double y1, double x2, double y2) : IShape2D("Line"), m_x1(x1), m_y1(y1), m_x2(x2), m_y2(y2) @@ -38,7 +35,7 @@ bool Line::contains(double x, double y) const line.push_back(point_t(m_x1, m_y1)); line.push_back(point_t(m_x2, m_y2)); - double d = distance(p, line); + double d = boost::geometry::distance(p, line); return d < std::numeric_limits<double>::epsilon(); } @@ -58,8 +55,8 @@ bool Line::contains(const Bin1D& binx, const Bin1D& biny) const line_points.push_back(point_t(m_x1, m_y1)); line_points.push_back(point_t(m_x2, m_y2)); - return intersects(line_t(box_points.begin(), box_points.end()), - line_t(line_points.begin(), line_points.end())); + return boost::geometry::intersects(line_t(box_points.begin(), box_points.end()), + line_t(line_points.begin(), line_points.end())); } // ------------------------------------------------------------------------- // diff --git a/Device/Mask/Polygon.cpp b/Device/Mask/Polygon.cpp index ccbe31bd57cf536835d0da732c8abe2f2d20ca81..6431f79e1e991da000203539325d92090761f155 100644 --- a/Device/Mask/Polygon.cpp +++ b/Device/Mask/Polygon.cpp @@ -16,16 +16,12 @@ #include "Base/Axis/Bin.h" #include <boost/geometry.hpp> -#include <boost/geometry/geometries/point_xy.hpp> -#include <boost/geometry/geometries/polygon.hpp> - -using namespace boost::geometry; //! The private data for polygons to hide boost dependency from the header class PolygonPrivate { public: - typedef model::d2::point_xy<double> point_t; - typedef model::polygon<point_t> polygon_t; + typedef boost::geometry::model::d2::point_xy<double> point_t; + typedef boost::geometry::model::polygon<point_t> polygon_t; polygon_t polygon; void init_from(const std::vector<double>& x, const std::vector<double>& y); void get_points(std::vector<double>& xpos, std::vector<double>& ypos); @@ -40,8 +36,8 @@ void PolygonPrivate::init_from(const std::vector<double>& x, const std::vector<d std::vector<point_t> points; for (size_t i = 0; i < x.size(); ++i) points.push_back(point_t(x[i], y[i])); - assign_points(polygon, points); - correct(polygon); + boost::geometry::assign_points(polygon, points); + boost::geometry::correct(polygon); } void PolygonPrivate::get_points(std::vector<double>& xpos, std::vector<double>& ypos) @@ -97,18 +93,22 @@ Polygon::~Polygon() bool Polygon::contains(double x, double y) const { - // return within(PolygonPrivate::point_t(x, y), m_d->polygon); // not including borders - return covered_by(PolygonPrivate::point_t(x, y), m_d->polygon); // including borders + // not including borders + // return within(PolygonPrivate::point_t(x, y), m_d->polygon); + + // including borders + return boost::geometry::covered_by(PolygonPrivate::point_t(x, y), + m_d->polygon); } bool Polygon::contains(const Bin1D& binx, const Bin1D& biny) const { - return contains(binx.center(), biny.center()); + return Polygon::contains(binx.center(), biny.center()); } double Polygon::getArea() const { - return area(m_d->polygon); + return boost::geometry::area(m_d->polygon); } void Polygon::getPoints(std::vector<double>& xpos, std::vector<double>& ypos) const @@ -118,5 +118,5 @@ void Polygon::getPoints(std::vector<double>& xpos, std::vector<double>& ypos) co void Polygon::print(std::ostream& ostr) const { - ostr << wkt<PolygonPrivate::polygon_t>(m_d->polygon); + ostr << boost::geometry::wkt<PolygonPrivate::polygon_t>(m_d->polygon); }