Commit a1354dab authored by WINTZ Julien's avatar WINTZ Julien

Fixing build tree on llvm.

Add transforms to decorators.
parent cbb0640a
......@@ -39,7 +39,7 @@ public:
QList<QWidget *> inspectors(void) const override;
public:
void setVisibility(bool);
void setVisibility(bool) override;
public:
virtual void setColor(const QColor&);
......
......@@ -35,6 +35,7 @@
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkTransform.h>
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorScalarColorMapPrivate declaration
......@@ -45,7 +46,8 @@ class dtkVisualizationDecoratorScalarColorMapPrivate
public:
vtkSmartPointer<vtkActor> actor;
vtkSmartPointer<vtkDataSetMapper> mapper;
vtkSmartPointer<vtkTransform> transform;
public:
QCheckBox *show_actor_cb = nullptr;
......@@ -59,12 +61,15 @@ public slots:
dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap(void): dtkVisualizationDecoratorWithClut(), d(new dtkVisualizationDecoratorScalarColorMapPrivate())
{
d->transform = vtkSmartPointer<vtkTransform>::New();
d->mapper = vtkSmartPointer<vtkDataSetMapper>::New();
d->mapper->SetColorModeToMapScalars();
d->mapper->SetScalarVisibility(true);
d->actor = vtkSmartPointer<vtkActor>::New();
d->actor->SetMapper(d->mapper);
d->actor->SetUserTransform(d->transform);
//////////
// Inspectors creation
......@@ -199,7 +204,8 @@ void dtkVisualizationDecoratorScalarColorMap::setColorMap(const QMap<double, QCo
d->mapper->SetScalarRange(range[0], range[1]);
d->mapper->Modified();
//set opacity
// -- set opacity
// int size = opacity_function->GetSize();
// double val[4];
......@@ -213,5 +219,16 @@ void dtkVisualizationDecoratorScalarColorMap::setColorMap(const QMap<double, QCo
// d->actor->Modified();
}
// /////////////////////////////////////////////////////////////////////////////
// TODO: Factorise upwards
// /////////////////////////////////////////////////////////////////////////////
void dtkVisualizationDecoratorScalarColorMap::scale(qreal x, qreal y, qreal z)
{
d->transform->Scale(x, y, z);
}
// /////////////////////////////////////////////////////////////////////////////
//
// dtkVisualizationDecoratorScalarColorMap.cpp ends here
......@@ -31,13 +31,22 @@ public:
void setCanvas(dtkVisualizationCanvas *) override;
void unsetCanvas(void) override;
public:
void setVisibility(bool) override;
// /////////////////////////////////////////////////////////////////////////////
// TODO: Factorise upwards
// /////////////////////////////////////////////////////////////////////////////
public:
void scale(qreal, qreal, qreal);
// /////////////////////////////////////////////////////////////////////////////
protected:
bool setCurrentFieldName(const QString&) override;
void setColorMap(const QMap<double, QColor>&) override;
void restoreSettings(void);
public:
void setVisibility(bool) override;
void restoreSettings(void) override;
protected:
class dtkVisualizationDecoratorScalarColorMapPrivate *d;
......
......@@ -127,18 +127,21 @@ dtkVisualizationDecoratorVectorStreamlines::dtkVisualizationDecoratorVectorStrea
//////////
// Inspectors connections
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
this->saveSettings("visibility",state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
});
connect(d->show_source_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
d->source_actor->SetVisibility(state == Qt::Checked);
this->draw();
});
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state)
{
this->saveSettings("visibility",state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
});
connect(d->show_source_actor_cb, &QCheckBox::stateChanged, [=] (int state)
{
d->source_actor->SetVisibility(state == Qt::Checked);
this->draw();
});
this->setObjectName("Vector Streamlines 2D");
d->show_actor_cb->setObjectName("Display");
d->show_source_actor_cb->setObjectName("Display Source");
......@@ -150,6 +153,7 @@ dtkVisualizationDecoratorVectorStreamlines::~dtkVisualizationDecoratorVectorStre
dtkVisualizationDecoratorVectorStreamlines::unsetCanvas();
delete d;
d = nullptr;
}
......
......@@ -21,8 +21,9 @@
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorVectorStreamlines : public dtkVisualizationDecoratorWithClut
{
Q_OBJECT
public:
dtkVisualizationDecoratorVectorStreamlines(void);
dtkVisualizationDecoratorVectorStreamlines(void);
~dtkVisualizationDecoratorVectorStreamlines(void);
public:
......
......@@ -14,11 +14,8 @@
#include "dtkVisualizationDecoratorWithClut.h"
#include "dtkVisualizationDecoratorWithClut_p.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsColorMapEditor.h>
#include <dtkLog>
......@@ -120,6 +117,7 @@ void dtkVisualizationDecoratorWithClutPrivate::disableScalarBar(void)
void dtkVisualizationDecoratorWithClutPrivate::retrieveScalarData(vtkDataSetAttributes *field_data, Support support)
{
vtkIdType nb_arrays = field_data->GetNumberOfArrays();
for (vtkIdType i = 0; i < nb_arrays; ++i) {
std::size_t nb_components = field_data->GetArray(i)->GetNumberOfComponents();
if (nb_components == 1) {
......@@ -381,6 +379,7 @@ bool dtkVisualizationDecoratorWithClut::setCurrentFieldName(const QString& field
}
d->current_field_name = field_name;
d->fields_box->setCurrentText(d->current_field_name);
d->scalar_bar->UnconstrainedFontSizeOn();
......
......@@ -51,7 +51,7 @@ public:
QList<QWidget *> inspectors(void) const override;
public:
virtual void setVisibility(bool visible);
virtual void setVisibility(bool visible) override;
protected:
virtual void restoreSettings(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