fix compatibility and use generic macro in generic contexts

This commit is contained in:
Sébastien Loriot 2025-04-30 10:17:14 +02:00
parent 05f479356e
commit 991418e64e
9 changed files with 31 additions and 27 deletions

View File

@ -18,6 +18,10 @@
// compatibility // compatibility
#if defined(CGAL_USE_BASIC_VIEWER) && !defined(CGAL_USE_BASIC_VIEWER_QT) #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 #define CGAL_USE_BASIC_VIEWER 1
#endif #endif

View File

@ -39,7 +39,7 @@ 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_QT #ifdef CGAL_USE_BASIC_VIEWER
CGAL::draw(mpwh); CGAL::draw(mpwh);
#endif #endif
} }

View File

@ -33,7 +33,7 @@ int main(int argc, char* argv[])
{ {
std::cout<<" Number of faces: "<<cycle.size()<<std::endl; std::cout<<" Number of faces: "<<cycle.size()<<std::endl;
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
if(argc>=3 && std::string(argv[2])=="-draw") if(argc>=3 && std::string(argv[2])=="-draw")
{ draw_facewidth(lcc, cycle); } { draw_facewidth(lcc, cycle); }
#endif #endif

View File

@ -4,7 +4,7 @@
#include <CGAL/Path_on_surface.h> #include <CGAL/Path_on_surface.h>
/* If you want to use a viewer, you can use qglviewer. */ /* If you want to use a viewer, you can use qglviewer. */
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/draw_face_graph_with_paths.h> #include <CGAL/draw_face_graph_with_paths.h>
#endif #endif
@ -167,7 +167,7 @@ int main(int argc, char** argv)
if (!res) if (!res)
{ errors_seeds.push_back(random.get_seed()); } { errors_seeds.push_back(random.get_seed()); }
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
if (draw) if (draw)
{ CGAL::draw(lcc, paths); } { CGAL::draw(lcc, paths); }
#endif #endif

View File

@ -32,7 +32,7 @@ private:
const LCC_3& m_lcc; const LCC_3& m_lcc;
}; };
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
struct Draw_functor: public CGAL::Graphics_scene_options<LCC_3, struct Draw_functor: public CGAL::Graphics_scene_options<LCC_3,
typename LCC_3::Dart_const_handle, typename LCC_3::Dart_const_handle,
@ -63,16 +63,16 @@ struct Draw_functor: public CGAL::Graphics_scene_options<LCC_3,
LCC_3::size_type belong_to_cycle; LCC_3::size_type belong_to_cycle;
}; };
#endif // CGAL_USE_BASIC_VIEWER_QT #endif // CGAL_USE_BASIC_VIEWER
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
std::cout<<"Program unsew_edgewidth_repeatedly started."<<std::endl; std::cout<<"Program unsew_edgewidth_repeatedly started."<<std::endl;
std::string filename(argc==1?CGAL::data_file_path("meshes/double-torus-example.off"):argv[1]); std::string filename(argc==1?CGAL::data_file_path("meshes/double-torus-example.off"):argv[1]);
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
bool draw=(argc<3?false:std::string(argv[2])=="-draw"); bool draw=(argc<3?false:std::string(argv[2])=="-draw");
#endif // CGAL_USE_BASIC_VIEWER_QT #endif // CGAL_USE_BASIC_VIEWER
std::ifstream inp(filename); std::ifstream inp(filename);
if (inp.fail()) if (inp.fail())
@ -143,13 +143,13 @@ int main(int argc, char* argv[])
} }
while(cycle_exist); while(cycle_exist);
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
if (draw) if (draw)
{ {
Draw_functor df(is_root, belong_to_cycle); Draw_functor df(is_root, belong_to_cycle);
CGAL::draw(lccoriginal, df, "Unsew edge width repeatdly"); CGAL::draw(lccoriginal, df, "Unsew edge width repeatdly");
} }
#endif // CGAL_USE_BASIC_VIEWER_QT #endif // CGAL_USE_BASIC_VIEWER
lccoriginal.free_mark(belong_to_cycle); lccoriginal.free_mark(belong_to_cycle);
lccoriginal.free_mark(is_root); lccoriginal.free_mark(is_root);

View File

@ -20,7 +20,7 @@ Then it verify that
#include <cassert> #include <cassert>
// If you want to use a viewer, you can use qglviewer. // If you want to use a viewer, you can use qglviewer.
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/draw_face_graph_with_paths.h> #include <CGAL/draw_face_graph_with_paths.h>
#endif #endif
@ -76,11 +76,11 @@ void create_positive_loop_24(Path_on_surface<SM>& p, unsigned int n)
{ {
p.extend_straight_positive((10*n)-1); p.extend_straight_positive((10*n)-1);
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
/* std::vector<Path_on_surface<SM> > v; /* std::vector<Path_on_surface<SM> > v;
v.push_back(p); v.push_back(p);
CGAL::draw(p.get_mesh(), v, "Title"); */ CGAL::draw(p.get_mesh(), v, "Title"); */
#endif // CGAL_USE_BASIC_VIEWER_QT #endif // CGAL_USE_BASIC_VIEWER
assert(p.is_closed()); assert(p.is_closed());
} }

