Added six spinbox, three for the legth of the cell edge and three for the number of subdivision in a specific axis.

This commit is contained in:
Paolo Cignoni cignoni 2006-01-26 16:49:02 +00:00
parent b0f7d19708
commit 0414e207b2
2 changed files with 377 additions and 67 deletions

View File

@ -8,80 +8,64 @@
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>170</height>
<width>262</width>
<height>227</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" >
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
<number>8</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QGridLayout" >
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
<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;>X axies legth&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="spacing" >
<number>6</number>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<item>
<widget class="QLabel" name="stepLBL" >
<property name="text" >
<string>Step</string>
</property>
<property name="buddy" >
<cstring>stepSB</cstring>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="stepSB" >
<property name="decimals" >
<number>0</number>
</property>
<property name="maximum" >
<double>100</double>
</property>
<property name="minimum" >
<double>2</double>
</property>
<property name="value" >
<double>10</double>
</property>
</widget>
</item>
</layout>
<property name="sizeHint" >
<size>
<width>31</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="XedgeLength" >
<property name="decimals" >
<number>3</number>
</property>
<property name="maximum" >
<double>100</double>
</property>
<property name="singleStep" >
<double>0.01</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>121</height>
</size>
</property>
</spacer>
</item>
<item>
<item row="6" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
@ -118,6 +102,239 @@
</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="stepLBL" >
<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;>Step on X axis&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="buddy" >
<cstring>stepZSB</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>124</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="stepXSB" >
<property name="decimals" >
<number>0</number>
</property>
<property name="maximum" >
<double>100</double>
</property>
<property name="minimum" >
<double>2</double>
</property>
<property name="value" >
<double>10</double>
</property>
</widget>
</item>
</layout>
</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="stepLBL_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;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;>Step on Y axis&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="buddy" >
<cstring>stepZSB</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>124</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="stepYSB" >
<property name="decimals" >
<number>0</number>
</property>
<property name="maximum" >
<double>100</double>
</property>
<property name="minimum" >
<double>2</double>
</property>
<property name="value" >
<double>10</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" 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_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;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;>Z axies legth&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="ZedgeLength" >
<property name="decimals" >
<number>3</number>
</property>
<property name="maximum" >
<double>100</double>
</property>
<property name="singleStep" >
<double>0.01</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" 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;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;>Y axies legth&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="YedgeLength" >
<property name="decimals" >
<number>3</number>
</property>
<property name="maximum" >
<double>100</double>
</property>
<property name="singleStep" >
<double>0.01</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="QLabel" name="stepLBL_2_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;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;>Step on Z axis&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="buddy" >
<cstring>stepZSB</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>124</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="stepZSB" >
<property name="decimals" >
<number>0</number>
</property>
<property name="maximum" >
<double>100</double>
</property>
<property name="minimum" >
<double>2</double>
</property>
<property name="value" >
<double>10</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>

View File

@ -5,30 +5,123 @@
#include <QDialog>
#include "ui_decimator.h"
#include <math.h>
#include <vcg/space/point3.h>
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