diff --git a/Linear_cell_complex/include/CGAL/LCC_with_paths.h b/Linear_cell_complex/include/CGAL/LCC_with_paths.h index 519afc7deb6..3bf0054de5a 100644 --- a/Linear_cell_complex/include/CGAL/LCC_with_paths.h +++ b/Linear_cell_complex/include/CGAL/LCC_with_paths.h @@ -86,15 +86,18 @@ public: /// usefull for very big object where this time could be long) LCC_with_path_viewer(const LCC& alcc, const std::vector*>& paths, + std::size_t amark=LCC::INVALID_MARK, const char* title="", bool anofaces=false, const ColorFunctor& fcolor=ColorFunctor()) : Base(title), lcc(alcc), + m_nofaces(anofaces), + m_fcolor(fcolor), m_paths(paths), m_current_path(m_paths.size()), m_current_dart(alcc.number_of_darts()), - m_nofaces(anofaces), - m_fcolor(fcolor) + m_draw_marked_darts(true), + m_amark(amark) { compute_elements(); } protected: @@ -137,10 +140,8 @@ protected: for (unsigned int i=0; imodifiers(); - if ((e->key()==::Qt::Key_N) && (modifiers==::Qt::NoButton)) - { - m_current_path=(m_current_path+1)%(m_paths.size()+1); - if (m_current_path==m_paths.size()) - { - displayMessage(QString("Draw all paths.")); - } - else - { - displayMessage(QString("Draw path=%1.").arg((m_current_path))); - } - compute_elements(); - initialize_buffers(); - compile_shaders(); - updateGL(); - } - else if ((e->key()==::Qt::Key_D) && (modifiers==::Qt::NoButton)) + + if ((e->key()==::Qt::Key_D) && (modifiers==::Qt::NoButton)) { m_current_dart=(m_current_dart+1)%(lcc.number_of_darts()+1); if (m_current_dart==lcc.number_of_darts()) @@ -252,6 +244,35 @@ protected: compile_shaders(); updateGL(); } + else if ((e->key()==::Qt::Key_M) && (modifiers==::Qt::NoButton)) + { + m_draw_marked_darts=!m_draw_marked_darts; + + if (m_draw_marked_darts) + { displayMessage(QString("Draw marked darts in blue.")); } + else + { + displayMessage(QString("Do not draw marked darts in different color.")); + } + compute_elements(); + initialize_buffers(); + compile_shaders(); + updateGL(); + } + else if ((e->key()==::Qt::Key_N) && (modifiers==::Qt::NoButton)) + { + m_current_path=(m_current_path+1)%(m_paths.size()+2); + if (m_current_path==m_paths.size()) + { displayMessage(QString("Draw all paths.")); } + else if (m_current_path==m_paths.size()+1) + { displayMessage(QString("Do not draw paths.")); } + else + { displayMessage(QString("Draw path=%1.").arg((m_current_path))); } + compute_elements(); + initialize_buffers(); + compile_shaders(); + updateGL(); + } else if ((e->key()==::Qt::Key_P) && (modifiers==::Qt::NoButton)) { m_current_dart=(m_current_dart==0?lcc.number_of_darts():m_current_dart-1); @@ -298,12 +319,15 @@ protected: const std::vector*>& m_paths; unsigned int m_current_path; unsigned int m_current_dart; + bool m_draw_marked_darts; + std::size_t m_amark; // If !=INVALID_MARK, show darts marked with this mark }; template void display(const LCC& alcc, std::vector*> paths, const char* title="LCC Viewer", + std::size_t amark=LCC::INVALID_MARK, bool nofill=false, const ColorFunctor& fcolor=ColorFunctor()) { @@ -312,7 +336,8 @@ void display(const LCC& alcc, const char* argv[2]={"lccviewer","\0"}; QApplication app(argc,const_cast(argv)); - LCC_with_path_viewer mainwindow(alcc, paths, title, nofill, fcolor); + LCC_with_path_viewer mainwindow(alcc, paths, amark, + title, nofill, fcolor); mainwindow.show(); app.exec(); @@ -322,8 +347,9 @@ template void display(const LCC& alcc, std::vector*> paths, const char* title="LCC Viewer", + std::size_t amark=LCC::INVALID_MARK, bool nofill=false) -{ return display(alcc, paths, title, nofill); } +{ return display(alcc, paths, title, amark, nofill); } } // End namespace CGAL