View File

@ -119,10 +119,10 @@ int main()
bool cij, ckl, hij_ij, hij_kl, hkl_ij, hkl_kl; bool cij, ckl, hij_ij, hij_kl, hkl_ij, hkl_kl;
bool test_valid=true; bool test_valid=true;
/* /*
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
std::vector<Path_on_surface<SM> > paths={pij, pkl}; std::vector<Path_on_surface<SM> > paths={pij, pkl};
CGAL::draw(sm, paths); // Enable only if CGAL was compiled with Qt6 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) for (int i=-4; i<=4; ++i)
{ {

View File

@ -11,7 +11,7 @@
#include "Creation_of_test_cases_for_paths.h" #include "Creation_of_test_cases_for_paths.h"
// If you want to use a viewer, you can use qglviewer. // If you want to use a viewer, you can use qglviewer.
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/draw_face_graph_with_paths.h> #include <CGAL/draw_face_graph_with_paths.h>
#endif #endif
@ -53,21 +53,21 @@ void transform_path(Path_on_surface<LCC_3_cmap>& path, Transformation t,
bool use_only_positive, bool use_only_positive,
bool use_only_negative, bool use_only_negative,
bool bool
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
draw draw
#endif #endif
=false, =false,
std::size_t repeat=0) // If 0, repeat as long as there is one modification; std::size_t repeat=0) // If 0, repeat as long as there is one modification;
// otherwise repeat the given number of times // otherwise repeat the given number of times
{ {
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
std::vector<Path_on_surface<LCC_3_cmap> > v; std::vector<Path_on_surface<LCC_3_cmap> > v;
if (draw) if (draw)
{ {
v.push_back(path); v.push_back(path);
// CGAL::draw(path.get_map(), v); // CGAL::draw(path.get_map(), v);
} }
#endif // CGAL_USE_BASIC_VIEWER_QT #endif // CGAL_USE_BASIC_VIEWER
internal::Light_MQ<LCC_3_cmap> lmq(path.get_map()); internal::Light_MQ<LCC_3_cmap> lmq(path.get_map());
Path_on_surface<LCC_3_cmap> prepp(path.get_map()); Path_on_surface<LCC_3_cmap> prepp(path.get_map());
@ -100,9 +100,9 @@ void transform_path(Path_on_surface<LCC_3_cmap>& path, Transformation t,
if (modified) if (modified)
{ {
prevp=Path_on_surface<LCC_3_cmap>(curp); prevp=Path_on_surface<LCC_3_cmap>(curp);
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
if (draw) { v.push_back(prevp); } if (draw) { v.push_back(prevp); }
#endif // CGAL_USE_BASIC_VIEWER_QT #endif // CGAL_USE_BASIC_VIEWER
} }
// if (draw /* && nbtest==1*/) // if (draw /* && nbtest==1*/)
@ -112,13 +112,13 @@ void transform_path(Path_on_surface<LCC_3_cmap>& path, Transformation t,
} }
while((repeat==0 && modified) || (nb<repeat)); while((repeat==0 && modified) || (nb<repeat));
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
if (draw) if (draw)
{ {
std::string title="Test "+std::to_string(nbtests); std::string title="Test "+std::to_string(nbtests);
CGAL::draw(path.get_map(), v, title.c_str()); CGAL::draw(path.get_map(), v, title.c_str());
} }
#endif // CGAL_USE_BASIC_VIEWER_QT #endif // CGAL_USE_BASIC_VIEWER
path.swap(prevp); path.swap(prevp);
assert(path.is_valid(true)); assert(path.is_valid(true));

View File

@ -10,7 +10,7 @@
#include "Creation_of_test_cases_for_paths.h" #include "Creation_of_test_cases_for_paths.h"
/* If you want to use a viewer, you can use qglviewer. */ /* If you want to use a viewer, you can use qglviewer. */
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/draw_face_graph_with_paths.h> #include <CGAL/draw_face_graph_with_paths.h>
#endif #endif
@ -44,7 +44,7 @@ bool unit_test_canonize(Curves_on_surface_topology<LCC_3_cmap>& cst,
std::vector<Path_on_surface<LCC_3_cmap> >& paths, std::vector<Path_on_surface<LCC_3_cmap> >& paths,
const char* msg, const char* msg,
bool bool
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
draw draw
#endif #endif
, int testtorun) , int testtorun)
@ -70,13 +70,13 @@ bool unit_test_canonize(Curves_on_surface_topology<LCC_3_cmap>& cst,
} }
} }
#ifdef CGAL_USE_BASIC_VIEWER_QT #ifdef CGAL_USE_BASIC_VIEWER
if (draw) if (draw)
{ {
std::string title="Test "+std::to_string(nbtests); std::string title="Test "+std::to_string(nbtests);
CGAL::draw(paths[0].get_map(), paths, title.c_str()); 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 #ifdef CGAL_TRACE_PATH_TESTS
if (res) { std::cout<<std::endl; } if (res) { std::cout<<std::endl; }