diff --git a/src/meshlab/GenericELDialog.h b/src/meshlab/GenericELDialog.h new file mode 100644 index 000000000..cef4dce7f --- /dev/null +++ b/src/meshlab/GenericELDialog.h @@ -0,0 +1,113 @@ +#ifndef DETACHER_DIALOG_H +#define DETACHER_DIALOG_H + +// for options on decimator +#include +#include "ui_GenericELDialog.h" +#include + +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 *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 *histo; + float perc; + bool selected; +}; + +#endif diff --git a/src/meshlab/ui/GenericELDialog.ui b/src/meshlab/ui/GenericELDialog.ui new file mode 100644 index 000000000..feed93f7e --- /dev/null +++ b/src/meshlab/ui/GenericELDialog.ui @@ -0,0 +1,226 @@ + + + + + DetacherDialog + + + + 0 + 0 + 205 + 178 + + + + + 0 + 0 + 0 + 0 + + + + + 16 + 16 + + + + Edge Length Dialog + + + ..\..\..\meshlab\images\eye128.png + + + + 8 + + + 6 + + + + + affect only selected faces + + + + + + + 0 + + + 6 + + + + + <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-weight:400; font-style:normal; text-decoration:none;"><pre style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:Courier New,courier;">Percentile</span></pre></body></html> + + + + + + + Qt::Horizontal + + + + 21 + 20 + + + + + + + + 100 + + + 0 + + + + + + + + + 0 + + + 6 + + + + + <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">Diagonal percentage</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 31 + 20 + + + + + + + + 100 + + + + + + + + + 0 + + + 6 + + + + + Threshold + + + thresholdSB + + + + + + + 3 + + + 99.999 + + + 0.001 + + + + + + + + + 0 + + + 6 + + + + + OK + + + + + + + Cancel + + + + + + + + + + thresholdSB + okButton + cancelButton + + + + + okButton + clicked() + DetacherDialog + accept() + + + 87 + 57 + + + 170 + 67 + + + + + cancelButton + clicked() + DetacherDialog + reject() + + + 165 + 57 + + + 175 + 67 + + + + +