Commit 8df56839 authored by LACROIX Romain's avatar LACROIX Romain

Bugfix: we store the reset value at the correct place and time.

parent 703d0dcc
......@@ -472,7 +472,6 @@ dtkVisualizationDecoratorVectorStreamTracer::dtkVisualizationDecoratorVectorStre
d_func()->inspectors << seed_box
<< integrator_box
<< styling_box;
d->updateSeedControls(); // must be called after dtkVisualizationWidgetsCategory()
}
dtkVisualizationDecoratorVectorStreamTracer::~dtkVisualizationDecoratorVectorStreamTracer(void)
......@@ -564,6 +563,19 @@ void dtkVisualizationDecoratorVectorStreamTracer::setData(const QVariant& data)
}
d_func()->enableScalarBar();
d->updateSeedControls();
d->sphere_seed_controls[0]->setResetValue(center[0]);
d->sphere_seed_controls[1]->setResetValue(center[1]);
d->sphere_seed_controls[2]->setResetValue(center[2]);
d->sphere_seed_controls[3]->setResetValue(d->source_sphere->GetRadius());
d->line_seed_controls[0]->setResetValue(pos1[0]);
d->line_seed_controls[1]->setResetValue(pos1[1]);
d->line_seed_controls[2]->setResetValue(pos1[2]);
d->line_seed_controls[3]->setResetValue(pos2[0]);
d->line_seed_controls[4]->setResetValue(pos2[1]);
d->line_seed_controls[5]->setResetValue(pos2[2]);
}
void dtkVisualizationDecoratorVectorStreamTracer::setCanvas(dtkVisualizationCanvas *canvas)
......@@ -696,10 +708,6 @@ void dtkVisualizationDecoratorVectorStreamTracerPrivate::updateSeedControls()
source_sphere_observer->Execute(source_sphere_widget, vtkCommand::InteractionEvent, nullptr);
} else {
source_line_observer->Execute(source_line_widget, vtkCommand::InteractionEvent, nullptr);
for (dtkVisualizationWidgetsScalarControl* line_seed_control: line_seed_controls)
{
line_seed_control->setCurrentValueAsResetValue();
}
}
}
......
......@@ -73,10 +73,9 @@ void dtkVisualizationWidgetsScalarControl::setValue(double value)
{
d->spbox->setValue(value);
}
void dtkVisualizationWidgetsScalarControl::setCurrentValueAsResetValue()
void dtkVisualizationWidgetsScalarControl::setResetValue(double value)
{
d->reset_value = d->spbox->value();
d->reset_value = value;
}
void dtkVisualizationWidgetsScalarControl::setVisible(bool visible)
......
......@@ -19,7 +19,7 @@ class DTKVISUALIZATIONWIDGETS_EXPORT dtkVisualizationWidgetsScalarControl : publ
public:
dtkVisualizationWidgetsScalarControl(const QString& name = "", double reset = 0, QWidget *parent = nullptr);
void setValue(double value);
void setCurrentValueAsResetValue();
void setResetValue(double value);
virtual ~dtkVisualizationWidgetsScalarControl();
virtual void setVisible(bool visible) override;
signals:
......
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