diff --git a/Polygon/include/CGAL/Multipolygon_with_holes_2.h b/Polygon/include/CGAL/Multipolygon_with_holes_2.h index 39ebd29dff3..8636626d1a9 100644 --- a/Polygon/include/CGAL/Multipolygon_with_holes_2.h +++ b/Polygon/include/CGAL/Multipolygon_with_holes_2.h @@ -101,6 +101,16 @@ public: Size number_of_polygons_with_holes() const { return static_cast(m_polygons.size()); } + Bbox_2 bbox() const + { + Bbox_2 bb; + for(const auto& pwh : polygons_with_holes()){ + bb += pwh.bbox(); + } + return bb; + } + + protected: Polygon_with_holes_container m_polygons; }; diff --git a/Polygon/test/Polygon/Multipolygon_with_holes_test.cpp b/Polygon/test/Polygon/Multipolygon_with_holes_test.cpp index 1257db73f90..7592211bd43 100644 --- a/Polygon/test/Polygon/Multipolygon_with_holes_test.cpp +++ b/Polygon/test/Polygon/Multipolygon_with_holes_test.cpp @@ -45,5 +45,7 @@ int main() std::cout << mp << std::endl; + CGAL::Bbox_2 bb = mp.bbox(); + return 0; }