Commit 45d930bc authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Clean and update many things

- uniform coloring is available for all vector decorators
- no more side effect between touch and draw
   - touch() enables to update decorator state
   - draw() tells the view to redraw itself

Management of color map can be enhanced especially to include opacity
management for volume rendering.
parent 98224870
......@@ -78,10 +78,6 @@ public:
void dtkVisualizationDecoratorIsocontours::updateContours(void)
{
if (!d_func()->show_actor_cb->isChecked()) {
return;
}
auto field_name = d_func()->current_field_name;
if (field_name.isEmpty() || !d_func()->dataset) {
......@@ -142,25 +138,28 @@ dtkVisualizationDecoratorIsocontours::dtkVisualizationDecoratorIsocontours(void)
//////////
// Inspectors connections
connect(d_func()->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
this->saveSettings("visibility",state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
});
connect(d->isolines_counts_sb, QOverload<int>::of(&QSpinBox::valueChanged), [=] (int value) {
this->saveSettings("isolines_count", value);
this->setCurrentIsolinesCount(value);
this->touch();
this->draw();
});
connect(d->isolines_width_sb, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double value) {
this->saveSettings("isolines_line_width", value);
d->actor->GetProperty()->SetLineWidth(value);
d->actor->Modified();
this->draw();
});
connect(d_func()->show_actor_cb, &QCheckBox::stateChanged, [=] (int state)
{
this->saveSettings("visibility", state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
});
connect(d->isolines_counts_sb, QOverload<int>::of(&QSpinBox::valueChanged), [=] (int value)
{
this->saveSettings("isolines_count", value);
this->setCurrentIsolinesCount(value);
this->touch();
this->draw();
});
connect(d->isolines_width_sb, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double value)
{
this->saveSettings("isolines_line_width", value);
d->actor->GetProperty()->SetLineWidth(value);
d->actor->Modified();
this->draw();
});
this->setObjectName("Isocontours");
......
......@@ -214,16 +214,16 @@ dtkVisualizationDecoratorSlices::dtkVisualizationDecoratorSlices(void): dtkVisua
});
connect(d->enable_slicing_x, &dtkVisualizationWidgetsSliceControls::reset, [=] ()
{
double *origin = d->input_image->GetOrigin();
d->volume_slice_x->SetPlaneOrientationToXAxes();
d->volume_slice_x->SetSlicePosition(origin[0]);
this->draw();
double *origin = d->input_image->GetOrigin();
d->volume_slice_x->SetPlaneOrientationToXAxes();
d->volume_slice_x->SetSlicePosition(origin[0]);
this->draw();
});
connect(d->enable_slicing_x, &dtkVisualizationWidgetsSliceControls::valueChanged, [=] (double value)
{
double *origin = d->input_image->GetOrigin();
d->volume_slice_x->SetSlicePosition(value + origin[0]);
this->draw();
double *origin = d->input_image->GetOrigin();
d->volume_slice_x->SetSlicePosition(value + origin[0]);
this->draw();
});
connect(d->enable_slicing_y, &dtkVisualizationWidgetsSliceControls::toggled, [=] (bool checked)
......@@ -233,16 +233,16 @@ dtkVisualizationDecoratorSlices::dtkVisualizationDecoratorSlices(void): dtkVisua
});
connect(d->enable_slicing_y, &dtkVisualizationWidgetsSliceControls::reset, [=] ()
{
double *origin = d->input_image->GetOrigin();
d->volume_slice_y->SetPlaneOrientationToYAxes();
d->volume_slice_y->SetSlicePosition(origin[1]);
this->draw();
double *origin = d->input_image->GetOrigin();
d->volume_slice_y->SetPlaneOrientationToYAxes();
d->volume_slice_y->SetSlicePosition(origin[1]);
this->draw();
});
connect(d->enable_slicing_y, &dtkVisualizationWidgetsSliceControls::valueChanged, [=] (double value)
{
double *origin = d->input_image->GetOrigin();
d->volume_slice_y->SetSlicePosition(value + origin[1]);
this->draw();
double *origin = d->input_image->GetOrigin();
d->volume_slice_y->SetSlicePosition(value + origin[1]);
this->draw();
});
connect(d->enable_slicing_z, &dtkVisualizationWidgetsSliceControls::toggled, [=] (bool checked)
......@@ -252,16 +252,16 @@ dtkVisualizationDecoratorSlices::dtkVisualizationDecoratorSlices(void): dtkVisua
});
connect(d->enable_slicing_z, &dtkVisualizationWidgetsSliceControls::reset, [=] ()
{
double *origin = d->input_image->GetOrigin();
d->volume_slice_z->SetPlaneOrientationToZAxes();
d->volume_slice_z->SetSlicePosition(origin[2]);
this->draw();
double *origin = d->input_image->GetOrigin();
d->volume_slice_z->SetPlaneOrientationToZAxes();
d->volume_slice_z->SetSlicePosition(origin[2]);
this->draw();
});
connect(d->enable_slicing_z, &dtkVisualizationWidgetsSliceControls::valueChanged, [=] (double value)
{
double *origin = d->input_image->GetOrigin();
d->volume_slice_z->SetSlicePosition((value + origin[2]));
this->draw();
double *origin = d->input_image->GetOrigin();
d->volume_slice_z->SetSlicePosition((value + origin[2]));
this->draw();
});
......
......@@ -109,6 +109,7 @@ dtkVisualizationDecoratorVectorGlyphs::dtkVisualizationDecoratorVectorGlyphs(voi
{
this->saveSettings("scaling_mode", component_id);
this->touch();
this->draw();
});
connect(d->glyphs_stride_sb, QOverload<int>::of(&QSpinBox::valueChanged), [=] (int value)
......
......@@ -647,10 +647,12 @@ void dtkVisualizationDecoratorVectorStreamTracer::setVisibility(bool visible)
{
dtkVisualizationDecoratorWithClut::setVisibility(visible);
d->actor->SetVisibility(visible);
if (d->cb_seed_type->currentText() == "Sphere") {
d->source_sphere_widget->SetEnabled(visible);
} else {
d->source_line_widget->SetEnabled(visible);
if (d->cb_show_seed->isChecked()) {
if (d->cb_seed_type->currentText() == "Sphere") {
d->source_sphere_widget->SetEnabled(visible);
} else {
d->source_line_widget->SetEnabled(visible);
}
}
}
......
......@@ -69,6 +69,7 @@ protected:
virtual void setOpacity(double);
protected:
friend class dtkVisualizationDecoratorWithClutPrivate;
class dtkVisualizationDecoratorWithClutPrivate *d;
dtkVisualizationDecoratorWithClutPrivate *d_func(void);
const dtkVisualizationDecoratorWithClutPrivate *d_func(void) const;
......
......@@ -23,6 +23,7 @@
#include <array>
class dtkVisualizationView2D;
class dtkVisualizationWidgetsColorDialog;
class dtkVisualizationWidgetsColorMapEditor;
class QCheckBox;
......@@ -35,6 +36,7 @@ class QSlider;
class vtkColorTransferFunction;
class vtkDataSet;
class vtkDataSetAttributes;
class vtkLookupTable;
class vtkPiecewiseFunction;
class vtkPiecewiseFunction;
class vtkScalarBarActor;
......@@ -42,6 +44,9 @@ class vtkTransform;
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorWithClutPrivate
{
public:
class dtkVisualizationDecoratorWithClut *q = nullptr;
public:
enum Support {
Unknown = 0,
......@@ -68,19 +73,21 @@ public:
QComboBox *fields_box = nullptr;
QComboBox *field_components = nullptr;
QWidget *range_widget = nullptr;
QPushButton *reset_range = nullptr;
QLineEdit *min_range = nullptr;
QLineEdit *max_range = nullptr;
bool original_range = true;
QCheckBox *show_scalar_bar = nullptr;
QCheckBox *show_actor_cb = nullptr;
public:
QWidget *opacity_widget = nullptr;
QSlider *opacity_slider = nullptr;
QDoubleSpinBox *opacity_val_sp = nullptr;
public:
dtkVisualizationWidgetsColorDialog *col_dialog = nullptr;
dtkVisualizationWidgetsColorMapEditor *colormap_editor = nullptr;
public:
......@@ -95,8 +102,8 @@ public:
public:
vtkSmartPointer<vtkColorTransferFunction> color_function;
vtkSmartPointer<vtkPiecewiseFunction> opacity;
vtkSmartPointer<vtkTransform> transform;
vtkSmartPointer<vtkPiecewiseFunction> opacity;
vtkSmartPointer<vtkTransform> transform;
vtkSmartPointer<vtkScalarBarActor> scalar_bar;
......
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