Commit f91bafb8 authored by LACROIX Romain's avatar LACROIX Romain

Moved more styling fields under the 'Styling' subcategory.

parent 952b2d03
......@@ -122,12 +122,10 @@ public:
public:
dtkVisualizationWidgetsComboBox *cb_seed_type = nullptr;
QSpinBox *sp_integrator_max_steps = nullptr;
QSpinBox *sp_resolution = nullptr;
QDoubleSpinBox *sp_integrator_max_lengths = nullptr;
dtkVisualizationWidgetsDoubleSpinBox *sp_integrator_max_lengths = nullptr;
public:
QDoubleSpinBox *sp_radius = nullptr;
dtkVisualizationWidgetsDoubleSpinBox *sp_radius = nullptr;
};
// ///////////////////////////////////////////////////////////////////
......@@ -213,26 +211,26 @@ dtkVisualizationDecoratorVectorStreamTracer::dtkVisualizationDecoratorVectorStre
d->cb_seed_type = new dtkVisualizationWidgetsComboBox("Type", { "Line", "Sphere" }, 1);
d->sp_resolution = new QSpinBox;
d->sp_resolution->setMaximum(10000);
d->sp_resolution->setValue(50);
d->sp_resolution->setKeyboardTracking(false);
dtkVisualizationWidgetsSpinBox *sp_resolution = new dtkVisualizationWidgetsSpinBox("Resolution");
sp_resolution->spinbox()->setMaximum(10000);
sp_resolution->spinbox()->setValue(50);
sp_resolution->spinbox()->setKeyboardTracking(false);
d->sp_integrator_max_steps = new QSpinBox;
d->sp_integrator_max_steps->setMaximum(99999999);
d->sp_integrator_max_steps->setValue(2000);
d->sp_integrator_max_steps->setKeyboardTracking(false);
dtkVisualizationWidgetsSpinBox *sp_integrator_max_steps = new dtkVisualizationWidgetsSpinBox("Maximum Steps");
sp_integrator_max_steps->spinbox()->setMaximum(99999999);
sp_integrator_max_steps->spinbox()->setValue(2000);
sp_integrator_max_steps->spinbox()->setKeyboardTracking(false);
d->sp_integrator_max_lengths = new QDoubleSpinBox;
d->sp_integrator_max_lengths->setMaximum(999999999);
d->sp_integrator_max_lengths->setValue(20);
d->sp_integrator_max_lengths->setKeyboardTracking(false);
d->sp_integrator_max_lengths = new dtkVisualizationWidgetsDoubleSpinBox("Maximum Streamline Length");
d->sp_integrator_max_lengths->doublespinbox()->setMaximum(999999999);
d->sp_integrator_max_lengths->doublespinbox()->setValue(20);
d->sp_integrator_max_lengths->doublespinbox()->setKeyboardTracking(false);
d->sp_radius = new QDoubleSpinBox;
d->sp_radius->setValue(1.0);
d->sp_radius->setSingleStep(0.1);
d->sp_radius->setDecimals(4);
d->sp_radius->setKeyboardTracking(false);
d->sp_radius = new dtkVisualizationWidgetsDoubleSpinBox("Tube Radius");
d->sp_radius->doublespinbox()->setValue(1.0);
d->sp_radius->doublespinbox()->setSingleStep(0.1);
d->sp_radius->doublespinbox()->setDecimals(4);
d->sp_radius->doublespinbox()->setKeyboardTracking(false);
//////////
// Inspectors connections
......@@ -279,7 +277,7 @@ dtkVisualizationDecoratorVectorStreamTracer::dtkVisualizationDecoratorVectorStre
this->draw();
});
connect(d->sp_resolution, QOverload<int>::of(&QSpinBox::valueChanged), [=] (int val)
connect(sp_resolution->spinbox(), QOverload<int>::of(&QSpinBox::valueChanged), [=] (int val)
{
int sqrt_val = std::round(std::sqrt(val));
d->source_sphere->SetPhiResolution(sqrt_val);
......@@ -289,19 +287,19 @@ dtkVisualizationDecoratorVectorStreamTracer::dtkVisualizationDecoratorVectorStre
this->draw();
});
connect(d->sp_integrator_max_steps, QOverload<int>::of(&QSpinBox::valueChanged), [=] (int val)
connect(sp_integrator_max_steps->spinbox(), QOverload<int>::of(&QSpinBox::valueChanged), [=] (int val)
{
d->streamtracer->SetMaximumNumberOfSteps(val);
this->draw();
});
connect(d->sp_integrator_max_lengths, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double val)
connect(d->sp_integrator_max_lengths->doublespinbox(), QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double val)
{
d->streamtracer->SetMaximumPropagation(val);
this->draw();
});
connect(d->sp_radius, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double val)
connect(d->sp_radius->doublespinbox(), QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double val)
{
d->tube_filter->SetRadius(val);
this->draw();
......@@ -311,20 +309,14 @@ dtkVisualizationDecoratorVectorStreamTracer::dtkVisualizationDecoratorVectorStre
d->show_actor_cb->setObjectName("Display");
d->show_source_actor_cb->setObjectName("Display Source");
d->sp_integrator_max_steps->setObjectName("Maximum Steps");
d->sp_integrator_max_lengths->setObjectName("Maximum Streamline Length");
d->sp_radius->setObjectName("Tube Radius");
d->sp_resolution->setObjectName("Resolution");
QWidget *integrator_box = dtkVisualizationWidgetsStreamTracer::createCategory("Integrator", {cb_integrator_direction, cb_integrator_type});
QWidget *seed_box = dtkVisualizationWidgetsStreamTracer::createCategory("Seed", { d->cb_seed_type });
QWidget *styling_box = dtkVisualizationWidgetsStreamTracer::createCategory("Styling", { d_func()->field_components });
QWidget *styling_box = dtkVisualizationWidgetsStreamTracer::createCategory("Styling", { d_func()->field_components, sp_integrator_max_steps, d->sp_integrator_max_lengths, d->sp_radius, sp_resolution });
d_func()->inspectors << d->show_actor_cb << d->show_source_actor_cb
<< styling_box
<< seed_box << integrator_box
<< d->sp_integrator_max_steps
<< d->sp_integrator_max_lengths << d->sp_radius << d->sp_resolution;
<< styling_box;
}
dtkVisualizationDecoratorVectorStreamTracer::~dtkVisualizationDecoratorVectorStreamTracer(void)
......@@ -377,14 +369,14 @@ void dtkVisualizationDecoratorVectorStreamTracer::setData(const QVariant& data)
double pos1[3]; pos1[0] = bounds[0]; pos1[1] = bounds[2]; pos1[2] = bounds[4];
double pos2[3]; pos2[0] = bounds[1]; pos2[1] = bounds[3]; pos2[2] = bounds[5];
d->sp_integrator_max_lengths->blockSignals(true);
d->sp_integrator_max_lengths->setValue(box.GetDiagonalLength());
d->sp_integrator_max_lengths->doublespinbox()->blockSignals(true);
d->sp_integrator_max_lengths->doublespinbox()->setValue(box.GetDiagonalLength());
d->streamtracer->SetMaximumPropagation(box.GetDiagonalLength());
d->sp_integrator_max_lengths->blockSignals(false);
d->sp_radius->blockSignals(true);
d->sp_radius->setValue(box.GetDiagonalLength()/500.0);
d->sp_integrator_max_lengths->doublespinbox()->blockSignals(false);
d->sp_radius->doublespinbox()->blockSignals(true);
d->sp_radius->doublespinbox()->setValue(box.GetDiagonalLength()/500.0);
d->tube_filter->SetRadius(box.GetDiagonalLength()/500.0);
d->sp_radius->blockSignals(false);
d->sp_radius->doublespinbox()->blockSignals(false);
d->source_sphere->SetCenter(center);
d->source_sphere->SetRadius(box.GetDiagonalLength()/20.0);
......
......@@ -19,16 +19,13 @@ dtkVisualizationWidgetsComboBox::dtkVisualizationWidgetsComboBox(const QString&
this->setStyleSheet("QGroupBox { margin: 0px; padding-left: 20px }");
}
dtkVisualizationWidgetsComboBox::~dtkVisualizationWidgetsComboBox()
{
}
dtkVisualizationWidgetsComboBox::~dtkVisualizationWidgetsComboBox() { }
QComboBox *dtkVisualizationWidgetsComboBox::combobox()
{
return cbox;
}
QString dtkVisualizationWidgetsComboBox::currentText() const
{
return cbox->currentText();
......@@ -38,21 +35,51 @@ int dtkVisualizationWidgetsComboBox::currentIndex() const
{
return cbox->currentIndex();
}
void dtkVisualizationWidgetsComboBox::setCurrentIndex(int index)
{
cbox->setCurrentIndex(index);
}
dtkVisualizationWidgetsStreamTracer::dtkVisualizationWidgetsStreamTracer(QWidget *parent)
dtkVisualizationWidgetsSpinBox::dtkVisualizationWidgetsSpinBox(const QString& name, QWidget *parent) : QGroupBox(parent), sbox(new QSpinBox)
{
sbox->setObjectName(name);
QLayout *layout = new QHBoxLayout;
layout->setContentsMargins(0,0,0,0);
layout->addWidget(new QLabel(name));
layout->addWidget(sbox);
setLayout(layout);
this->setStyleSheet("QGroupBox { margin: 0px; padding-left: 20px }");
}
dtkVisualizationWidgetsStreamTracer::~dtkVisualizationWidgetsStreamTracer()
dtkVisualizationWidgetsSpinBox::~dtkVisualizationWidgetsSpinBox() { }
QSpinBox *dtkVisualizationWidgetsSpinBox::spinbox()
{
return sbox;
}
dtkVisualizationWidgetsDoubleSpinBox::dtkVisualizationWidgetsDoubleSpinBox(const QString& name, QWidget *parent) : QGroupBox(parent), dsbox(new QDoubleSpinBox)
{
dsbox->setObjectName(name);
QLayout *layout = new QHBoxLayout;
layout->setContentsMargins(0,0,0,0);
layout->addWidget(new QLabel(name));
layout->addWidget(dsbox);
setLayout(layout);
this->setStyleSheet("QGroupBox { margin: 0px; padding-left: 20px }");
}
dtkVisualizationWidgetsDoubleSpinBox::~dtkVisualizationWidgetsDoubleSpinBox() { }
QDoubleSpinBox *dtkVisualizationWidgetsDoubleSpinBox::doublespinbox()
{
return dsbox;
}
// todo : change this static function to class, remove unused class
// TODO : change this static function to class, remove unused class
QGroupBox *dtkVisualizationWidgetsStreamTracer::createCategory(const QString& name, const QVector<QWidget*>& widgets, QWidget* parent)
{
QLayout *layout = new QVBoxLayout;
......
......@@ -3,6 +3,8 @@
#include <dtkVisualizationWidgetsExport>
class QComboBox;
class QSpinBox;
class QDoubleSpinBox;
#include <QGroupBox>
class DTKVISUALIZATIONWIDGETS_EXPORT dtkVisualizationWidgetsComboBox : public QGroupBox
......@@ -19,15 +21,41 @@ public:
void setCurrentIndex(int index);
private:
QComboBox* cbox;
QComboBox *cbox;
};
class DTKVISUALIZATIONWIDGETS_EXPORT dtkVisualizationWidgetsSpinBox : public QGroupBox
{
Q_OBJECT
public:
dtkVisualizationWidgetsSpinBox(const QString& name, QWidget *parent = nullptr);
~dtkVisualizationWidgetsSpinBox(void);
QSpinBox *spinbox();
private:
QSpinBox *sbox;
};
class DTKVISUALIZATIONWIDGETS_EXPORT dtkVisualizationWidgetsDoubleSpinBox : public QGroupBox
{
Q_OBJECT
public:
dtkVisualizationWidgetsDoubleSpinBox(const QString& name, QWidget *parent = nullptr);
~dtkVisualizationWidgetsDoubleSpinBox(void);
QDoubleSpinBox *doublespinbox();
private:
QDoubleSpinBox *dsbox;
};
class DTKVISUALIZATIONWIDGETS_EXPORT dtkVisualizationWidgetsStreamTracer
{
public:
dtkVisualizationWidgetsStreamTracer(QWidget *parent = nullptr);
~dtkVisualizationWidgetsStreamTracer(void);
static QGroupBox *createCategory(const QString& name, const QVector<QWidget*>& widgets, QWidget* parent = nullptr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment