Commit 418dd3fb authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Midfy methods names.

Decorators
- Move touch to draw
- Move draw to touch

Collection:
- move render to draw

Canvas:
- move touch to draw
parent 8369f0b1
......@@ -350,13 +350,13 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
menu_bar->touch();
d->collection.render();
d->collection.draw();
//TODO complete
connect(this, &dtkVisualizationViewer::updated,
[=] (void) {
d->collection.render();
d->collection.draw();
});
}
......
......@@ -190,14 +190,14 @@ void dtkVisualizationCanvas::reset(void)
}
}
void dtkVisualizationCanvas::touch(void)
void dtkVisualizationCanvas::draw(void)
{
if (d->GetInteractor()) {
d->GetInteractor()->Render();
}
if (d->renderer) {
d->renderer->GetRenderWindow()->Render();
}
// if (d->renderer) {
// d->renderer->GetRenderWindow()->Render();
// }
}
vtkRenderer *dtkVisualizationCanvas::renderer(void)
......
......@@ -45,7 +45,7 @@ public:
public:
void reset(void);
void touch(void);
void draw(void);
public:
vtkRenderer *renderer(void);
......
......@@ -29,10 +29,10 @@ namespace dtk { namespace visualization {
// dtkVisualizationDecorator implementation
// ///////////////////////////////////////////////////////////////////
void dtkVisualizationDecorator::touch(void)
void dtkVisualizationDecorator::draw(void)
{
if (this->canvas()) {
this->canvas()->touch();
this->canvas()->draw();
}
}
......
......@@ -36,10 +36,10 @@ public:
~dtkVisualizationDecorator(void) = default;
public:
virtual void draw(void) = 0;
virtual void touch(void) = 0;
protected:
void touch(void);
void draw(void);
public:
virtual bool isDecorating(void) = 0;
......
......@@ -173,7 +173,7 @@ dtkVisualizationDecoratorClutEditor::~dtkVisualizationDecoratorClutEditor(void)
d = nullptr;
}
void dtkVisualizationDecoratorClutEditor::draw(void)
void dtkVisualizationDecoratorClutEditor::touch(void)
{
if (!d->dataset || d->current_field_name.isEmpty()) {
dtkWarn() << Q_FUNC_INFO << "Set dataset and field name before updating actor.";
......@@ -192,11 +192,9 @@ void dtkVisualizationDecoratorClutEditor::draw(void)
double *range;
if (d->supports[d->current_field_name] == dtkVisualizationDecoratorClutEditorPrivate::Support::Point) {
d->dataset->GetPointData()->SetActiveScalars(qPrintable(d->current_field_name));
range = d->dataset->GetPointData()->GetScalars()->GetRange();
range = d->dataset->GetPointData()->GetArray(qPrintable(d->current_field_name))->GetRange();
} else if (d->supports[d->current_field_name] == dtkVisualizationDecoratorClutEditorPrivate::Support::Cell) {
d->dataset->GetCellData()->SetActiveScalars(qPrintable(d->current_field_name));
range = d->dataset->GetCellData()->GetScalars()->GetRange();
range = d->dataset->GetCellData()->GetArray(qPrintable(d->current_field_name))->GetRange();
}
this->setCurrentRange(range[0], range[1]);
......
......@@ -57,8 +57,8 @@ public:
void setCurrentOpacityTransferFunction(vtkSmartPointer<vtkPiecewiseFunction>);
void setCurrentRange(double, double);
protected:
void draw(void) override;
public:
void touch(void) override;
protected:
class dtkVisualizationDecoratorClutEditorPrivate *d;
......
......@@ -214,7 +214,7 @@ dtkVisualizationDecoratorClutEditorSimple::~dtkVisualizationDecoratorClutEditorS
d = nullptr;
}
void dtkVisualizationDecoratorClutEditorSimple::draw(void)
void dtkVisualizationDecoratorClutEditorSimple::touch(void)
{
if (!d->dataset || d->current_field_name.isEmpty()) {
dtkWarn() << Q_FUNC_INFO << "Set dataset and field name before updating actor.";
......@@ -232,11 +232,9 @@ void dtkVisualizationDecoratorClutEditorSimple::draw(void)
if(!d->fixed_range->isChecked()) {
double *range;
if (d->supports[d->current_field_name] == dtkVisualizationDecoratorClutEditorSimplePrivate::Support::Point) {
d->dataset->GetPointData()->SetActiveScalars(qPrintable(d->current_field_name));
range = d->dataset->GetPointData()->GetScalars()->GetRange();
range = d->dataset->GetPointData()->GetArray(qPrintable(d->current_field_name))->GetRange();
} else if (d->supports[d->current_field_name] == dtkVisualizationDecoratorClutEditorSimplePrivate::Support::Cell) {
d->dataset->GetCellData()->SetActiveScalars(qPrintable(d->current_field_name));
range = d->dataset->GetCellData()->GetScalars()->GetRange();
range = d->dataset->GetCellData()->GetScalars(qPrintable(d->current_field_name))->GetRange();
}
d->min_range->setText(QString::number(range[0]));
......
......@@ -57,8 +57,8 @@ public:
void setCurrentOpacityTransferFunction(vtkSmartPointer<vtkPiecewiseFunction>);
void setCurrentRange(double, double);
protected:
void draw(void) override;
public:
void touch(void) override;
protected:
class dtkVisualizationDecoratorClutEditorSimplePrivate *d;
......
......@@ -239,14 +239,14 @@ dtkVisualizationCanvas *dtkVisualizationDecoratorCollection::canvas(void) const
return nullptr;
}
void dtkVisualizationDecoratorCollection::render(void)
void dtkVisualizationDecoratorCollection::draw(void)
{
for (auto dec : d->collection) {
dec->draw();
dec->touch();
}
auto canvas = this->canvas();
if (canvas) {
canvas->touch();
canvas->draw();
}
}
......
......@@ -80,7 +80,7 @@ public:
dtkVisualizationCanvas *canvas(void) const;
public slots:
void render(void);
void draw(void);
private:
class dtkVisualizationDecoratorCollectionPrivate *d = nullptr;
......
......@@ -137,18 +137,14 @@ dtkVisualizationDecoratorDelaunay2D::~dtkVisualizationDecoratorDelaunay2D(void)
d = nullptr;
}
void dtkVisualizationDecoratorDelaunay2D::draw(void)
void dtkVisualizationDecoratorDelaunay2D::touch(void)
{
if(!this->canvas()) {
dtkWarn() << Q_FUNC_INFO << "No canvas was set, call setCanvas to call draw on a canvas.";
return;
}
Q_ASSERT(this->canvas()->renderer());
if (this->canvas()->interactor()) {
this->canvas()->interactor()->Render();
}
this->draw();
}
......@@ -195,10 +191,6 @@ void dtkVisualizationDecoratorDelaunay2D::setCanvas(dtkVisualizationCanvas *canv
if (d->delaunay->GetInput()) {
d->view->renderer()->AddActor(d->actor);
if(d->view->interactor()) {
d->view->interactor()->Render();
}
}
}
......@@ -218,10 +210,7 @@ void dtkVisualizationDecoratorDelaunay2D::show(void)
d->show_actor_cb->setCheckState(Qt::Checked);
d->show_actor_cb->blockSignals(false);
if (this->canvas() && this->canvas()->interactor()) {
this->canvas()->interactor()->Render();
this->canvas()->renderer()->GetRenderWindow()->Render();
}
this->draw();
}
void dtkVisualizationDecoratorDelaunay2D::hide(void)
......@@ -232,30 +221,21 @@ void dtkVisualizationDecoratorDelaunay2D::hide(void)
d->show_actor_cb->setCheckState(Qt::Unchecked);
d->show_actor_cb->blockSignals(false);
if (this->canvas() && this->canvas()->interactor()) {
this->canvas()->interactor()->Render();
this->canvas()->renderer()->GetRenderWindow()->Render();
}
this->draw();
}
void dtkVisualizationDecoratorDelaunay2D::setColor(const QColor& color)
{
d->actor->GetProperty()->SetColor(color.red(), color.green(), color.blue());
if (this->canvas() && this->canvas()->interactor()) {
this->canvas()->interactor()->Render();
this->canvas()->renderer()->GetRenderWindow()->Render();
}
this->draw();
}
void dtkVisualizationDecoratorDelaunay2D::setOpacity(const double& alpha)
{
d->actor->GetProperty()->SetOpacity(alpha);
if (this->canvas() && this->canvas()->interactor()) {
this->canvas()->interactor()->Render();
this->canvas()->renderer()->GetRenderWindow()->Render();
}
this->draw();
}
QVariant dtkVisualizationDecoratorDelaunay2D::data(void) const
......
......@@ -46,8 +46,8 @@ public:
virtual void setColor(const QColor&);
virtual void setOpacity(const double&);
protected:
void draw(void) override;
public:
void touch(void) override;
signals:
......
......@@ -222,7 +222,7 @@ void dtkVisualizationDecoratorInfo::setInformation(const QString& key, QWidget *
d->layout->addRow(key, value);
}
void dtkVisualizationDecoratorInfo::draw(void)
void dtkVisualizationDecoratorInfo::touch(void)
{
}
......
......@@ -43,8 +43,7 @@ public:
QList<QWidget *> inspectors(void) const override;
protected:
void draw(void) override;
void touch(void) override;
protected:
class dtkVisualizationDecoratorInfoPrivate *d;
......
......@@ -145,7 +145,7 @@ dtkVisualizationDecoratorPoints::~dtkVisualizationDecoratorPoints(void)
d = nullptr;
}
void dtkVisualizationDecoratorPoints::draw(void)
void dtkVisualizationDecoratorPoints::touch(void)
{
if(!this->canvas()) {
dtkWarn() << Q_FUNC_INFO << "No canvas was set, call setCanvas to call draw on a canvas.";
......
......@@ -38,6 +38,8 @@ public:
QList<QWidget *> inspectors(void) const override;
void touch(void) override;
public:
void show(void);
void hide(void);
......@@ -47,9 +49,6 @@ public:
virtual void setOpacity(const double&);
virtual void setSize(const double&);
protected:
void draw(void) override;
signals:
void updated(void);
......
......@@ -84,7 +84,7 @@ dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
this->setVisibility(state == Qt::Checked);
this->touch();
this->draw();
});
d->show_actor_cb->setObjectName("Display");
......
......@@ -138,28 +138,28 @@ dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(voi
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
this->setVisibility(state == Qt::Checked);
this->touch();
this->draw();
});
connect(d->glyphs_size_sb, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double value) {
this->blockSignals(true);
this->setCurrentGlyphsSize(value);
this->blockSignals(false);
this->touch();
this->draw();
});
connect(this, &dtkVisualizationDecoratorScalarGlyphs::currentGlyphsSizeChanged, [=] (double value) {
d->glyphs_size_sb->blockSignals(true);
d->glyphs_size_sb->setValue(value);
d->glyphs_size_sb->blockSignals(false);
this->touch();
this->draw();
});
connect(d->glyphs_source_cb, &QComboBox::currentTextChanged, [=] (const QString& source) {
this->blockSignals(true);
this->setCurrentGlyphsSource(source);
this->blockSignals(false);
this->touch();
this->draw();
});
connect(this, &dtkVisualizationDecoratorScalarGlyphs::currentGlyphsSourceChanged, [=] (const QString& source) {
......@@ -169,7 +169,7 @@ dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(voi
d->glyphs_source_cb->setCurrentIndex(index);
}
d->glyphs_source_cb->blockSignals(false);
this->touch();
this->draw();
});
d->show_actor_cb->setObjectName("Display");
......
......@@ -99,14 +99,14 @@ dtkVisualizationDecoratorScalarIsolines::dtkVisualizationDecoratorScalarIsolines
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
this->setVisibility(state == Qt::Checked);
this->touch();
this->draw();
});
connect(d->isolines_counts_sb, QOverload<int>::of(&QSpinBox::valueChanged), [=] (int value) {
this->blockSignals(true);
this->setCurrentIsolinesCount(value);
this->blockSignals(false);
this->touch();
this->draw();
});
d->show_actor_cb->setObjectName("Display");
......@@ -123,9 +123,13 @@ dtkVisualizationDecoratorScalarIsolines::~dtkVisualizationDecoratorScalarIsoline
d = nullptr;
}
void dtkVisualizationDecoratorScalarIsolines::draw(void)
void dtkVisualizationDecoratorScalarIsolines::touch(void)
{
dtkVisualizationDecoratorWithClut::draw();
dtkVisualizationDecoratorWithClut::touch();
if (!d->show_actor_cb->isChecked()) {
return;
}
auto field_name = d_func()->current_field_name;
......@@ -239,7 +243,7 @@ void dtkVisualizationDecoratorScalarIsolines::setCurrentIsolinesCount(std::size_
}
d->isolines_counts[field_name] = count;
this->draw();
this->touch();
}
bool dtkVisualizationDecoratorScalarIsolines::setCurrentFieldName(const QString& field_name)
......
......@@ -26,7 +26,7 @@ public:
~dtkVisualizationDecoratorScalarIsolines(void);
public:
void draw(void) override;
void touch(void) override;
public:
void setData(const QVariant&) override;
......
......@@ -93,7 +93,7 @@ dtkVisualizationDecoratorSnapshot::~dtkVisualizationDecoratorSnapshot(void)
d = nullptr;
}
void dtkVisualizationDecoratorSnapshot::draw(void)
void dtkVisualizationDecoratorSnapshot::touch(void)
{
}
......
......@@ -34,6 +34,8 @@ public:
QVariant data(void) const override;
dtkVisualizationCanvas *canvas(void) const override;
void touch(void) override;
public:
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
......@@ -43,9 +45,6 @@ public:
void show(void);
void hide(void);
protected:
void draw(void) override;
signals:
void updated(void);
......
......@@ -253,15 +253,13 @@ void dtkVisualizationDecoratorVectorStreamlines::unsetCanvas(void)
void dtkVisualizationDecoratorVectorStreamlines::show(void)
{
d->actor->SetVisibility(true);
if (this->canvas())
this->canvas()->touch();
this->draw();
}
void dtkVisualizationDecoratorVectorStreamlines::hide(void)
{
d->actor->SetVisibility(false);
if (this->canvas())
this->canvas()->touch();
this->draw();
}
bool dtkVisualizationDecoratorVectorStreamlines::setCurrentFieldName(const QString& field_name)
......
......@@ -252,8 +252,8 @@ dtkVisualizationDecoratorWithClut::dtkVisualizationDecoratorWithClut(void): dtkV
// Restores default ranges when unchecked
connect(d->fixed_range, &QCheckBox::stateChanged, [=] (int state) {
this->draw();
this->touch();
this->draw();
});
connect(d->colormap_editor, &dtkVisualizationWidgetsColorMapEditor::valueChanged,
......@@ -262,16 +262,16 @@ dtkVisualizationDecoratorWithClut::dtkVisualizationDecoratorWithClut(void): dtkV
d->colormap_editor->blockSignals(true);
this->setColorMap(val);
d->colormap_editor->blockSignals(false);
this->touch();
this->draw();
});
connect(d->show_scalar_bar, &QCheckBox::stateChanged, [=] (int state) {
d->scalar_bar->SetVisibility(state == Qt::Checked);
this->touch();
this->draw();
});
}
void dtkVisualizationDecoratorWithClut::draw(void)
void dtkVisualizationDecoratorWithClut::touch(void)
{
if (d->current_field_name.isEmpty() || !d->dataset) {
return;
......@@ -346,7 +346,7 @@ bool dtkVisualizationDecoratorWithClut::setCurrentFieldName(const QString& field
d->scalar_bar->SetTitle(qPrintable(d->current_field_name));
d->scalar_bar->Modified();
this->draw();
this->touch();
return true;
}
......@@ -365,7 +365,7 @@ void dtkVisualizationDecoratorWithClut::setCurrentRange(double min, double max)
range[0] = min;
range[1] = max;
this->draw();
this->touch();
}
void dtkVisualizationDecoratorWithClut::setColorMap(const QMap<double, QColor>& new_colormap)
......
......@@ -40,7 +40,7 @@ public:
~dtkVisualizationDecoratorWithClut(void);
public:
void draw(void) override;
void touch(void) override;
public:
bool isDecorating(void) override;
......
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