From 991418e64ec746fa5ed9edbe72ac1cd6a37707cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 30 Apr 2025 10:17:14 +0200 Subject: [PATCH] fix compatibility and use generic macro in generic contexts --- Basic_viewer/include/CGAL/Basic_viewer.h | 4 ++++ .../Polygon_repair/repair_union_intersect_2.cpp | 2 +- .../examples/Surface_mesh_topology/facewidth.cpp | 2 +- .../Surface_mesh_topology/path_homotopy.cpp | 4 ++-- .../unsew_edgewidth_repeatedly.cpp | 12 ++++++------ .../fundamental_group_of_the_circle.cpp | 6 +++--- .../fundamental_group_of_the_torus.cpp | 4 ++-- .../path_with_rle_deformation_tests.cpp | 16 ++++++++-------- .../test/Surface_mesh_topology/test_homotopy.cpp | 8 ++++---- 9 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Basic_viewer/include/CGAL/Basic_viewer.h b/Basic_viewer/include/CGAL/Basic_viewer.h index d337396114c..7a3354691c2 100644 --- a/Basic_viewer/include/CGAL/Basic_viewer.h +++ b/Basic_viewer/include/CGAL/Basic_viewer.h @@ -18,6 +18,10 @@ // compatibility #if defined(CGAL_USE_BASIC_VIEWER) && !defined(CGAL_USE_BASIC_VIEWER_QT) +#define CGAL_USE_BASIC_VIEWER_QT 1 +#endif + +#if defined(CGAL_USE_BASIC_VIEWER_QT) && !defined(CGAL_USE_BASIC_VIEWER) #define CGAL_USE_BASIC_VIEWER 1 #endif diff --git a/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp index 44c9b18f31a..57ad1661d8d 100644 --- a/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp +++ b/Polygon_repair/examples/Polygon_repair/repair_union_intersect_2.cpp @@ -39,7 +39,7 @@ main(int argc, char* argv[]) { std::ofstream out("union.wkt"); CGAL::IO::write_multi_polygon_WKT(out, mpwh); -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER CGAL::draw(mpwh); #endif } diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth.cpp index 4881a304c59..1ac14f92fda 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/facewidth.cpp @@ -33,7 +33,7 @@ int main(int argc, char* argv[]) { std::cout<<" Number of faces: "<=3 && std::string(argv[2])=="-draw") { draw_facewidth(lcc, cycle); } #endif diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp index 1c0e62fc625..def33c86cf6 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/path_homotopy.cpp @@ -4,7 +4,7 @@ #include /* If you want to use a viewer, you can use qglviewer. */ -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER #include #endif @@ -167,7 +167,7 @@ int main(int argc, char** argv) if (!res) { errors_seeds.push_back(random.get_seed()); } -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER if (draw) { CGAL::draw(lcc, paths); } #endif diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/unsew_edgewidth_repeatedly.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/unsew_edgewidth_repeatedly.cpp index b0730077818..441d41bd45c 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/unsew_edgewidth_repeatedly.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/unsew_edgewidth_repeatedly.cpp @@ -32,7 +32,7 @@ private: const LCC_3& m_lcc; }; -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER struct Draw_functor: public CGAL::Graphics_scene_options // If you want to use a viewer, you can use qglviewer. -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER #include #endif @@ -76,11 +76,11 @@ void create_positive_loop_24(Path_on_surface& p, unsigned int n) { p.extend_straight_positive((10*n)-1); -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER /* std::vector > v; v.push_back(p); CGAL::draw(p.get_mesh(), v, "Title"); */ -#endif // CGAL_USE_BASIC_VIEWER_QT +#endif // CGAL_USE_BASIC_VIEWER assert(p.is_closed()); } diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/fundamental_group_of_the_torus.cpp b/Surface_mesh_topology/test/Surface_mesh_topology/fundamental_group_of_the_torus.cpp index 548d70d6d2a..799198f5c0c 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/fundamental_group_of_the_torus.cpp +++ b/Surface_mesh_topology/test/Surface_mesh_topology/fundamental_group_of_the_torus.cpp @@ -119,10 +119,10 @@ int main() bool cij, ckl, hij_ij, hij_kl, hkl_ij, hkl_kl; bool test_valid=true; /* -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER std::vector > paths={pij, pkl}; CGAL::draw(sm, paths); // Enable only if CGAL was compiled with Qt6 -#endif // CGAL_USE_BASIC_VIEWER_QT +#endif // CGAL_USE_BASIC_VIEWER */ for (int i=-4; i<=4; ++i) { diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/path_with_rle_deformation_tests.cpp b/Surface_mesh_topology/test/Surface_mesh_topology/path_with_rle_deformation_tests.cpp index e601cd924e1..4eed5e7ea8e 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/path_with_rle_deformation_tests.cpp +++ b/Surface_mesh_topology/test/Surface_mesh_topology/path_with_rle_deformation_tests.cpp @@ -11,7 +11,7 @@ #include "Creation_of_test_cases_for_paths.h" // If you want to use a viewer, you can use qglviewer. -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER #include #endif @@ -53,21 +53,21 @@ void transform_path(Path_on_surface& path, Transformation t, bool use_only_positive, bool use_only_negative, bool -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER draw #endif =false, std::size_t repeat=0) // If 0, repeat as long as there is one modification; // otherwise repeat the given number of times { -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER std::vector > v; if (draw) { v.push_back(path); // CGAL::draw(path.get_map(), v); } -#endif // CGAL_USE_BASIC_VIEWER_QT +#endif // CGAL_USE_BASIC_VIEWER internal::Light_MQ lmq(path.get_map()); Path_on_surface prepp(path.get_map()); @@ -100,9 +100,9 @@ void transform_path(Path_on_surface& path, Transformation t, if (modified) { prevp=Path_on_surface(curp); -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER if (draw) { v.push_back(prevp); } -#endif // CGAL_USE_BASIC_VIEWER_QT +#endif // CGAL_USE_BASIC_VIEWER } // if (draw /* && nbtest==1*/) @@ -112,13 +112,13 @@ void transform_path(Path_on_surface& path, Transformation t, } while((repeat==0 && modified) || (nb #endif @@ -44,7 +44,7 @@ bool unit_test_canonize(Curves_on_surface_topology& cst, std::vector >& paths, const char* msg, bool -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER draw #endif , int testtorun) @@ -70,13 +70,13 @@ bool unit_test_canonize(Curves_on_surface_topology& cst, } } -#ifdef CGAL_USE_BASIC_VIEWER_QT +#ifdef CGAL_USE_BASIC_VIEWER if (draw) { std::string title="Test "+std::to_string(nbtests); CGAL::draw(paths[0].get_map(), paths, title.c_str()); } -#endif // CGAL_USE_BASIC_VIEWER_QT +#endif // CGAL_USE_BASIC_VIEWER #ifdef CGAL_TRACE_PATH_TESTS if (res) { std::cout<