From 0414e207b2ff656aaaebe2d44183a656849e587d Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Thu, 26 Jan 2006 16:49:02 +0000 Subject: [PATCH] Added six spinbox, three for the legth of the cell edge and three for the number of subdivision in a specific axis. --- src/meshlabplugins/meshfilter/decimator.ui | 323 +++++++++++++++--- .../meshfilter/decimatordialog.h | 121 ++++++- 2 files changed, 377 insertions(+), 67 deletions(-) diff --git a/src/meshlabplugins/meshfilter/decimator.ui b/src/meshlabplugins/meshfilter/decimator.ui index 4c47bd083..a450e4262 100644 --- a/src/meshlabplugins/meshfilter/decimator.ui +++ b/src/meshlabplugins/meshfilter/decimator.ui @@ -8,80 +8,64 @@ 0 0 - 275 - 170 + 262 + 227 Dialog - + - 9 + 8 6 - - + + 0 6 - - - - 0 + + + + <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;">X axies legth</span></p></body></html> - - 6 + + + + + + Qt::Horizontal - - - - Step - - - stepSB - - - - - - - 0 - - - 100 - - - 2 - - - 10 - - - - + + + 31 + 20 + + + + + + + + 3 + + + 100 + + + 0.01 + + - - - - Qt::Vertical - - - - 20 - 121 - - - - - + 0 @@ -118,6 +102,239 @@ + + + + 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;">Step on X axis</p></body></html> + + + stepZSB + + + + + + + Qt::Horizontal + + + + 124 + 20 + + + + + + + + 0 + + + 100 + + + 2 + + + 10 + + + + + + + + + 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;">Step on Y axis</p></body></html> + + + stepZSB + + + + + + + Qt::Horizontal + + + + 124 + 20 + + + + + + + + 0 + + + 100 + + + 2 + + + 10 + + + + + + + + + 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;">Z axies legth</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 31 + 20 + + + + + + + + 3 + + + 100 + + + 0.01 + + + + + + + + + 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;">Y axies legth</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 31 + 20 + + + + + + + + 3 + + + 100 + + + 0.01 + + + + + + + + + 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;">Step on Z axis</p></body></html> + + + stepZSB + + + + + + + Qt::Horizontal + + + + 124 + 20 + + + + + + + + 0 + + + 100 + + + 2 + + + 10 + + + + + diff --git a/src/meshlabplugins/meshfilter/decimatordialog.h b/src/meshlabplugins/meshfilter/decimatordialog.h index 53e088f43..0f9be06f2 100644 --- a/src/meshlabplugins/meshfilter/decimatordialog.h +++ b/src/meshlabplugins/meshfilter/decimatordialog.h @@ -5,30 +5,123 @@ #include #include "ui_decimator.h" #include +#include + class DecimatorDialog : public QDialog, Ui::DecimatorDialog { -Q_OBJECT + Q_OBJECT public: - DecimatorDialog() : QDialog() - { - setupUi( this ); - step = 10; - } -public slots: - void on_stepSB_valueChanged(double step) { - this->step = floor(step); + DecimatorDialog() : QDialog() + { + setupUi( this ); + Xstep = 10; + Ystep = 10; + Zstep = 10; } + public: - inline int getStep() { - return step; + inline int getXStep() { + return Xstep; + } + + inline int getYStep() { + return Ystep; + } + + inline int getZStep() { + return Zstep; + } + + void aggiornaLatoX() + { + TXL = XL / Xstep; + XedgeLength->setValue( TXL ); + } + + void aggiornaLatoY() + { + TYL = YL / Ystep; + YedgeLength->setValue(TYL); + } + + void aggiornaLatoZ() + { + TZL = ZL / Zstep; + ZedgeLength->setValue(TZL); + } + + void aggiornaXStep() + { + Xstep = floor(XL / XedgeLength->value()); + stepXSB->setValue(Xstep); + } + + void aggiornaYStep() + { + Ystep = floor(YL / YedgeLength->value()); + stepYSB->setValue(Ystep); + } + void aggiornaZStep() + { + Zstep = floor(ZL / ZedgeLength->value()); + stepZSB->setValue(Zstep); + } + + void setBboxEdge(vcg::Point3f min, vcg::Point3f max) + { + XL = max[0] - min[0]; XedgeLength->setMaximum(XL); + YL = max[1] - min[1]; YedgeLength->setMaximum(YL); + ZL = max[2] - min[2]; ZedgeLength->setMaximum(ZL); + aggiornaLatoX(); + aggiornaLatoY(); + aggiornaLatoZ(); } -private: - int step; +public slots: + void on_stepXSB_valueChanged(double val) + { + Xstep = floor(val); + aggiornaLatoX(); + } + void on_stepYSB_valueChanged(double val) + { + Ystep = floor(val); + aggiornaLatoY(); + } + + void on_stepZSB_valueChanged(double val) + { + Zstep = floor(val); + aggiornaLatoZ(); + } + + void on_XedgeLength_valueChanged(double pd) + { + TXL = pd; + aggiornaXStep(); + } + + void on_YedgeLength_valueChanged(double pd) + { + TYL = pd; + aggiornaYStep(); + } + + void on_ZedgeLength_valueChanged(double pd) + { + TZL = pd; + aggiornaZStep(); + } + + +private: + int Xstep,Ystep,Zstep; + double XL,YL,ZL; //lenght of the edge of the bounding box + double TXL,TYL,TZL; }; -#endif //REFINE_DIALOG_H +#endif