diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index 18f76232f41..bccdc935a1e 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -1039,43 +1039,16 @@ private: QOpenGLShaderProgram rendering_program_p_l; }; -} // End namespace CGAL - #else // CGAL_USE_BASIC_VIEWER -namespace CGAL -{ - -template -void draw(const T&, const char*, bool, const ColorFunctor&) -{ - std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined." - < -void draw(const T&, const char*, bool) -{ - std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined." - < -void draw(const T&, const char*) -{ - std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined." - < -void draw(const T&) -{ - std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined." - < + void draw(const T& t, const char* ="", bool=false) + { + std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."< #include namespace CGAL @@ -198,48 +199,43 @@ protected: const ColorFunctor& m_fcolor; }; -template -void draw(const LCC& alcc, - const char* title, - bool nofill, - const ColorFunctor& fcolor) +// Specialization of draw function. +#define CGAL_LCC_TYPE CGAL::Linear_cell_complex_base \ + + +template < unsigned int d_, unsigned int ambient_dim, + class Traits_, + class Items_, + class Alloc_, + template + class Map, + class Refs, + class Storage_> +void draw(const CGAL_LCC_TYPE& alcc, + const char* title="LCC for CMap Basic Viewer", + bool nofill=false) { #if defined(CGAL_TEST_SUITE) bool cgal_test_suite=true; #else bool cgal_test_suite=false; #endif - + if (!cgal_test_suite) { int argc=1; const char* argv[2]={"lccviewer","\0"}; QApplication app(argc,const_cast(argv)); - SimpleLCCViewerQt mainwindow(app.activeWindow(), - alcc, - title, - nofill, - fcolor); + DefaultColorFunctorLCC fcolor; + SimpleLCCViewerQt + mainwindow(app.activeWindow(), alcc, title, nofill, fcolor); mainwindow.show(); app.exec(); } } -template -void draw(const LCC& alcc, const char* title, bool nofill) -{ - DefaultColorFunctorLCC c; - draw(alcc, title, nofill, c); -} - -template -void draw(const LCC& alcc, const char* title) -{ draw(alcc, title, false); } - -template -void draw(const LCC& alcc) -{ draw(alcc, "Basic LCC Viewer"); } - +#undef CGAL_LCC_TYPE + } // End namespace CGAL #endif // CGAL_USE_BASIC_VIEWER diff --git a/Point_set_3/include/CGAL/draw_point_set_3.h b/Point_set_3/include/CGAL/draw_point_set_3.h index 9511ee04c78..d6af8f862f2 100644 --- a/Point_set_3/include/CGAL/draw_point_set_3.h +++ b/Point_set_3/include/CGAL/draw_point_set_3.h @@ -26,6 +26,7 @@ #ifdef CGAL_USE_BASIC_VIEWER +#include #include namespace CGAL @@ -76,33 +77,31 @@ protected: protected: const PointSet& pointset; }; - -template -void draw(const PointSet& apointset, const char* title) + +// Specialization of draw function. +template +void draw(const Point_set_3& apointset, + const char* title="Point_set_3 Basic Viewer") { #if defined(CGAL_TEST_SUITE) bool cgal_test_suite=true; #else bool cgal_test_suite=false; #endif - + if (!cgal_test_suite) { int argc=1; const char* argv[2]={"point_set_viewer","\0"}; QApplication app(argc,const_cast(argv)); - SimplePointSetViewerQt mainwindow(app.activeWindow(), - apointset, - title); + SimplePointSetViewerQt > mainwindow(app.activeWindow(), + apointset, + title); mainwindow.show(); app.exec(); } } -template -void draw(const PointSet& apointset) -{ draw(apointset, "Basic Point_set Viewer"); } - } // End namespace CGAL #endif // CGAL_USE_BASIC_VIEWER diff --git a/Polyhedron/include/CGAL/draw_polyhedron.h b/Polyhedron/include/CGAL/draw_polyhedron.h index b8464757097..7a1781ced0c 100644 --- a/Polyhedron/include/CGAL/draw_polyhedron.h +++ b/Polyhedron/include/CGAL/draw_polyhedron.h @@ -26,6 +26,7 @@ #ifdef CGAL_USE_BASIC_VIEWER +#include #include namespace CGAL @@ -193,45 +194,40 @@ protected: bool m_nofaces; const ColorFunctor& m_fcolor; }; - -template -void draw(const Polyhedron& apoly, - const char* title, - bool nofill, - const ColorFunctor& fcolor) -{ + +// Specialization of draw function. +#define CGAL_POLY_TYPE CGAL::Polyhedron_3 \ + + +template + class T_HDS, + class Alloc> +void draw(const CGAL_POLY_TYPE& apoly, + const char* title="Polyhedron Basic Viewer", + bool nofill=false) +{ #if defined(CGAL_TEST_SUITE) bool cgal_test_suite=true; #else bool cgal_test_suite=false; #endif - + if (!cgal_test_suite) { int argc=1; const char* argv[2]={"polyhedron_viewer","\0"}; QApplication app(argc,const_cast(argv)); - SimplePolyhedronViewerQt + DefaultColorFunctorPolyhedron fcolor; + SimplePolyhedronViewerQt mainwindow(app.activeWindow(), apoly, title, nofill, fcolor); mainwindow.show(); app.exec(); } } -template -void draw(const Polyhedron& apoly, const char* title, bool nofill) -{ - DefaultColorFunctorPolyhedron c; - draw(apoly, title, nofill, c); -} - -template -void draw(const Polyhedron& apoly, const char* title) -{ draw(apoly, title, false); } - -template -void draw(const Polyhedron& apoly) -{ draw(apoly, "Basic Polyhedron Viewer"); } +#undef CGAL_POLY_TYPE } // End namespace CGAL diff --git a/Surface_mesh/include/CGAL/draw_surface_mesh.h b/Surface_mesh/include/CGAL/draw_surface_mesh.h index 3e5f602d94c..1710a19c814 100644 --- a/Surface_mesh/include/CGAL/draw_surface_mesh.h +++ b/Surface_mesh/include/CGAL/draw_surface_mesh.h @@ -41,6 +41,7 @@ void draw(const SM& asm); #ifdef CGAL_USE_BASIC_VIEWER +#include #include namespace CGAL @@ -201,48 +202,31 @@ protected: const ColorFunctor& m_fcolor; }; -template -void draw(const SM& amesh, - const char* title, - bool nofill, - const ColorFunctor& fcolor) +// Specialization of draw function. +template +void draw(const Surface_mesh& amesh, + const char* title="Surface_mesh Basic Viewer", + bool nofill=false) { #if defined(CGAL_TEST_SUITE) bool cgal_test_suite=true; #else bool cgal_test_suite=false; #endif - + if (!cgal_test_suite) { int argc=1; const char* argv[2]={"surface_mesh_viewer","\0"}; QApplication app(argc,const_cast(argv)); - SimpleSurfaceMeshViewerQt mainwindow(app.activeWindow(), - amesh, - title, - nofill, - fcolor); + DefaultColorFunctorSM fcolor; + SimpleSurfaceMeshViewerQt, DefaultColorFunctorSM> + mainwindow(app.activeWindow(), amesh, title, nofill, fcolor); mainwindow.show(); app.exec(); } } -template -void draw(const SM& amesh, const char* title, bool nofill) -{ - DefaultColorFunctorSM c; - draw(amesh, title, nofill, c); -} - -template -void draw(const SM& amesh, const char* title) -{ draw(amesh, title, false); } - -template -void draw(const SM& amesh) -{ draw(amesh, "Basic Surface_mesh Viewer"); } - } // End namespace CGAL #endif // CGAL_USE_BASIC_VIEWER diff --git a/Triangulation_2/include/CGAL/draw_triangulation_2.h b/Triangulation_2/include/CGAL/draw_triangulation_2.h index a1cfc460fdb..bc0e6a2a42f 100644 --- a/Triangulation_2/include/CGAL/draw_triangulation_2.h +++ b/Triangulation_2/include/CGAL/draw_triangulation_2.h @@ -26,6 +26,7 @@ #ifdef CGAL_USE_BASIC_VIEWER +#include #include namespace CGAL @@ -135,48 +136,35 @@ protected: bool m_nofaces; const ColorFunctor& m_fcolor; }; + +// Specialization of draw function. +#define CGAL_T2_TYPE CGAL::Triangulation_2 -template -void draw(const T2& at2, - const char* title, - bool nofill, - const ColorFunctor& fcolor) +template +void draw(const CGAL_T2_TYPE& at2, + const char* title="Triangulation_2 Basic Viewer", + bool nofill=false) { #if defined(CGAL_TEST_SUITE) bool cgal_test_suite=true; #else bool cgal_test_suite=false; #endif - + if (!cgal_test_suite) { int argc=1; const char* argv[2]={"t2_viewer","\0"}; - QApplication app(argc,const_cast(argv)); - SimpleTriangulation2ViewerQt mainwindow(app.activeWindow(), - at2, - title, - nofill, - fcolor); + QApplication app(argc,const_cast(argv)); + DefaultColorFunctorT2 fcolor; + SimpleTriangulation2ViewerQt + mainwindow(app.activeWindow(), at2, title, nofill, fcolor); mainwindow.show(); app.exec(); } } -template -void draw(const T2& at2, const char* title, bool nofill) -{ - DefaultColorFunctorT2 c; - draw(at2, title, nofill, c); -} - -template -void draw(const T2& at2, const char* title) -{ draw(at2, title, false); } - -template -void draw(const T2& at2) -{ draw(at2, "Basic T2 Viewer"); } +#undef CGAL_T2_TYPE } // End namespace CGAL diff --git a/Triangulation_3/include/CGAL/draw_triangulation_3.h b/Triangulation_3/include/CGAL/draw_triangulation_3.h index 709bd15924f..4294339f2d0 100644 --- a/Triangulation_3/include/CGAL/draw_triangulation_3.h +++ b/Triangulation_3/include/CGAL/draw_triangulation_3.h @@ -26,6 +26,7 @@ #ifdef CGAL_USE_BASIC_VIEWER +#include #include namespace CGAL @@ -141,49 +142,35 @@ protected: bool m_nofaces; const ColorFunctor& m_fcolor; }; - -template -void draw(const T3& at3, - const char* title, - bool nofill, - const ColorFunctor& fcolor) -{ +// Specialization of draw function. +#define CGAL_T3_TYPE CGAL::Triangulation_3 + +template +void draw(const CGAL_T3_TYPE& at3, + const char* title="T3 Basic Viewer", + bool nofill=false) +{ #if defined(CGAL_TEST_SUITE) bool cgal_test_suite=true; #else bool cgal_test_suite=false; #endif - + if (!cgal_test_suite) { int argc=1; const char* argv[2]={"t3_viewer","\0"}; QApplication app(argc,const_cast(argv)); - SimpleTriangulation3ViewerQt mainwindow(app.activeWindow(), - at3, - title, - nofill, - fcolor); + DefaultColorFunctorT3 fcolor; + SimpleTriangulation3ViewerQt + mainwindow(app.activeWindow(), at3, title, nofill, fcolor); mainwindow.show(); app.exec(); } } -template -void draw(const T3& at3, const char* title, bool nofill) -{ - DefaultColorFunctorT3 c; - draw(at3, title, nofill, c); -} - -template -void draw(const T3& at3, const char* title) -{ draw(at3, title, false); } - -template -void draw(const T3& at3) -{ draw(at3, "Basic T3 Viewer"); } +#undef CGAL_T3_TYPE } // End namespace CGAL