Merge pull request #2044 from sgiraudot/Polyhedron_demo-Reorganize_selection_widget-GF

Polyhedron demo: Reorganize selection plugin
This commit is contained in:
Laurent Rineau 2017-05-22 11:00:18 +02:00
commit fafa40b2e5
2 changed files with 509 additions and 469 deletions

View File

@ -105,7 +105,7 @@ public:
connect(ui_widget.validateButton, SIGNAL(clicked()), this, SLOT(on_validateButton_clicked())); connect(ui_widget.validateButton, SIGNAL(clicked()), this, SLOT(on_validateButton_clicked()));
connect(ui_widget.Expand_reduce_button, SIGNAL(clicked()), this, SLOT(on_Expand_reduce_button_clicked())); connect(ui_widget.Expand_reduce_button, SIGNAL(clicked()), this, SLOT(on_Expand_reduce_button_clicked()));
connect(ui_widget.Select_sharp_edges_button, SIGNAL(clicked()), this, SLOT(on_Select_sharp_edges_button_clicked())); connect(ui_widget.Select_sharp_edges_button, SIGNAL(clicked()), this, SLOT(on_Select_sharp_edges_button_clicked()));
connect(ui_widget.modeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_ModeBox_changed(int))); connect(ui_widget.selectionOrEuler, SIGNAL(currentChanged(int)), this, SLOT(on_SelectionOrEuler_changed(int)));
connect(ui_widget.editionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_editionBox_changed(int))); connect(ui_widget.editionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_editionBox_changed(int)));
ui_widget.Add_to_selection_button->hide(); ui_widget.Add_to_selection_button->hide();
@ -149,7 +149,7 @@ public Q_SLOTS:
connect(new_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*))); connect(new_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*)));
connect(new_item,SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)), this, SLOT(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*))); connect(new_item,SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)), this, SLOT(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)));
scene->setSelectedItem(item_id); scene->setSelectedItem(item_id);
on_ModeBox_changed(ui_widget.modeBox->currentIndex()); on_SelectionOrEuler_changed(ui_widget.selectionOrEuler->currentIndex());
if(last_mode == 0) if(last_mode == 0)
on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex()); on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex());
} }
@ -293,7 +293,7 @@ public Q_SLOTS:
// all other arrangements (putting inside selection_item_map), setting names etc, // all other arrangements (putting inside selection_item_map), setting names etc,
// other params (e.g. k_ring) will be set inside new_item_created // other params (e.g. k_ring) will be set inside new_item_created
Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw); Scene_polyhedron_selection_item* new_item = new Scene_polyhedron_selection_item(poly_item, mw);
ui_widget.modeBox->setCurrentIndex(last_mode); ui_widget.selectionOrEuler->setCurrentIndex(last_mode);
connectItem(new_item); connectItem(new_item);
} }
void on_LassoCheckBox_changed(bool b) void on_LassoCheckBox_changed(bool b)
@ -580,7 +580,7 @@ public Q_SLOTS:
return; return;
} }
void on_ModeBox_changed(int index) void on_SelectionOrEuler_changed(int index)
{ {
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>(); Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
if(selection_item) if(selection_item)
@ -590,15 +590,11 @@ public Q_SLOTS:
{ {
//Selection mode //Selection mode
case 0: case 0:
ui_widget.selection_groupBox->setVisible(true);
ui_widget.edition_groupBox->setVisible(false);
Q_EMIT set_operation_mode(-1); Q_EMIT set_operation_mode(-1);
on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex()); on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex());
break; break;
//Edition mode //Edition mode
case 1: case 1:
ui_widget.selection_groupBox->setVisible(false);
ui_widget.edition_groupBox->setVisible(true);
Q_EMIT save_handleType(); Q_EMIT save_handleType();
on_editionBox_changed(ui_widget.editionBox->currentIndex()); on_editionBox_changed(ui_widget.editionBox->currentIndex());
break; break;
@ -610,7 +606,7 @@ public Q_SLOTS:
Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>(); Scene_polyhedron_selection_item* selection_item = getSelectedItem<Scene_polyhedron_selection_item>();
if(selection_item) if(selection_item)
selection_item->on_Ctrlz_pressed(); selection_item->on_Ctrlz_pressed();
if(ui_widget.modeBox->currentIndex() == 0) if(ui_widget.selectionOrEuler->currentIndex() == 0)
{ {
Q_EMIT set_operation_mode(-1); Q_EMIT set_operation_mode(-1);
} }
@ -744,7 +740,7 @@ public Q_SLOTS:
connect(selection_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*))); connect(selection_item,SIGNAL(simplicesSelected(CGAL::Three::Scene_item*)), scene_ptr, SLOT(setSelectedItem(CGAL::Three::Scene_item*)));
connect(selection_item,SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)), this, SLOT(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*))); connect(selection_item,SIGNAL(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)), this, SLOT(isCurrentlySelected(Scene_polyhedron_item_k_ring_selection*)));
on_LassoCheckBox_changed(ui_widget.lassoCheckBox->isChecked()); on_LassoCheckBox_changed(ui_widget.lassoCheckBox->isChecked());
on_ModeBox_changed(ui_widget.modeBox->currentIndex()); on_SelectionOrEuler_changed(ui_widget.selectionOrEuler->currentIndex());
if(last_mode == 0) if(last_mode == 0)
on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex()); on_Selection_type_combo_box_changed(ui_widget.Selection_type_combo_box->currentIndex());
} }

View File

