Commit 361063b8 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

add setTransform in decorator API

parent cd90af8a
......@@ -17,6 +17,8 @@
#include "dtkVisualization.h"
#include "dtkVisualizationCanvas.h"
#include <vtkTransform.h>
// ///////////////////////////////////////////////////////////////////
// Register to dtkVisualization layer
// ///////////////////////////////////////////////////////////////////
......@@ -59,5 +61,10 @@ void dtkVisualizationDecorator::setObjectName(const QString & name)
QObject::setObjectName(name);
}
void dtkVisualizationDecorator::setTransform(vtkTransform *transform)
{
qWarning() << Q_FUNC_INFO << "nothing is done";
}
//
// dtkVisualizationDecorator.cpp ends here
......@@ -21,6 +21,7 @@
#include <QtCore/QObject>
class dtkVisualizationCanvas;
class vtkTransform;
class QWidget;
// ///////////////////////////////////////////////////////////////////
......@@ -57,6 +58,8 @@ public:
virtual void setData(const QVariant&) = 0;
virtual void setTransform(vtkTransform *);
virtual void setCanvas(dtkVisualizationCanvas *) = 0;
virtual void unsetCanvas(void) = 0;
......
......@@ -43,7 +43,6 @@ class dtkVisualizationDecoratorScalarColorMapPrivate
public:
vtkSmartPointer<vtkActor> actor;
vtkSmartPointer<vtkDataSetMapper> mapper;
vtkSmartPointer<vtkTransform> transform;
public:
QCheckBox *show_actor_cb = nullptr;
......@@ -58,15 +57,12 @@ 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
......@@ -217,13 +213,10 @@ void dtkVisualizationDecoratorScalarColorMap::setColorMap(const QMap<double, QCo
// d->actor->Modified();
}
// /////////////////////////////////////////////////////////////////////////////
// TODO: Factorise upwards
// /////////////////////////////////////////////////////////////////////////////
void dtkVisualizationDecoratorScalarColorMap::scale(qreal x, qreal y, qreal z)
void dtkVisualizationDecoratorScalarColorMap::setTransform(vtkTransform *transform)
{
d->transform->Scale(x, y, z);
d_func()->transform = transform;
d->actor->SetUserTransform(transform);
}
// /////////////////////////////////////////////////////////////////////////////
......
......@@ -29,20 +29,15 @@ public:
public:
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
void setTransform(vtkTransform *) 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;
......
......@@ -82,6 +82,7 @@ public:
public:
vtkSmartPointer<vtkColorTransferFunction> color_function;
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