diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index 3f82a3ffab7..dafcccb1695 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -15,7 +15,7 @@ #include Viewer::Viewer(QWidget* parent) : - Base(parent, NULL, ""), + Base(parent, nullptr, ""), m_previous_scene_empty(true) {} @@ -50,4 +50,3 @@ void Viewer::keyPressEvent(QKeyEvent *e) QString Viewer::helpString() const { return Base::helpString("LCC Demo"); } - diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 6f630b2c0b1..ea7a8e07dfe 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -170,13 +170,17 @@ public: // First draw: vertices; edges, faces; multi-color; inverse normal Base(parent, title, true, true, true, false, false), lcc(alcc), - m_oriented_mark(lcc->get_new_mark()), + m_oriented_mark(LCC::INVALID_MARK), m_nofaces(anofaces), m_random_face_color(false), m_drawing_functor(drawing_functor) { - lcc->orient(m_oriented_mark); - compute_elements(); + if (lcc!=nullptr) + { + lcc->get_new_mark(); + lcc->orient(m_oriented_mark); + compute_elements(); + } } ~SimpleLCCViewerQt() @@ -185,14 +189,20 @@ public: protected: void set_lcc(const LCC* alcc, bool doredraw=true) { + if (lcc==alcc) + { return; } + if (lcc!=nullptr) { lcc->free_mark(m_oriented_mark); } lcc=alcc; - m_oriented_mark=lcc->get_new_mark(); - lcc->orient(m_oriented_mark); + if (lcc!=nullptr) + { + m_oriented_mark=lcc->get_new_mark(); + lcc->orient(m_oriented_mark); + compute_elements(); + } - compute_elements(); if (doredraw) { redraw(); } }