Added Gneric Edege Length Dialog

This commit is contained in:
Paolo Cignoni cignoni 2006-02-20 20:58:16 +00:00
parent e17f06d835
commit db1cbbc472
2 changed files with 339 additions and 0 deletions

View File

@ -0,0 +1,113 @@
#ifndef DETACHER_DIALOG_H
#define DETACHER_DIALOG_H
// for options on decimator
#include <QDialog>
#include "ui_GenericELDialog.h"
#include <vcg/math/histogram.h>
class GenericELDialog : public QDialog, Ui::DetacherDialog {
Q_OBJECT
public:
GenericELDialog() : QDialog()
{
setupUi( this );
threshold = 0.00;
diagonal_percentual = 0.00;
diagonale= 0.00;
perc = 0.0f;
selected=false;
}
~GenericELDialog()
{
delete histo;
}
public:
inline float getThreshold()
{
return threshold;
}
inline bool getSelected()
{
return selected;
}
void setDiagonale(float diag)
{
diagonale = diag;
thresholdSB->setMaximum(diag);
}
void setHistogram(vcg::Histogram<float> *hi)
{
histo = hi;
}
void aggiornaPercentualeDiagonale()
{
diagonal_percentual = (threshold / diagonale) * 100;
percdiag->setValue(diagonal_percentual);
}
void aggiornaTrashold()
{
threshold = (diagonal_percentual * diagonale) /100;
thresholdSB->setValue(threshold);
}
void aggiornaPercentile()
{
threshold = histo->Percentile(perc);
thresholdSB->setValue(threshold);
diagonal_percentual = (threshold / diagonale) * 100;
percdiag->setValue(diagonal_percentual);
}
public slots:
void on_thresholdSB_valueChanged(double threshold)
{
if(threshold <= this->diagonale)
{
this->threshold = threshold;
aggiornaPercentualeDiagonale();
}
}
void on_percdiag_valueChanged(double pd)
{
diagonal_percentual = pd;
aggiornaTrashold();
}
void on_percentileSB_valueChanged(int pd)
{
perc = 1.0f - (pd * 0.01);
aggiornaPercentile();
}
void on_selctedCB_stateChanged(int pd) {
if (pd == Qt::Checked)
selected= true;
else
selected = false;
}
private:
double threshold;
double diagonal_percentual;
double diagonale;
vcg::Histogram<float> *histo;
float perc;
bool selected;
};
#endif

View File

@ -0,0 +1,226 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>DetacherDialog</class>
<widget class="QDialog" name="DetacherDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>205</width>
<height>178</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="windowTitle" >
<string>Edge Length Dialog</string>
</property>
<property name="windowIcon" >
<iconset>..\..\..\meshlab\images\eye128.png</iconset>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>8</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="3" column="0" >
<widget class="QCheckBox" name="selctedCB" >
<property name="text" >
<string>affect only selected faces</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; />&lt;/head>&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg; font-weight:400; font-style:normal; text-decoration:none;&quot;>&lt;pre style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;>&lt;span style=&quot; font-family:Courier New,courier;&quot;>Percentile&lt;/span>&lt;/pre>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>21</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="percentileSB" >
<property name="maximum" >
<number>100</number>
</property>
<property name="minimum" >
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; />&lt;/head>&lt;body style=&quot; white-space: pre-wrap; font-family:MS Shell Dlg; font-weight:400; font-style:normal; text-decoration:none;&quot;>&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;>&lt;span style=&quot; color:#000000;&quot;>Diagonal percentage&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>31</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="percdiag" >
<property name="maximum" >
<double>100</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="thresholdLBL" >
<property name="text" >
<string>Threshold</string>
</property>
<property name="buddy" >
<cstring>thresholdSB</cstring>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="thresholdSB" >
<property name="decimals" >
<number>3</number>
</property>
<property name="maximum" >
<double>99.999</double>
</property>
<property name="singleStep" >
<double>0.001</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="okButton" >
<property name="text" >
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<tabstops>
<tabstop>thresholdSB</tabstop>
<tabstop>okButton</tabstop>
<tabstop>cancelButton</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>DetacherDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>87</x>
<y>57</y>
</hint>
<hint type="destinationlabel" >
<x>170</x>
<y>67</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>DetacherDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>165</x>
<y>57</y>
</hint>
<hint type="destinationlabel" >
<x>175</x>
<y>67</y>
</hint>
</hints>
</connection>
</connections>
</ui>