Commit 089659f2 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

Merge branch 'release/2.18.0'

parents 5ac2ad4b dbb93384
# Change Log:
# 2.17.0 15-Jan-2020
# 2.18.0 16-Jan-2020
- update decorator API: add setInputConnection/outputPort
# 2.17.1 15-Jan-2020
- Make veriants allow for different vtk types within a hierarchy of types.
# 2.17.0 14-Jan-2020
......
......@@ -23,8 +23,8 @@ project(dtkVisualization)
## ###################################################################
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 17)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION_MINOR 18)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......
......@@ -66,5 +66,14 @@ void dtkVisualizationDecorator::setTransform(vtkTransform *transform)
qWarning() << Q_FUNC_INFO << "nothing is done";
}
void dtkVisualizationDecorator::setInputConnection(Connection *)
{
}
dtkVisualizationDecorator::Connection *dtkVisualizationDecorator::outputPort(void)
{
return nullptr;
}
//
// dtkVisualizationDecorator.cpp ends here
......@@ -20,6 +20,7 @@
#include <QtCore/QObject>
class vtkAlgorithmOutput;
class dtkVisualizationCanvas;
class vtkTransform;
class QWidget;
......@@ -32,6 +33,9 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecorator : public QObject
{
Q_OBJECT
public:
using Connection = vtkAlgorithmOutput;
public:
dtkVisualizationDecorator(void) = default;
~dtkVisualizationDecorator(void) = default;
......@@ -67,6 +71,10 @@ public:
virtual dtkVisualizationCanvas *canvas(void) const = 0;
virtual QList<QWidget *> inspectors(void) const = 0;
public:
virtual void setInputConnection(Connection *);
virtual Connection *outputPort(void);
};
// ///////////////////////////////////////////////////////////////////
......
......@@ -15,6 +15,7 @@
#include <QtWidgets>
#include <vtkActor.h>
#include <vtkAlgorithmOutput.h>
#include <vtkColorTransferFunction.h>
#include <vtkCellData.h>
#include <vtkDataSet.h>
......@@ -145,6 +146,21 @@ void dtkVisualizationDecoratorSurfaceColor::setVisibility(bool visible)
dtkVisualizationDecoratorWithClut::setVisibility(visible);
}
void dtkVisualizationDecoratorSurfaceColor::setInputConnection(Connection *connection)
{
vtkDataSet *data = vtkDataSet::SafeDownCast(connection->GetProducer()->GetOutputDataObject(connection->GetIndex()));
if (!data)
return;
this->setData(dtk::variantFromValue(data));
d->mapper->SetInputConnection(connection);
}
dtkVisualizationDecorator::Connection *dtkVisualizationDecoratorSurfaceColor::outputPort(void)
{
return d->mapper->GetOutputPort();
}
void dtkVisualizationDecoratorSurfaceColor::setOpacity(double opacity)
{
d->actor->GetProperty()->SetOpacity(opacity);
......
......@@ -24,6 +24,10 @@ public:
public:
void setVisibility(bool) override;
public:
void setInputConnection(Connection *) override;
Connection *outputPort(void) override;
protected:
void restoreSettings(void) override;
bool setCurrentFieldName(const QString&) override;
......
......@@ -23,6 +23,7 @@
#include <QtWidgets>
#include <vtkActor.h>
#include <vtkAlgorithmOutput.h>
#include <vtkAssembly.h>
#include <vtkCellDataToPointData.h>
#include <vtkColorTransferFunction.h>
......@@ -281,5 +282,20 @@ void dtkVisualizationDecoratorVolume::setAlphaMap(const QMap<double, double>& ma
d->mapper->Modified();
}
void dtkVisualizationDecoratorVolume::setInputConnection(Connection *connection)
{
vtkDataSet *data = vtkDataSet::SafeDownCast(connection->GetProducer()->GetOutputDataObject(connection->GetIndex()));
if (!data)
return;
this->setData(dtk::variantFromValue(data));
d->mapper->SetInputConnection(connection);
}
dtkVisualizationDecorator::Connection *dtkVisualizationDecoratorVolume::outputPort(void)
{
return d->mapper->GetOutputPort();
}
//
// dtkVisualizationDecoratorVolume.cpp ends here
......@@ -35,6 +35,10 @@ public:
bool isDecorating(void) override;
bool setCurrentFieldName(const QString&) override;
public:
void setInputConnection(Connection *) override;
Connection *outputPort(void) override;
public:
void setColorMap(const QMap<double, QColor>&) override;
void setAlphaMap(const QMap<double, double>&);
......
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