Commit 6739142a authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

call setData with data from the producer

parent 4c2d9b22
......@@ -15,6 +15,7 @@
#include <QtWidgets>
#include <vtkActor.h>
#include <vtkAlgorithmOutput.h>
#include <vtkColorTransferFunction.h>
#include <vtkCellData.h>
#include <vtkDataSet.h>
......@@ -147,10 +148,15 @@ void dtkVisualizationDecoratorSurfaceColor::setVisibility(bool 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);
}
dtkVisualizationDecoratorSurfaceColor::Connection *dtkVisualizationDecoratorSurfaceColor::outputPort(void)
dtkVisualizationDecorator::Connection *dtkVisualizationDecoratorSurfaceColor::outputPort(void)
{
return d->mapper->GetOutputPort();
}
......
......@@ -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