Fix UI + fix connections

This commit is contained in:
Mael Rouxel-Labbé 2023-08-02 13:26:02 +02:00
parent 41bddc72d6
commit b6cc7cabc5
2 changed files with 209 additions and 174 deletions

View File

@ -3,7 +3,7 @@
<class>DisplayPropertyWidget</class>
<widget class="QDockWidget" name="DisplayPropertyWidget">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="geometry">
<rect>
@ -39,9 +39,18 @@
</item>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="propertyGroup">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Property</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>6</number>
@ -82,174 +91,47 @@
</item>
</widget>
</item>
<item>
<widget class="QSlider" name="expandingRadiusSlider">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="expandingRadiusLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Expanding Radius: 0</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="ColoringGroup" columnstretch="50,50">
<item row="0" column="0">
<spacer name="verticalSpacer">
<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 row="1" column="0">
<widget class="QGroupBox" name="coloringChoiceGroup">
<property name="title">
<string>Color Visualization</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="50,50">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="8" column="0">
<widget class="QRadioButton" name="randomColorsRadioButton">
<property name="text">
<string>Random colors</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="minColorButton">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="initColorLabel">
<property name="text">
<string>First color</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="maxColorLabel">
<property name="text">
<string>Max color</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="colorRampRadioButton">
<property name="text">
<string>Color Ramp</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QPushButton" name="initColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="maxColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="minColorLabel">
<property name="text">
<string>Min color</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSlider" name="expandingRadiusSlider">
<property name="minimum">
<float>0</float>
</property>
<property name="maximum">
<float>100</float>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="expandingRadiusLabel">
<property name="text">
<string>Expanding Radius: 0</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<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 row="0" column="1" rowspan="3">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>236</width>
<height>397</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="legendLabel">
<property name="text">
<string>RAMP DISPLAYING</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item row="11" column="0">
<widget class="QGroupBox" name="extremeValuesGroup">
<property name="enabled">
@ -313,6 +195,148 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="ColoringGroup" columnstretch="0,0">
<item row="6" column="0">
<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 row="4" column="1" rowspan="3">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>236</width>
<height>335</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="legendLabel">
<property name="text">
<string>RAMP DISPLAYING</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="coloringChoiceGroup">
<property name="title">
<string>Color Visualization</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="50,50">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="5" column="1">
<widget class="QPushButton" name="maxColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="maxColorLabel">
<property name="text">
<string>Max color</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="minColorButton">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="colorRampRadioButton">
<property name="text">
<string>Color Ramp</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QPushButton" name="initColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="minColorLabel">
<property name="text">
<string>Min color</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="initColorLabel">
<property name="text">
<string>First color</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QRadioButton" name="randomColorsRadioButton">
<property name="text">
<string>Random colors</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<layout class="QGridLayout" name="gridLayout_6"/>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<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>
</widget>
</widget>

View File

@ -89,8 +89,8 @@ private:
double gI = 1.;
double bI = 0.;
double expand_radius = 0;
double maxEdgeLength = -1;
double expand_radius = 0.;
double maxEdgeLength = -1.;
Color_ramp color_ramp;
std::vector<QColor> color_map;
@ -209,8 +209,8 @@ public:
connect(dock_widget->zoomToMaxButton, &QPushButton::pressed,
this, &Display_property_plugin::on_zoomToMaxButton_pressed);
connect(dock_widget->expandingRadiusSlider, SIGNAL(valueChanged(int)),
this, SLOT(setExpandingRadius(int)));
connect(dock_widget->expandingRadiusSlider, &QSlider::valueChanged,
this, &Display_property_plugin::setExpandingRadius);
}
private Q_SLOTS:
@ -512,6 +512,15 @@ private Q_SLOTS:
{
dock_widget->setEnabled(true);
disableExtremeValues(); // only available after coloring
// Curvature property-specific slider
const std::string& property_name = dock_widget->propertyBox->currentText().toStdString();
const bool is_curvature_property = (property_name == "Interpolated Corrected Mean Curvature" ||
property_name == "Interpolated Corrected Gaussian Curvature");
dock_widget->expandingRadiusLabel->setVisible(is_curvature_property);
dock_widget->expandingRadiusSlider->setVisible(is_curvature_property);
dock_widget->expandingRadiusLabel->setEnabled(is_curvature_property);
dock_widget->expandingRadiusSlider->setEnabled(is_curvature_property);
}
else // no or broken property
{
@ -854,11 +863,12 @@ private:
displaySMProperty<face_descriptor>("f:display_plugin_area", *sm);
}
void setExpandingRadius(const int val_int)
private Q_SLOTS:
void setExpandingRadius()
{
double sliderMin = dock_widget->expandingRadiusSlider->minimum();
double sliderMax = dock_widget->expandingRadiusSlider->maximum() - sliderMin;
double val = val_int - sliderMin;
double val = dock_widget->expandingRadiusSlider->value() - sliderMin;
sliderMin = 0;
Scene_item* item = scene->item(scene->mainSelectionIndex());
@ -878,7 +888,7 @@ private:
if(num_edges(smesh) == 0)
{
expand_radius = 0;
dock_widget->expandingRadiusLabel->setText(tr("Expanding Radius : %1").arg(expand_radius));
dock_widget->expandingRadiusLabel->setText(tr("Expanding Radius: %1").arg(expand_radius));
return;
}
@ -901,9 +911,10 @@ private:
double outMax = 5 * maxEdgeLength, base = 1.2;
expand_radius = (pow(base, val) - 1) * outMax / (pow(base, sliderMax) - 1);
dock_widget->expandingRadiusLabel->setText(tr("Expanding Radius : %1").arg(expand_radius));
dock_widget->expandingRadiusLabel->setText(tr("Expanding Radius: %1").arg(expand_radius));
}
private:
void displayInterpolatedCurvatureMeasure(Scene_surface_mesh_item* item,
CurvatureType mu_index)
{