make draw conditional

This commit is contained in:
Sébastien Loriot 2024-11-06 10:59:20 +01:00
parent 78c8b4480e
commit db684c71e6
2 changed files with 11 additions and 1 deletions

View File

@ -5,7 +5,9 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_repair/repair.h>
#include <CGAL/IO/WKT.h>
#ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/draw_multipolygon_with_holes_2.h>
#endif
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point_2 = Kernel::Point_2;
@ -22,8 +24,9 @@ int main(int argc, char* argv[]) {
CGAL::IO::read_polygon_WKT(in, pin);
Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair(pin, CGAL::Polygon_repair::Non_zero_rule());
#ifdef CGAL_USE_BASIC_VIEWER
CGAL::draw(mp);
#endif
if (mp.number_of_polygons_with_holes() > 1) {
CGAL::IO::write_multi_polygon_WKT(std::cout, mp);

View File

@ -2,7 +2,10 @@
#include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/Multipolygon_with_holes_2.h>
#ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/draw_multipolygon_with_holes_2.h>
#endif
#include <CGAL/Polygon_repair/repair.h>
@ -38,13 +41,17 @@ main(int argc, char* argv[])
{
std::ofstream out("union.wkt");
CGAL::IO::write_multi_polygon_WKT(out, mpwh);
#ifdef CGAL_USE_BASIC_VIEWER
CGAL::draw(mpwh);
#endif
}
mpwh = CGAL::Polygon_repair::repair(pA, CGAL::Polygon_repair::Intersection_rule());
{
std::ofstream out("intersection.wkt");
CGAL::IO::write_multi_polygon_WKT(out, mpwh);
#ifdef CGAL_USE_BASIC_VIEWER
CGAL::draw(mpwh);
#endif
}
{