mirror of https://github.com/CGAL/cgal
make draw conditional
This commit is contained in:
parent
78c8b4480e
commit
db684c71e6
|
|
@ -5,7 +5,9 @@
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Polygon_repair/repair.h>
|
#include <CGAL/Polygon_repair/repair.h>
|
||||||
#include <CGAL/IO/WKT.h>
|
#include <CGAL/IO/WKT.h>
|
||||||
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
#include <CGAL/draw_multipolygon_with_holes_2.h>
|
#include <CGAL/draw_multipolygon_with_holes_2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||||
using Point_2 = Kernel::Point_2;
|
using Point_2 = Kernel::Point_2;
|
||||||
|
|
@ -22,8 +24,9 @@ int main(int argc, char* argv[]) {
|
||||||
CGAL::IO::read_polygon_WKT(in, pin);
|
CGAL::IO::read_polygon_WKT(in, pin);
|
||||||
|
|
||||||
Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair(pin, CGAL::Polygon_repair::Non_zero_rule());
|
Multipolygon_with_holes_2 mp = CGAL::Polygon_repair::repair(pin, CGAL::Polygon_repair::Non_zero_rule());
|
||||||
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
CGAL::draw(mp);
|
CGAL::draw(mp);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mp.number_of_polygons_with_holes() > 1) {
|
if (mp.number_of_polygons_with_holes() > 1) {
|
||||||
CGAL::IO::write_multi_polygon_WKT(std::cout, mp);
|
CGAL::IO::write_multi_polygon_WKT(std::cout, mp);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
#include <CGAL/Polygon_with_holes_2.h>
|
#include <CGAL/Polygon_with_holes_2.h>
|
||||||
#include <CGAL/Multipolygon_with_holes_2.h>
|
#include <CGAL/Multipolygon_with_holes_2.h>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
#include <CGAL/draw_multipolygon_with_holes_2.h>
|
#include <CGAL/draw_multipolygon_with_holes_2.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <CGAL/Polygon_repair/repair.h>
|
#include <CGAL/Polygon_repair/repair.h>
|
||||||
|
|
||||||
|
|
@ -38,13 +41,17 @@ main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
std::ofstream out("union.wkt");
|
std::ofstream out("union.wkt");
|
||||||
CGAL::IO::write_multi_polygon_WKT(out, mpwh);
|
CGAL::IO::write_multi_polygon_WKT(out, mpwh);
|
||||||
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
CGAL::draw(mpwh);
|
CGAL::draw(mpwh);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
mpwh = CGAL::Polygon_repair::repair(pA, CGAL::Polygon_repair::Intersection_rule());
|
mpwh = CGAL::Polygon_repair::repair(pA, CGAL::Polygon_repair::Intersection_rule());
|
||||||
{
|
{
|
||||||
std::ofstream out("intersection.wkt");
|
std::ofstream out("intersection.wkt");
|
||||||
CGAL::IO::write_multi_polygon_WKT(out, mpwh);
|
CGAL::IO::write_multi_polygon_WKT(out, mpwh);
|
||||||
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
CGAL::draw(mpwh);
|
CGAL::draw(mpwh);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue