mirror of https://github.com/CGAL/cgal
remove warning
fixed crash when estimating normals from context menu
This commit is contained in:
parent
a43efbfdb3
commit
42d8c22d7c
|
|
@ -146,6 +146,7 @@ public:
|
||||||
connect(dock_widget->partRunButton, SIGNAL(clicked(bool)), this, SLOT(run_partition()));
|
connect(dock_widget->partRunButton, SIGNAL(clicked(bool)), this, SLOT(run_partition()));
|
||||||
connect(dock_widget->recRunButton, SIGNAL(clicked(bool)), this, SLOT(run_reconstruction()));
|
connect(dock_widget->recRunButton, SIGNAL(clicked(bool)), this, SLOT(run_reconstruction()));
|
||||||
connect(dock_widget->partSubdivisionCheck, SIGNAL(stateChanged(int)), this, SLOT(onSubdivisionStateChanged(int)));
|
connect(dock_widget->partSubdivisionCheck, SIGNAL(stateChanged(int)), this, SLOT(onSubdivisionStateChanged(int)));
|
||||||
|
connect(dock_widget, SIGNAL(visibilityChanged(bool)), this, SLOT(onVisibilityChanged(bool)));
|
||||||
}
|
}
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void openDialog()
|
void openDialog()
|
||||||
|
|
@ -165,6 +166,9 @@ private Q_SLOTS:
|
||||||
}
|
}
|
||||||
|
|
||||||
void onItemIndexSelected(int item_index) {
|
void onItemIndexSelected(int item_index) {
|
||||||
|
if (!dock_widget->isVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
Scene_points_with_normal_item *selection = qobject_cast<Scene_points_with_normal_item*>(scene->item(item_index));
|
Scene_points_with_normal_item *selection = qobject_cast<Scene_points_with_normal_item*>(scene->item(item_index));
|
||||||
if (selection == nullptr) {
|
if (selection == nullptr) {
|
||||||
// Keep old reference if no new point cloud has been selected.
|
// Keep old reference if no new point cloud has been selected.
|
||||||
|
|
@ -223,8 +227,7 @@ private Q_SLOTS:
|
||||||
void onItemChanged() {
|
void onItemChanged() {
|
||||||
// Enable detection if the point set item has normals now
|
// Enable detection if the point set item has normals now
|
||||||
assert(m_pwn_item);
|
assert(m_pwn_item);
|
||||||
Point_set* points = m_pwn_item->point_set();
|
|
||||||
std::cout << "item changed" << std::endl;
|
|
||||||
if (m_pwn_item->has_normals())
|
if (m_pwn_item->has_normals())
|
||||||
enable_detection(true);
|
enable_detection(true);
|
||||||
}
|
}
|
||||||
|
|
@ -357,6 +360,12 @@ private Q_SLOTS:
|
||||||
dock_widget->partPolygonsPerNodeBox->setEnabled(state != 0);
|
dock_widget->partPolygonsPerNodeBox->setEnabled(state != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onVisibilityChanged(bool visibility) {
|
||||||
|
if (!dock_widget->isVisible())
|
||||||
|
return;
|
||||||
|
std::cout << "in visibility changed" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void convex_hull(const std::vector<std::size_t>& region, const CGAL::Epick::Plane_3& plane, std::vector<std::vector<CGAL::Epick::Point_3> > &polys) {
|
void convex_hull(const std::vector<std::size_t>& region, const CGAL::Epick::Plane_3& plane, std::vector<std::vector<CGAL::Epick::Point_3> > &polys) {
|
||||||
if (m_pwn_item == nullptr)
|
if (m_pwn_item == nullptr)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ CGAL::Three::Scene_item::Scene_item(int buffers_size, int vaos_size)
|
||||||
are_buffers_filled(false),
|
are_buffers_filled(false),
|
||||||
rendering_mode(FlatPlusEdges),
|
rendering_mode(FlatPlusEdges),
|
||||||
defaultContextMenu(nullptr),
|
defaultContextMenu(nullptr),
|
||||||
|
context_menu_outdated(false),
|
||||||
buffersSize(buffers_size),
|
buffersSize(buffers_size),
|
||||||
vaosSize(vaos_size),
|
vaosSize(vaos_size),
|
||||||
vaos(vaos_size)
|
vaos(vaos_size)
|
||||||
|
|
@ -94,6 +95,11 @@ QString CGAL::Three::Scene_item::renderingModeName() const
|
||||||
}
|
}
|
||||||
QMenu* CGAL::Three::Scene_item::contextMenu()
|
QMenu* CGAL::Three::Scene_item::contextMenu()
|
||||||
{
|
{
|
||||||
|
if (context_menu_outdated && defaultContextMenu) {
|
||||||
|
delete defaultContextMenu;
|
||||||
|
defaultContextMenu = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if(defaultContextMenu) {
|
if(defaultContextMenu) {
|
||||||
defaultContextMenu->setTitle(name());
|
defaultContextMenu->setTitle(name());
|
||||||
return defaultContextMenu;
|
return defaultContextMenu;
|
||||||
|
|
@ -111,14 +117,17 @@ QMenu* CGAL::Three::Scene_item::contextMenu()
|
||||||
slotName(RenderingMode(mode)));
|
slotName(RenderingMode(mode)));
|
||||||
defaultContextMenu->actions().last()->setProperty("is_groupable", true);
|
defaultContextMenu->actions().last()->setProperty("is_groupable", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context_menu_outdated = false;
|
||||||
|
|
||||||
return defaultContextMenu;
|
return defaultContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGAL::Three::Scene_item::resetMenu()
|
void CGAL::Three::Scene_item::resetMenu()
|
||||||
{
|
{
|
||||||
delete defaultContextMenu;
|
context_menu_outdated = true;
|
||||||
defaultContextMenu = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL::Three::Scene_group_item* CGAL::Three::Scene_item::parentGroup() const {
|
CGAL::Three::Scene_group_item* CGAL::Three::Scene_item::parentGroup() const {
|
||||||
return parent_group;
|
return parent_group;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -443,6 +443,8 @@ protected:
|
||||||
RenderingMode rendering_mode;
|
RenderingMode rendering_mode;
|
||||||
//!The default context menu.
|
//!The default context menu.
|
||||||
QMenu* defaultContextMenu;
|
QMenu* defaultContextMenu;
|
||||||
|
//!Specifies if the context menu should be rebuild on the next call.
|
||||||
|
bool context_menu_outdated = false;
|
||||||
/*! Contains the previous RenderingMode.
|
/*! Contains the previous RenderingMode.
|
||||||
* This is used to determine if invalidateOpenGLBuffers should be called or not
|
* This is used to determine if invalidateOpenGLBuffers should be called or not
|
||||||
* in certain cases.
|
* in certain cases.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue