Bug fix in lcc basic viewer when lcc is null

This commit is contained in:
Guillaume Damiand 2021-01-12 18:24:43 +01:00
parent 6f8f790ae9
commit f506515008
2 changed files with 17 additions and 8 deletions

View File

@ -15,7 +15,7 @@
#include <CGAL/Qt/vec.h>
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"); }

View File

@ -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(); }
}