Roll back draw_linear_cell_complex.h

This commit is contained in:
Thien Hoang 2019-08-11 10:46:25 +07:00
parent 9975cadefd
commit aa1907bf93
1 changed files with 29 additions and 32 deletions

View File

@ -25,6 +25,7 @@
#ifdef CGAL_USE_BASIC_VIEWER #ifdef CGAL_USE_BASIC_VIEWER
#include <CGAL/Linear_cell_complex_operations.h>
#include <CGAL/Random.h> #include <CGAL/Random.h>
namespace CGAL namespace CGAL
@ -170,7 +171,7 @@ public:
/// @param anofaces if true, do not draw faces (faces are not computed; this can be /// @param anofaces if true, do not draw faces (faces are not computed; this can be
/// usefull for very big object where this time could be long) /// usefull for very big object where this time could be long)
SimpleLCCViewerQt(QWidget* parent, SimpleLCCViewerQt(QWidget* parent,
const LCC* alcc=NULL, const LCC* alcc=nullptr,
const char* title="Basic LCC Viewer", const char* title="Basic LCC Viewer",
bool anofaces=false, bool anofaces=false,
const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) : const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) :
@ -244,7 +245,7 @@ protected:
Point p1 = lcc->point(dh); Point p1 = lcc->point(dh);
Dart_const_handle d2 = lcc->other_extremity(dh); Dart_const_handle d2 = lcc->other_extremity(dh);
if (d2!=NULL) if (d2!=nullptr)
{ {
if (m_drawing_functor.colored_edge(*lcc, dh)) if (m_drawing_functor.colored_edge(*lcc, dh))
{ add_segment(p1, lcc->point(d2), m_drawing_functor.edge_color(*lcc, dh)); } { add_segment(p1, lcc->point(d2), m_drawing_functor.edge_color(*lcc, dh)); }
@ -266,7 +267,7 @@ protected:
void compute_elements() void compute_elements()
{ {
clear(); clear();
if (lcc==NULL) return; if (lcc==nullptr) return;
typename LCC::size_type markvolumes = lcc->get_new_mark(); typename LCC::size_type markvolumes = lcc->get_new_mark();
typename LCC::size_type markfaces = lcc->get_new_mark(); typename LCC::size_type markfaces = lcc->get_new_mark();
@ -371,51 +372,47 @@ protected:
bool m_random_face_color; bool m_random_face_color;
const DrawingFunctorLCC& m_drawing_functor; const DrawingFunctorLCC& m_drawing_functor;
}; };
template<class LCC, class DrawingFunctorLCC> // Specialization of draw function.
void draw(const LCC& alcc, #define CGAL_LCC_TYPE CGAL::Linear_cell_complex_base \
const char* title, <d_, ambient_dim, Traits_, Items_, Alloc_, Map, Refs, Storage_>
bool nofill,
const DrawingFunctorLCC& drawing_functor) template < unsigned int d_, unsigned int ambient_dim,
class Traits_,
class Items_,
class Alloc_,
template<unsigned int,class,class,class,class>
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) #if defined(CGAL_TEST_SUITE)
bool cgal_test_suite=true; bool cgal_test_suite=true;
#else #else
bool cgal_test_suite=false; bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE");
#endif #endif
if (!cgal_test_suite) if (!cgal_test_suite)
{ {
int argc=1; int argc=1;
const char* argv[2]={"lccviewer","\0"}; const char* argv[2]={"lccviewer","\0"};
QApplication app(argc,const_cast<char**>(argv)); QApplication app(argc,const_cast<char**>(argv));
SimpleLCCViewerQt<LCC, DrawingFunctorLCC> mainwindow(app.activeWindow(), DefaultDrawingFunctorLCC fcolor;
&alcc, SimpleLCCViewerQt<CGAL_LCC_TYPE, DefaultDrawingFunctorLCC>
title, mainwindow(app.activeWindow(), &alcc, title, nofill, fcolor);
nofill,
drawing_functor);
mainwindow.show(); mainwindow.show();
app.exec(); app.exec();
} }
} }
template<class LCC> // Todo a function taking a const DrawingFunctorLCC& drawing_functor as parameter
void draw(const LCC& alcc, const char* title, bool nofill) #undef CGAL_LCC_TYPE
{
DefaultDrawingFunctorLCC f;
draw(alcc, title, nofill, f);
}
template<class LCC>
void draw(const LCC& alcc, const char* title)
{ draw(alcc, title, false); }
template<class LCC>
void draw(const LCC& alcc)
{ draw(alcc, "Basic LCC Viewer"); }
} // End namespace CGAL } // End namespace CGAL
#endif // CGAL_USE_BASIC_VIEWER #endif // CGAL_USE_BASIC_VIEWER
#endif // CGAL_DRAW_LCC_H #endif // CGAL_DRAW_LCC_H