diff --git a/Polygon/doc/Polygon/Concepts/MultiPolygonWithHoles_2.h b/Polygon/doc/Polygon/Concepts/MultiPolygonWithHoles_2.h index 687683d76ff..917e6f91052 100644 --- a/Polygon/doc/Polygon/Concepts/MultiPolygonWithHoles_2.h +++ b/Polygon/doc/Polygon/Concepts/MultiPolygonWithHoles_2.h @@ -19,13 +19,13 @@ public: //! the polygon type used to represent each polygon with holes of the multipolygon. typedef unspecified_type Polygon_with_holes_2; -/*! a bidirectional iterator over the polygons. +/*! a bidirectional iterator over the polygons with holes. * Its value type is `Polygon_with_holes_2`. */ -typedef unspecified_type Polygon_const_iterator; +typedef unspecified_type Polygon_with_holes_const_iterator; -//! range type for iterating over the polygons. -typedef unspecified_type Polygons_container; +//! range type for iterating over polygons with holes. +typedef unspecified_type Polygon_with_holes_container; //! size type typedef unsigned int Size; @@ -35,7 +35,7 @@ typedef unsigned int Size; /// \name Creation /// @{ -/*! constructs a multipolygon using a range of polygons. +/*! constructs a multipolygon using a range of polygons with holes. */ template MultipolygonWithHoles_2(InputIterator begin, InputIterator end); @@ -45,41 +45,41 @@ MultipolygonWithHoles_2(InputIterator begin, InputIterator end); /// \name Predicates /// @{ -/*! returns the number of polygons. +/*! returns the number of polygons with holes. */ -Size number_of_polygons(); +Size number_of_polygons_wih_holes(); /// @} /// \name Access Functions /// @{ -/*! returns the begin iterator of the polygons. +/*! returns the begin iterator of the polygons with holes. */ -Polygon_const_iterator polygons_begin() const; +Polygon_with_holes_const_iterator polygons_with_holes_begin() const; -/*! returns the past-the-end iterator of the polygons. +/*! returns the past-the-end iterator of the polygons with holes. */ -Polygon_const_iterator polygons_end() const; +Polygon_with_holes_const_iterator polygons_with_holes_end() const; -/*! returns the range of polygons. +/*! returns the range of polygons with holes. */ -const Polygons_container& polygons() const; +const Polygon_with_holes_container& polygons_with_holes() const; /// @} /// \name Modifiers /// @{ -/*! adds a given polygon to the multipolygon. +/*! adds a given polygon with holes to the multipolygon. */ -void add_polygon(const Polygon_with_holes_2& polygon); +void add_polygon_with_holes(const Polygon_with_holes_2& polygon); /*! erases the specified polygon. */ -void erase_polygon(Polygon_iterator pit); +void erase_polygon_with_holes(Polygon_iterator pit); -/*! removes all the polygons. +/*! removes all the polygons with holes. */ void clear(); diff --git a/Polygon/include/CGAL/General_polygon_with_holes_2.h b/Polygon/include/CGAL/General_polygon_with_holes_2.h index 42173fc2ad6..bb19fcf9943 100644 --- a/Polygon/include/CGAL/General_polygon_with_holes_2.h +++ b/Polygon/include/CGAL/General_polygon_with_holes_2.h @@ -28,8 +28,8 @@ namespace CGAL { * * The class `General_polygon_with_holes_2` models the concept * `GeneralPolygonWithHoles_2`. It represents a general polygon with holes. - * It is parameterized with a type `Polygon` used to define the exposed - * type `Polygon_2`. This type represents the outer boundary of the general + * It is parameterized with a type `Polygon_` used to define the exposed + * type `%Polygon_2`. This type represents the outer boundary of the general * polygon and each hole. * * \tparam Polygon_ must have input and output operators. diff --git a/Polygon/include/CGAL/Multipolygon_with_holes_2.h b/Polygon/include/CGAL/Multipolygon_with_holes_2.h index 1d154419bd7..3fb93f903be 100644 --- a/Polygon/include/CGAL/Multipolygon_with_holes_2.h +++ b/Polygon/include/CGAL/Multipolygon_with_holes_2.h @@ -46,10 +46,10 @@ public: /// @} - using Polygons_container = std::deque; + using Polygon_with_holes_container = std::deque; - using Polygon_iterator = typename Polygons_container::iterator; - using Polygon_const_iterator = typename Polygons_container::const_iterator; + using Polygon_with_holes_iterator = typename Polygon_with_holes_container::iterator; + using Polygon_with_holes_const_iterator = typename Polygon_with_holes_container::const_iterator; /// the size type using Size = unsigned int; @@ -64,32 +64,32 @@ public: m_polygons(p_begin, p_end) {} - Polygons_container& polygons() { return m_polygons; } + Polygon_with_holes_container& polygons_with_holes() { return m_polygons; } - const Polygons_container& polygons() const { return m_polygons; } + const Polygon_with_holes_container& polygons_with_holes() const { return m_polygons; } - Polygon_iterator polygons_begin() { return m_polygons.begin(); } + Polygon_with_holes_iterator polygons_with_holes_begin() { return m_polygons.begin(); } - Polygon_iterator polygons_end() { return m_polygons.end(); } + Polygon_with_holes_iterator polygons_with_holes_end() { return m_polygons.end(); } - Polygon_const_iterator polygons_begin() const { return m_polygons.begin(); } + Polygon_with_holes_const_iterator polygons_with_holes_begin() const { return m_polygons.begin(); } - Polygon_const_iterator polygons_end() const { return m_polygons.end(); } + Polygon_with_holes_const_iterator polygons_with_holes_end() const { return m_polygons.end(); } void add_polygon(const Polygon_2& pgn) { m_polygons.push_back(Polygon_with_holes_2(pgn)); } - void add_polygon(const Polygon_with_holes_2& pgn) { m_polygons.push_back(pgn); } + void add_polygon_with_holes(const Polygon_with_holes_2& pgn) { m_polygons.push_back(pgn); } - void add_polygon(Polygon_with_holes_2&& pgn) { m_polygons.emplace_back(std::move(pgn)); } + void add_polygon_with_holes(Polygon_with_holes_2&& pgn) { m_polygons.emplace_back(std::move(pgn)); } - void erase_polygon(Polygon_iterator pit) { m_polygons.erase(pit); } + void erase_polygon_with_holes(Polygon_with_holes_iterator pit) { m_polygons.erase(pit); } void clear() { m_polygons.clear(); } - Size number_of_polygons() const { return static_cast(m_polygons.size()); } + Size number_of_polygons_with_holes() const { return static_cast(m_polygons.size()); } protected: - Polygons_container m_polygons; + Polygon_with_holes_container m_polygons; }; /*! @@ -113,26 +113,26 @@ order. template std::ostream& operator<<(std::ostream& os, const Multipolygon_with_holes_2& mp) { - typename Multipolygon_with_holes_2::Polygon_const_iterator i; + typename Multipolygon_with_holes_2::Polygon_with_holes_const_iterator i; switch(IO::get_mode(os)) { case IO::ASCII : os << mp.number_of_polygons() << ' '; - for (i = mp.polygons_begin(); i != mp.polygons_end(); ++i) { + for (i = mp.polygon_with_holes_begin(); i != mp.polygon_with_holes_end(); ++i) { os << *i << ' '; } return os; case IO::BINARY : - os << mp.number_of_polygons(); - for (i = mp.polygons_begin(); i != mp.polygons_end(); ++i) { + os << mp.number_of_polygons_with_holes(); + for (i = mp.polygons_with_holes_begin(); i != mp.polygons_with_holes_end(); ++i) { os << *i ; } return os; default: os << "Multipolygon_with_holes_2(" << std::endl; - for (i = mp.polygons_begin(); i != mp.polygons_end(); ++i) { + for (i = mp.polygons_with_holes_begin(); i != mp.polygons_with_holes_end(); ++i) { os << " " << *i << std::endl; } diff --git a/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h b/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h index 814723411c7..d9e311b6af2 100644 --- a/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h +++ b/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h @@ -69,7 +69,7 @@ public: const char* title = "Basic Multipolygon_with_holes_2 Viewer") : Base(parent, title, true, true, true, false, false), m_mpwh(mpwh) { - if (mpwh.number_of_polygons() == 0) return; + if (mpwh.number_of_polygons_with_holes() == 0) return; // mimic the computation of Camera::pixelGLRatio() auto bbox = bounding_box(); @@ -99,8 +99,8 @@ public: */ CGAL::Bbox_2 bounding_box() { Bbox_2 bbox; - if (m_mpwh.number_of_polygons() > 0) bbox = m_mpwh.polygons().front().outer_boundary().bbox(); - for (auto const& pwh: m_mpwh.polygons()) { + if (m_mpwh.number_of_polygons_with_holes() > 0) bbox = m_mpwh.polygons_with_holes().front().outer_boundary().bbox(); + for (auto const& pwh: m_mpwh.polygons_with_holes()) { bbox += pwh.outer_boundary().bbox(); } return bbox; @@ -111,7 +111,7 @@ public: void add_elements() { clear(); - for (auto const& p: m_mpwh.polygons()) { + for (auto const& p: m_mpwh.polygons_with_holes()) { CGAL::IO::Color c(rand()%255,rand()%255,rand()%255); face_begin(c); diff --git a/Polygon_repair/examples/Polygon_repair/repair_polygon_2.cpp b/Polygon_repair/examples/Polygon_repair/repair_polygon_2.cpp index c8a91fb0c1b..ed48aabf593 100644 --- a/Polygon_repair/examples/Polygon_repair/repair_polygon_2.cpp +++ b/Polygon_repair/examples/Polygon_repair/repair_polygon_2.cpp @@ -17,10 +17,10 @@ int main(int argc, char* argv[]) { CGAL::IO::read_polygon_WKT(in, pin); Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair_odd_even(pin); - if (mp.number_of_polygons() > 1) { + if (mp.number_of_polygons_with_holes() > 1) { CGAL::IO::write_multi_polygon_WKT(std::cout, mp); } else { - CGAL::IO::write_polygon_WKT(std::cout, mp.polygons()[0]); + CGAL::IO::write_polygon_WKT(std::cout, mp.polygons_with_holes()[0]); } return 0; diff --git a/Polygon_repair/include/CGAL/Polygon_repair/Polygon_repair.h b/Polygon_repair/include/CGAL/Polygon_repair/Polygon_repair.h index 6c67b602a43..81e1090af03 100644 --- a/Polygon_repair/include/CGAL/Polygon_repair/Polygon_repair.h +++ b/Polygon_repair/include/CGAL/Polygon_repair/Polygon_repair.h @@ -427,7 +427,7 @@ public: void add_to_triangulation_odd_even(const Multipolygon_with_holes_2& multipolygon) { // Get unique edges - for (auto const& polygon: multipolygon.polygons()) { + for (auto const& polygon: multipolygon.polygons_with_holes()) { for (auto const& edge: polygon.outer_boundary().edges()) { if (edge.source() == edge.target()) continue; std::pair pair = (edge.source() < edge.target())? @@ -637,7 +637,7 @@ public: } for (auto const& polygon: ordered_polygons) { // std::cout << "Adding polygon " << polygon << std::endl; - mp.add_polygon(polygon); + mp.add_polygon_with_holes(polygon); } } diff --git a/Polygon_repair/test/Polygon_repair/clipart.cpp b/Polygon_repair/test/Polygon_repair/clipart.cpp index cc184ee781e..b5337840fd8 100644 --- a/Polygon_repair/test/Polygon_repair/clipart.cpp +++ b/Polygon_repair/test/Polygon_repair/clipart.cpp @@ -82,9 +82,9 @@ int main(int argc, char* argv[]) { pr.reconstruct_multipolygon(); } Multipolygon_with_holes_2 mp = pr.multipolygon(); - if (mp.number_of_polygons() > 0) { - CGAL::Bbox_2 bbox = mp.polygons().front().bbox(); - for (auto const& polygon: mp.polygons()) { + if (mp.number_of_polygons_with_holes() > 0) { + CGAL::Bbox_2 bbox = mp.polygons_with_holes().front().bbox(); + for (auto const& polygon: mp.polygons_with_holes()) { bbox += polygon.outer_boundary().bbox(); } Kernel::Vector_2 translate(-bbox.xmin(), -bbox.ymin()); double scale = desired_width/(bbox.xmax()-bbox.xmin()); @@ -93,7 +93,7 @@ int main(int argc, char* argv[]) { std::ofstream ofs(folder_out + "/" + std::string(file.path().stem()) + ".svg"); ofs << "" << std::endl; - for (auto const& polygon: mp.polygons()) { + for (auto const& polygon: mp.polygons_with_holes()) { // std::cout << polygon << std::endl; ofs << "\t 0) ofs << ","; + if (rmp.polygons_with_holes()[i].number_of_holes() > 0) ofs << ","; ofs << std::endl; - for (int j = 0; j < rmp.polygons()[i].holes().size(); ++j) { + for (int j = 0; j < rmp.polygons_with_holes()[i].holes().size(); ++j) { ofs << "\t\t\t[" << std::endl; - for (int k = 0; k < rmp.polygons()[i].holes()[j].size(); ++k) { - ofs << "\t\t\t\t[" << rmp.polygons()[i].holes()[j][k].x() << - ", " << rmp.polygons()[i].holes()[j][k].y() << "]"; - if (k < rmp.polygons()[i].holes()[j].size()-1) ofs << ","; + for (int k = 0; k < rmp.polygons_with_holes()[i].holes()[j].size(); ++k) { + ofs << "\t\t\t\t[" << rmp.polygons_with_holes()[i].holes()[j][k].x() << + ", " << rmp.polygons_with_holes()[i].holes()[j][k].y() << "]"; + if (k < rmp.polygons_with_holes()[i].holes()[j].size()-1) ofs << ","; ofs << std::endl; } ofs << "\t\t\t]"; - if (j < rmp.polygons()[i].holes().size()-1) ofs << ","; + if (j < rmp.polygons_with_holes()[i].holes().size()-1) ofs << ","; ofs << std::endl; } ofs << "\t\t]"; - if (i < rmp.polygons().size()-1) ofs << ","; + if (i < rmp.polygons_with_holes().size()-1) ofs << ","; ofs << std::endl; } ofs << "\t]" << std::endl; ofs << "}" << std::endl; diff --git a/Stream_support/include/CGAL/IO/WKT.h b/Stream_support/include/CGAL/IO/WKT.h index ef8c7dee1f0..f558c90aea2 100644 --- a/Stream_support/include/CGAL/IO/WKT.h +++ b/Stream_support/include/CGAL/IO/WKT.h @@ -351,7 +351,7 @@ template bool read_multi_polygon_WKT(std::istream& in, Multipolygon_with_holes_2& mp) { - return read_multi_polygon_WKT(in, mp.polygons()); + return read_multi_polygon_WKT(in, mp.polygons_with_holes()); } @@ -359,7 +359,7 @@ template std::ostream& write_multi_polygon_WKT(std::ostream& out, Multipolygon_with_holes_2& mp) { - return write_multi_polygon_WKT(out, mp.polygons()); + return write_multi_polygon_WKT(out, mp.polygons_with_holes()); } //! \ingroup PkgStreamSupportIoFuncsWKT