Commit 8a373c36 authored by LE BRETON Come's avatar LE BRETON Come

Displays iso(lines-surfaces). Need to adjust the controls.

parent c4fad44b
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <dtkVisualization/dtkVisualizationView3D> #include <dtkVisualization/dtkVisualizationView3D>
#include <dtkVisualization/dtkVisualizationDecoratorScalarColorMap> #include <dtkVisualization/dtkVisualizationDecoratorScalarColorMap>
#include <dtkVisualization/dtkVisualizationDecoratorScalarIsoline>
#include <dtkVisualization/dtkVisualizationVTKReader> #include <dtkVisualization/dtkVisualizationVTKReader>
...@@ -150,11 +151,19 @@ void dtkVisualizationViewer::importDataSet(const QString& path) ...@@ -150,11 +151,19 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
} }
vtkDataSet *dataset = dtkVisualizationVTKReader(path); vtkDataSet *dataset = dtkVisualizationVTKReader(path);
dtkVisualizationDecoratorScalarColorMap* decorator = new dtkVisualizationDecoratorScalarColorMap;
decorator->setCanvas(view_3d);
QVariant data = dtk::variantFromValue(dataset); QVariant data = dtk::variantFromValue(dataset);
decorator->setData(data);
decorator->render(); dtkVisualizationDecoratorScalarColorMap *decorator_scalar_color_map = new dtkVisualizationDecoratorScalarColorMap;
decorator_scalar_color_map->setCanvas(view_3d);
decorator_scalar_color_map->setData(data);
dtkVisualizationDecoratorScalarIsoline *decorator_scalar_isoline = new dtkVisualizationDecoratorScalarIsoline;
decorator_scalar_isoline->setCanvas(view_3d);
decorator_scalar_isoline->setData(data);
(*decorator_scalar_color_map) << decorator_scalar_isoline;
decorator_scalar_color_map->render();
} }
void dtkVisualizationViewer::setRopeSource(QWidget *source) void dtkVisualizationViewer::setRopeSource(QWidget *source)
......
...@@ -36,7 +36,7 @@ protected: ...@@ -36,7 +36,7 @@ protected:
void draw(void) override; void draw(void) override;
public: public:
void setData(const QVariant&) override; void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override; void setCanvas(dtkVisualizationCanvas *) override;
public: public:
......
...@@ -16,25 +16,51 @@ ...@@ -16,25 +16,51 @@
#include <dtkVisualizationExport> #include <dtkVisualizationExport>
#include <QtCore>
#include "dtkVisualizationDecorator.h" #include "dtkVisualizationDecorator.h"
#include <vtkSmartPointer.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorScalarIsoline declaration // dtkVisualizationDecoratorScalarIsoline declaration
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarIsoline : public dtkVisualizationDecorator class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarIsoline : public dtkVisualizationDecorator
{ {
Q_OBJECT
public: public:
dtkVisualizationDecoratorScalarIsoline(void); dtkVisualizationDecoratorScalarIsoline(void);
~dtkVisualizationDecoratorScalarIsoline(void); ~dtkVisualizationDecoratorScalarIsoline(void);
public: public:
void setData(const QVariant&) override; void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override; void setCanvas(dtkVisualizationCanvas *) override;
protected: protected:
void draw(void) override; void draw(void) override;
public:
QStringList eligibleFieldNames(void);
QString currentFieldName(void);
QPair<double, double> currentRange(void);
vtkSmartPointer<vtkColorTransferFunction> currentColorTransferFunction(void);
vtkSmartPointer<vtkPiecewiseFunction> currentOpacityTransferFunction(void);
public:
bool setCurrentFieldName(const QString&);
void setCurrentColorTransferFunction(vtkSmartPointer<vtkColorTransferFunction>);
void setCurrentOpacityTransferFunction(vtkSmartPointer<vtkPiecewiseFunction>);
void setCurrentRange(double min, double max);
signals:
void currentFieldNameChanged(const QString&);
void currentColorTransferFunctionChanged(vtkColorTransferFunction *);
void currentOpacityFunctionChanged(vtkPiecewiseFunction *);
void currentRangeChanged(double, double);
protected: protected:
class dtkVisualizationDecoratorScalarIsolinePrivate *d = nullptr; class dtkVisualizationDecoratorScalarIsolinePrivate *d = nullptr;
}; };
......
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