@ -6,62 +6,77 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>508</width> <width>597</width>
<height>713</height> <height>334</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Selection</string> <string>Selection</string>
</property> </property>
<widget class="QWidget" name="dockWidgetContents"> <widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_10" stretch="1,1"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QComboBox" name="modeBox"> <widget class="QPushButton" name="Create_selection_item_button">
<item> <property name="font">
<property name="text"> <font>
<string>Selection Mode</string> <weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
</item>
<item>
<property name="text"> <property name="text">
<string>Edition Mode</string> <string>Create Selection Item</string>
</property> </property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_2"> <widget class="QPushButton" name="Clear_all_button">
<property name="orientation"> <property name="toolTip">
<enum>Qt::Horizontal</enum> <string extracomment="Clear selection for All Types"/>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="text">
<size> <string>Clear Selection Item</string>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</spacer> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="selection_groupBox"> <spacer name="verticalSpacer_3">
<property name="title"> <property name="orientation">
<string>Selection Operations</string> <enum>Qt::Vertical</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <property name="sizeHint" stdset="0">
<item> <size>
<layout class="QVBoxLayout" name="verticalLayout_3"> <width>20</width>
<item> <height>40</height>
<widget class="QGroupBox" name="groupBox"> </size>
<property name="title">
<string>Selection by Type</string>
</property> </property>
</spacer>
</item>
<item>
<widget class="QTabWidget" name="selectionOrEuler">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Selection</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_11" stretch="0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Simplices</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,1"> <layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,1">
<item> <item>
@ -102,6 +117,21 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0,1,0,1">
<item> <item>
<widget class="QCheckBox" name="lassoCheckBox"> <widget class="QCheckBox" name="lassoCheckBox">
<property name="text"> <property name="text">
@ -109,8 +139,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="1,1,1">
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
@ -146,12 +174,19 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout> <item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -171,12 +206,6 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -193,69 +222,24 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="Select_all_button">
<property name="toolTip">
<string extracomment="Select all simplices of Selection Type"/>
</property>
<property name="text">
<string>Select &amp;All</string>
</property>
</widget> </widget>
</item> <widget class="QWidget" name="tab_2">
<item> <attribute name="title">
<widget class="QPushButton" name="Inverse_selection_button"> <string>Components</string>
<property name="toolTip"> </attribute>
<string extracomment="Invert selection for Selection Type"/> <layout class="QVBoxLayout" name="verticalLayout_3">
</property>
<property name="text">
<string>Invert Selection</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Clear_button">
<property name="toolTip">
<string extracomment="Clear selection for Selection Type"/>
</property>
<property name="text">
<string>&amp;Clear</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Isolated &amp;Component Size:</string> <string>Threshold:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>Threshold_size_spin_box</cstring> <cstring>Threshold_size_spin_box</cstring>
@ -264,6 +248,12 @@
</item> </item>
<item> <item>
<widget class="QSpinBox" name="Threshold_size_spin_box"> <widget class="QSpinBox" name="Threshold_size_spin_box">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum"> <property name="maximum">
<number>999999999</number> <number>999999999</number>
</property> </property>
@ -274,6 +264,12 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="Get_minimum_button"> <widget class="QPushButton" name="Get_minimum_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>&amp;Get Minimum</string> <string>&amp;Get Minimum</string>
</property> </property>
@ -282,16 +278,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QPushButton" name="Select_isolated_components_button"> <spacer name="verticalSpacer_7">
<property name="text">
<string>Select &amp;Isolated Components Below Threshold</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_1">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -304,7 +291,14 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <widget class="QPushButton" name="Select_isolated_components_button">
<property name="text">
<string>Select &amp;Isolated Components Below Threshold</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -353,36 +347,14 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Expand or reduce selection:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="Expand_reduce_spin_box">
<property name="minimum">
<number>-50</number>
</property>
<property name="maximum">
<number>50</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Expand_reduce_button">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout> </layout>
</widget>
</widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_2"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer_10">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -394,6 +366,86 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPushButton" name="Expand_reduce_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Expand/Reduce</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="Expand_reduce_spin_box">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>-50</number>
</property>
<property name="maximum">
<number>50</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="Clear_button">
<property name="toolTip">
<string extracomment="Clear selection for Selection Type"/>
</property>
<property name="text">
<string>&amp;Clear</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Inverse_selection_button">
<property name="toolTip">
<string extracomment="Invert selection for Selection Type"/>
</property>
<property name="text">
<string>Invert Selection</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Select_all_button">
<property name="toolTip">
<string extracomment="Select all simplices of Selection Type"/>
</property>
<property name="text">
<string>Select &amp;All</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_13" stretch="1,0"> <layout class="QHBoxLayout" name="horizontalLayout_13" stretch="1,0">
<item> <item>
@ -455,43 +507,31 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</item> <widget class="QWidget" name="tab_5">
<item> <attribute name="title">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <string>Edition</string>
<item> </attribute>
<widget class="QPushButton" name="Create_selection_item_button"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Create Selection Item</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Clear_all_button">
<property name="toolTip">
<string extracomment="Clear selection for All Types"/>
</property>
<property name="text">
<string>Clear Selection Item</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QGroupBox" name="edition_groupBox"> <widget class="QGroupBox" name="edition_groupBox">
<property name="title"> <property name="title">
<string>Editions Operations</string> <string>Euler Operations</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_9" stretch="0,1,0,0"> <layout class="QVBoxLayout" name="verticalLayout_9" stretch="0,1,0,0">
<item> <item>
@ -586,8 +626,12 @@
</layout> </layout>
</widget> </widget>
</item> </item>
</layout>
</widget>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_4"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>