mirror of https://github.com/CGAL/cgal
Merge pull request #8238 from MaelRL/Lab-Fix_components-GF
Fix CC selection in selection item
This commit is contained in:
commit
2c13f1fe6b
|
|
@ -211,8 +211,13 @@ public:
|
|||
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)));
|
||||
|
||||
ui_widget.Sharp_edges_label->hide();
|
||||
ui_widget.Sharp_angle_spinbox->hide();
|
||||
ui_widget.Select_sharp_edges_button->hide();
|
||||
ui_widget.Select_boundaryButton->hide();
|
||||
ui_widget.Add_to_selection_button->hide();
|
||||
ui_widget.Select_all_NTButton->hide();
|
||||
|
||||
QObject* scene = dynamic_cast<QObject*>(scene_interface);
|
||||
if(scene) {
|
||||
connect(scene, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*)));
|
||||
|
|
@ -544,55 +549,84 @@ public Q_SLOTS:
|
|||
for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it)
|
||||
{
|
||||
it->second->set_lasso_mode(b);
|
||||
ui_widget.Brush_label->setEnabled(!b);
|
||||
ui_widget.Brush_size_spin_box->setEnabled(!b);
|
||||
ui_widget.Brush_size_spin_box->setValue(0);
|
||||
}
|
||||
}
|
||||
void on_Selection_type_combo_box_changed(int index) {
|
||||
std::cout << "on_Selection_type_combo_box_changed(" << index << ")" << std::endl;
|
||||
|
||||
typedef Scene_polyhedron_selection_item::Active_handle Active_handle;
|
||||
for(Selection_item_map::iterator it = selection_item_map.begin(); it != selection_item_map.end(); ++it) {
|
||||
it->second->set_active_handle_type(static_cast<Active_handle::Type>(index));
|
||||
Q_EMIT save_handleType();
|
||||
|
||||
it->second->setPathSelection(false);
|
||||
|
||||
ui_widget.Sharp_edges_label->hide();
|
||||
ui_widget.Sharp_angle_spinbox->hide();
|
||||
ui_widget.Select_sharp_edges_button->hide();
|
||||
ui_widget.Select_boundaryButton->hide();
|
||||
ui_widget.Add_to_selection_button->hide();
|
||||
ui_widget.Select_all_NTButton->hide();
|
||||
|
||||
ui_widget.Get_minimum_button->setEnabled(false);
|
||||
ui_widget.Select_isolated_components_button->setEnabled(false);
|
||||
|
||||
switch(index)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 0: // vertex
|
||||
case 1: // face
|
||||
case 2: // edge
|
||||
ui_widget.lassoCheckBox->show();
|
||||
ui_widget.Brush_label->show();
|
||||
ui_widget.Brush_size_spin_box->show();
|
||||
|
||||
ui_widget.Get_minimum_button->setEnabled(true);
|
||||
ui_widget.Select_isolated_components_button->setEnabled(true);
|
||||
break;
|
||||
case 3: // CC of faces
|
||||
case 4: // Path of edges
|
||||
default:
|
||||
ui_widget.lassoCheckBox->hide();
|
||||
ui_widget.lassoCheckBox->setChecked(false);
|
||||
it->second->set_lasso_mode(false);
|
||||
ui_widget.Brush_label->hide();
|
||||
ui_widget.Brush_size_spin_box->hide();
|
||||
ui_widget.Brush_size_spin_box->setValue(0);
|
||||
break;
|
||||
}
|
||||
if(index == 1)
|
||||
|
||||
if(index == 0) // vertex
|
||||
{
|
||||
Q_EMIT set_operation_mode(-1);
|
||||
}
|
||||
else if(index == 1) // face
|
||||
{
|
||||
ui_widget.Select_all_NTButton->show();
|
||||
ui_widget.Add_to_selection_button->hide();
|
||||
ui_widget.Select_boundaryButton->hide();
|
||||
Q_EMIT set_operation_mode(-1);
|
||||
}
|
||||
else if(index == 2)
|
||||
else if(index == 2) // edge
|
||||
{
|
||||
ui_widget.Select_all_NTButton->hide();
|
||||
ui_widget.Add_to_selection_button->hide();
|
||||
ui_widget.Select_boundaryButton->show();
|
||||
ui_widget.Sharp_angle_spinbox->show();
|
||||
ui_widget.Select_sharp_edges_button->show();
|
||||
Q_EMIT set_operation_mode(-1);
|
||||
}
|
||||
else if(index == 4)
|
||||
else if(index == 3) // CC of faces
|
||||
{
|
||||
Q_EMIT set_operation_mode(-1);
|
||||
}
|
||||
else if(index == 4) // Path of edges
|
||||
{
|
||||
it->second->setPathSelection(true);
|
||||
ui_widget.Select_all_NTButton->hide();
|
||||
ui_widget.Add_to_selection_button->show();
|
||||
ui_widget.Select_boundaryButton->show();
|
||||
Q_EMIT set_operation_mode(-2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_widget.Add_to_selection_button->hide();
|
||||
ui_widget.Select_all_NTButton->hide();
|
||||
ui_widget.Select_boundaryButton->hide();
|
||||
it->second->setPathSelection(false);
|
||||
Q_EMIT set_operation_mode(-1);
|
||||
std::cerr << "Error: unknown selection type" << std::endl;
|
||||
}
|
||||
}
|
||||
filter_operations();
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>613</width>
|
||||
<height>409</height>
|
||||
<width>630</width>
|
||||
<height>532</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -21,7 +21,6 @@
|
|||
<widget class="QPushButton" name="Create_selection_item_button">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
|
@ -30,20 +29,20 @@
|
|||
</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</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hl_checkBox">
|
||||
<property name="text">
|
||||
<string>Show selector</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
@ -57,16 +56,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hl_checkBox">
|
||||
<property name="text">
|
||||
<string>Highlight</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
@ -79,6 +68,46 @@
|
|||
<string>Selection</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Selection Type :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="Selection_type_combo_box">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertex</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Facet</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Edge</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Facet Connected Component</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Edge Path Between Vertices</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
|
|
@ -92,42 +121,55 @@
|
|||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Selection Type :</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Insertion_radio_button">
|
||||
<property name="text">
|
||||
<string>Insertion</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Removal_radio_button">
|
||||
<property name="text">
|
||||
<string>Removal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="Selection_type_combo_box">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertex</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="lassoCheckBox">
|
||||
<property name="text">
|
||||
<string>Lasso</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLabel" name="Brush_label">
|
||||
<property name="text">
|
||||
<string>Brush &size:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>Brush_size_spin_box</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Facet</string>
|
||||
</property>
|
||||
<widget class="QSpinBox" name="Brush_size_spin_box"/>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Edge</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Connected Component (Facet)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Path Between Vertices</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
@ -145,36 +187,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0,1,0,1">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lassoCheckBox">
|
||||
<property name="text">
|
||||
<string>Lasso</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11" stretch="0">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_all_NTButton">
|
||||
<property name="text">
|
||||
<string>Select All Non Triangle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_boundaryButton">
|
||||
<property name="text">
|
||||
|
|
@ -182,21 +197,78 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<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_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="Sharp_edges_label">
|
||||
<property name="text">
|
||||
<string>Sharp edges angle:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="Sharp_angle_spinbox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>180</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>60</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_sharp_edges_button">
|
||||
<property name="text">
|
||||
<string>Select</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Add_to_selection_button">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Path to Selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_all_NTButton">
|
||||
<property name="text">
|
||||
<string>Select All Non Triangle Facets</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Add_to_selection_button">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add to Selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
@ -212,40 +284,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Insertion_radio_button">
|
||||
<property name="text">
|
||||
<string>Insertion</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Removal_radio_button">
|
||||
<property name="text">
|
||||
<string>Removal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Brush &size:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>Brush_size_spin_box</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="Brush_size_spin_box"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
|
|
@ -253,55 +291,6 @@
|
|||
<string>Components</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<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">
|
||||
<string>Threshold:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>Threshold_size_spin_box</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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">
|
||||
<string>&Get Minimum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
|
|
@ -316,11 +305,64 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_isolated_components_button">
|
||||
<property name="text">
|
||||
<string>Select &Isolated Components Below Threshold</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<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">
|
||||
<string>Threshold:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>Threshold_size_spin_box</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<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">
|
||||
<string>Set Threshold to Simplex Count of Smallest CC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_isolated_components_button">
|
||||
<property name="text">
|
||||
<string>Select CCs With Simplex Count Below Threshold</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
|
|
@ -335,43 +377,6 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Sharp edges angle:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="Sharp_angle_spinbox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>180</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>60</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_sharp_edges_button">
|
||||
<property name="text">
|
||||
<string>Select</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
@ -432,12 +437,12 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Clear_button">
|
||||
<widget class="QPushButton" name="Select_all_button">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Clear selection for Selection Type"/>
|
||||
<string extracomment="Select all simplices of Selection Type"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Clear Current Type</string>
|
||||
<string>Select &All Current Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -452,12 +457,22 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_all_button">
|
||||
<widget class="QPushButton" name="Clear_button">
|
||||
<property name="toolTip">
|
||||
<string extracomment="Select all simplices of Selection Type"/>
|
||||
<string extracomment="Clear selection for Selection Type"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select &All</string>
|
||||
<string>&Clear Current Type</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 All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -638,7 +653,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="instructionsLabel">
|
||||
<property name="text">
|
||||
<string>Instructions
|
||||
<string>Instructions
|
||||
|
||||
</string>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>547</width>
|
||||
<height>347</height>
|
||||
<width>561</width>
|
||||
<height>294</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -135,45 +135,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8" stretch="0,1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Isolated Component Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="Threshold_size_spin_box">
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Get_minimum_button">
|
||||
<property name="text">
|
||||
<string>Get Minimum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Select_isolated_components_button">
|
||||
<property name="text">
|
||||
<string>Select Isolated Components Below Threshold</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ public Q_SLOTS:
|
|||
void on_SaveROIPushButton_clicked();
|
||||
void on_ReadROIPushButton_clicked();
|
||||
void dock_widget_visibility_changed(bool visible);
|
||||
void on_Select_isolated_components_button_clicked();
|
||||
void on_Get_minimum_button_clicked();
|
||||
|
||||
void on_BrushSpinBoxCtrlVert_changed(int);
|
||||
void on_BrushSpinBoxRoi_changed(int);
|
||||
|
|
@ -150,8 +148,6 @@ void CGAL_Lab_edit_cgal_lab_plugin::init(QMainWindow* mainWindow, CGAL::Three::S
|
|||
connect(ui_widget.ActivateFixedPlaneCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivateFixedPlaneCheckBox_stateChanged(int)));
|
||||
connect(ui_widget.ActivatePivotingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(on_ActivatePivotingCheckBox_stateChanged(int)));
|
||||
connect(ui_widget.OverwritePushButton, SIGNAL(clicked()), this, SLOT(on_OverwritePushButton_clicked()));
|
||||
connect(ui_widget.Select_isolated_components_button, SIGNAL(clicked()), this, SLOT(on_Select_isolated_components_button_clicked()));
|
||||
connect(ui_widget.Get_minimum_button, SIGNAL(clicked()), this, SLOT(on_Get_minimum_button_clicked()));
|
||||
|
||||
connect(ui_widget.SaveROIPushButton, SIGNAL(clicked()), this, SLOT(on_SaveROIPushButton_clicked()));
|
||||
connect(ui_widget.ReadROIPushButton, SIGNAL(clicked()), this, SLOT(on_ReadROIPushButton_clicked()));
|
||||
|
|
@ -304,28 +300,6 @@ void CGAL_Lab_edit_cgal_lab_plugin::on_OverwritePushButton_clicked()
|
|||
|
||||
edit_item->overwrite_deform_object();
|
||||
}
|
||||
void CGAL_Lab_edit_cgal_lab_plugin::on_Select_isolated_components_button_clicked() {
|
||||
int item_id = scene->selectionIndices().front();
|
||||
Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
|
||||
if(!edit_item) return; // the selected item is not of the right type
|
||||
|
||||
std::optional<std::size_t> minimum =
|
||||
edit_item->select_isolated_components(ui_widget.Threshold_size_spin_box->value());
|
||||
if(minimum) {
|
||||
ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
|
||||
}
|
||||
}
|
||||
|
||||
void CGAL_Lab_edit_cgal_lab_plugin::on_Get_minimum_button_clicked() {
|
||||
int item_id = scene->selectionIndices().front();
|
||||
Scene_edit_polyhedron_item* edit_item = qobject_cast<Scene_edit_polyhedron_item*>(scene->item(item_id));
|
||||
if(!edit_item) return; // the selected item is not of the right type
|
||||
|
||||
std::optional<std::size_t> minimum = edit_item->get_minimum_isolated_component();
|
||||
if(minimum) {
|
||||
ui_widget.Threshold_size_spin_box->setValue((int) *minimum);
|
||||
}
|
||||
}
|
||||
|
||||
void CGAL_Lab_edit_cgal_lab_plugin::on_SaveROIPushButton_clicked()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1621,28 +1621,6 @@ void Scene_edit_polyhedron_item::reset_deform_object()
|
|||
refresh_all_group_centers();
|
||||
}
|
||||
|
||||
std::optional<std::size_t> Scene_edit_polyhedron_item::get_minimum_isolated_component() {
|
||||
Travel_isolated_components<SMesh>::Minimum_visitor visitor;
|
||||
Travel_isolated_components<SMesh>(*surface_mesh()).travel<sm_vertex_descriptor>
|
||||
(vertices(*surface_mesh()).first, vertices(*surface_mesh()).second,
|
||||
num_vertices(*surface_mesh()), Is_selected<SMesh>(d->deform_sm_mesh), visitor);
|
||||
return visitor.minimum;
|
||||
}
|
||||
|
||||
|
||||
std::optional<std::size_t> Scene_edit_polyhedron_item::select_isolated_components(std::size_t threshold) {
|
||||
typedef boost::function_output_iterator<Select_roi_output<SMesh> > Output_iterator;
|
||||
Output_iterator out(d->deform_sm_mesh);
|
||||
|
||||
Travel_isolated_components<SMesh>::Selection_visitor<Output_iterator> visitor(threshold, out);
|
||||
Travel_isolated_components<SMesh>(*surface_mesh()).travel<sm_vertex_descriptor>
|
||||
(vertices(*surface_mesh()).first, vertices(*surface_mesh()).second,
|
||||
num_vertices(*surface_mesh()), Is_selected<SMesh>(d->deform_sm_mesh), visitor);
|
||||
|
||||
if(visitor.any_inserted) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
|
||||
return visitor.minimum_visitor.minimum;
|
||||
}
|
||||
|
||||
bool Scene_edit_polyhedron_item::is_there_any_ctrl_vertices_group()
|
||||
{
|
||||
if(d->sm_item)
|
||||
|
|
|
|||
|
|
@ -379,7 +379,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
std::optional<std::size_t> get_minimum_isolated_component();
|
||||
template<typename Mesh>
|
||||
struct Select_roi_output{
|
||||
typedef typename CGAL::Surface_mesh_deformation<Mesh, CGAL::Default, CGAL::Default, CGAL::ORIGINAL_ARAP
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ public:
|
|||
Selection_traits<HandleType, Scene_polyhedron_selection_item> tr(this);
|
||||
Travel_isolated_components<Face_graph>::Minimum_visitor visitor;
|
||||
Travel_isolated_components<Face_graph>(*polyhedron()).travel<HandleType>
|
||||
(tr.iterator_begin(), tr.iterator_end(), tr.size(), tr.container(), visitor);
|
||||
(tr.iterator_begin(), tr.iterator_end(), tr.size(), visitor);
|
||||
return visitor.minimum;
|
||||
}
|
||||
|
||||
|
|
@ -516,7 +516,8 @@ public:
|
|||
}
|
||||
}
|
||||
template<class HandleType> // use fg_vertex_descriptor, fg_face_descriptor, fg_edge_descriptor
|
||||
std::optional<std::size_t> select_isolated_components(std::size_t threshold) {
|
||||
std::optional<std::size_t> select_isolated_components(std::size_t threshold)
|
||||
{
|
||||
typedef Selection_traits<HandleType, Scene_polyhedron_selection_item> Tr;
|
||||
Tr tr(this);
|
||||
typedef std::insert_iterator<typename Tr::Container> Output_iterator;
|
||||
|
|
@ -524,7 +525,7 @@ public:
|
|||
|
||||
Travel_isolated_components<Face_graph>::Selection_visitor<Output_iterator> visitor(threshold , out);
|
||||
Travel_isolated_components<Face_graph>(*polyhedron()).travel<HandleType>
|
||||
(tr.iterator_begin(), tr.iterator_end(), tr.size(), tr.container(), visitor);
|
||||
(tr.iterator_begin(), tr.iterator_end(), tr.size(), visitor);
|
||||
|
||||
if(visitor.any_inserted) { invalidateOpenGLBuffers(); Q_EMIT itemChanged(); }
|
||||
return visitor.minimum_visitor.minimum;
|
||||
|
|
|
|||
|
|
@ -110,11 +110,10 @@ public:
|
|||
}
|
||||
*/
|
||||
// NOTE: prior to call this function, id fields should be updated
|
||||
template<class Descriptor, class InputIterator, class IsSelected, class Visitor>
|
||||
template<class Descriptor, class InputIterator, class Visitor>
|
||||
void travel(InputIterator begin,
|
||||
InputIterator end,
|
||||
std::size_t size,
|
||||
const IsSelected& selection,
|
||||
Visitor& visitor)
|
||||
{
|
||||
std::vector<bool> mark(size, false);
|
||||
|
|
@ -123,28 +122,29 @@ public:
|
|||
{
|
||||
Descriptor h = *begin;
|
||||
|
||||
if(mark[id(h)] || selection.count(h)) { continue; }
|
||||
if(mark[id(h)])
|
||||
continue;
|
||||
|
||||
std::vector<Descriptor> C;
|
||||
C.push_back(h);
|
||||
mark[id(h)] = true;
|
||||
std::size_t current_index = 0;
|
||||
|
||||
bool neigh_to_selection = false;
|
||||
while(current_index < C.size()) {
|
||||
Descriptor current = C[current_index++];
|
||||
|
||||
for(One_ring_iterator<Mesh, Descriptor> circ(current, mesh); circ; ++circ)
|
||||
{
|
||||
Descriptor nv = circ;
|
||||
neigh_to_selection |= (selection.count(nv)!=0);
|
||||
if(!mark[id(nv)] && !selection.count(nv)) {
|
||||
if(!mark[id(nv)])
|
||||
{
|
||||
mark[id(nv)] = true;
|
||||
C.push_back(nv);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(neigh_to_selection) { visitor(C); }
|
||||
|
||||
visitor(C);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue