Commit c5566d09 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

Merge branch 'feature/stream-tracer-widgets' into feature/vtk-native

parents b3643e8f 4db817d3
......@@ -301,11 +301,11 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
dtkVisualizationDecoratorInfo *decorator_info = new dtkVisualizationDecoratorInfo;
dtkVisualizationDecoratorAxes *decorator_axes = new dtkVisualizationDecoratorAxes;
dtkVisualizationDecoratorDelaunay2D *decorator_delaunay_2D = new dtkVisualizationDecoratorDelaunay2D;
dtkVisualizationDecoratorPoints *decorator_points = new dtkVisualizationDecoratorPoints;
dtkVisualizationDecoratorScalarColorMap *decorator_scalar_colormap = new dtkVisualizationDecoratorScalarColorMap;
dtkVisualizationDecoratorScalarGlyphs *decorator_scalar_glyphs = new dtkVisualizationDecoratorScalarGlyphs;
dtkVisualizationDecoratorScalarIsolines *decorator_scalar_isolines = new dtkVisualizationDecoratorScalarIsolines;
//dtkVisualizationDecoratorDelaunay2D *decorator_delaunay_2D = new dtkVisualizationDecoratorDelaunay2D;
//dtkVisualizationDecoratorPoints *decorator_points = new dtkVisualizationDecoratorPoints;
dtkVisualizationDecoratorSurfaceColor *decorator_surface_color = new dtkVisualizationDecoratorSurfaceColor;
//dtkVisualizationDecoratorScalarGlyphs *decorator_scalar_glyphs = new dtkVisualizationDecoratorScalarGlyphs;
dtkVisualizationDecoratorIsocontours *decorator_isocontours = new dtkVisualizationDecoratorIsocontours;
dtkVisualizationDecoratorSlices *decorator_slices = new dtkVisualizationDecoratorSlices;
dtkVisualizationDecoratorSnapshot *decorator_snapshot = new dtkVisualizationDecoratorSnapshot;
dtkVisualizationDecoratorVectorGlyphs *decorator_vector_glyphs = new dtkVisualizationDecoratorVectorGlyphs;
......@@ -315,11 +315,11 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
dtkVisualizationDecoratorVolume *decorator_volume = new dtkVisualizationDecoratorVolume;
QList<dtkVisualizationDecorator *> decorators;
decorators << decorator_points
<< decorator_delaunay_2D
<< decorator_scalar_colormap
<< decorator_scalar_isolines
<< decorator_scalar_glyphs
decorators //<< decorator_points
//<< decorator_delaunay_2D
<< decorator_surface_color
<< decorator_isocontours
//<< decorator_scalar_glyphs
<< decorator_vector_glyphs
<< decorator_vector_curved_glyphs
<< decorator_vector_streamlines
......
......@@ -33,20 +33,20 @@ set(${PROJECT_NAME}_HEADERS
dtkVisualizationDecoratorClutEditorBase.h
dtkVisualizationDecoratorClutEditorSimple
dtkVisualizationDecoratorClutEditorSimple.h
dtkVisualizationDecoratorSurfaceColor
dtkVisualizationDecoratorSurfaceColor.h
dtkVisualizationDecoratorCollection
dtkVisualizationDecoratorCollection.h
dtkVisualizationDecoratorDelaunay2D
dtkVisualizationDecoratorDelaunay2D.h
dtkVisualizationDecoratorInfo
dtkVisualizationDecoratorInfo.h
dtkVisualizationDecoratorIsocontours
dtkVisualizationDecoratorIsocontours.h
dtkVisualizationDecoratorPoints
dtkVisualizationDecoratorPoints.h
dtkVisualizationDecoratorScalarColorMap
dtkVisualizationDecoratorScalarColorMap.h
dtkVisualizationDecoratorScalarGlyphs
dtkVisualizationDecoratorScalarGlyphs.h
dtkVisualizationDecoratorScalarIsolines
dtkVisualizationDecoratorScalarIsolines.h
dtkVisualizationDecoratorSlices
dtkVisualizationDecoratorSlices.h
dtkVisualizationDecoratorSnapshot
......@@ -99,13 +99,13 @@ set(${PROJECT_NAME}_SOURCES
dtkVisualizationDecoratorAxes.cpp
dtkVisualizationDecoratorClutEditor.cpp
dtkVisualizationDecoratorClutEditorSimple.cpp
dtkVisualizationDecoratorSurfaceColor.cpp
dtkVisualizationDecoratorCollection.cpp
dtkVisualizationDecoratorDelaunay2D.cpp
dtkVisualizationDecoratorInfo.cpp
dtkVisualizationDecoratorIsocontours.cpp
dtkVisualizationDecoratorPoints.cpp
dtkVisualizationDecoratorScalarColorMap.cpp
dtkVisualizationDecoratorScalarGlyphs.cpp
dtkVisualizationDecoratorScalarIsolines.cpp
dtkVisualizationDecoratorSlices.cpp
dtkVisualizationDecoratorSnapshot.cpp
dtkVisualizationDecoratorVectorCurvedGlyphs.cpp
......
......@@ -5,12 +5,12 @@
#include "dtkVisualizationDecoratorClutEditor.h"
#include "dtkVisualizationDecoratorClutEditorBase.h"
#include "dtkVisualizationDecoratorClutEditorSimple.h"
#include "dtkVisualizationDecoratorSurfaceColor.h"
#include "dtkVisualizationDecoratorCollection.h"
#include "dtkVisualizationDecoratorDelaunay2D.h"
#include "dtkVisualizationDecoratorInfo.h"
#include "dtkVisualizationDecoratorIsocontours.h"
#include "dtkVisualizationDecoratorPoints.h"
#include "dtkVisualizationDecoratorScalarColorMap.h"
#include "dtkVisualizationDecoratorScalarIsolines.h"
#include "dtkVisualizationDecoratorScalarGlyphs.h"
#include "dtkVisualizationDecoratorSlices.h"
#include "dtkVisualizationDecoratorSnapshot.h"
......
#include "dtkVisualizationDecoratorIsocontours.h"
......@@ -18,26 +18,27 @@
#include "dtkVisualizationDecoratorWithClut.h"
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarIsolines : public dtkVisualizationDecoratorWithClut
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorIsocontours : public dtkVisualizationDecoratorWithClut
{
Q_OBJECT
public:
dtkVisualizationDecoratorScalarIsolines(void);
~dtkVisualizationDecoratorScalarIsolines(void);
dtkVisualizationDecoratorIsocontours(void);
~dtkVisualizationDecoratorIsocontours(void);
public:
void touch(void) override;
protected:
void touchRange(void) override;
public:
void setData(const QVariant&) override;
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
void unsetCanvas(void) override;
void unsetCanvas(void) override;
protected:
void restoreSettings(void) override;
void setCurrentRange(double, double) override;
bool setCurrentFieldName(const QString&) override;
bool setCurrentFieldName(const QString&) override;
void setColorMap(const QMap<double, QColor>&) override;
void setOpacity(double) override;
public:
void setVisibility(bool) override;
......@@ -46,8 +47,11 @@ public:
void setCurrentIsolinesCount(std::size_t);
protected:
class dtkVisualizationDecoratorScalarIsolinesPrivate *d = nullptr;
void updateContours(void);
protected:
class dtkVisualizationDecoratorIsocontoursPrivate *d = nullptr;
};
//
// dtkVisualizationDecoratorScalarIsolines.h ends here
// dtkVisualizationDecoratorIsocontours.h ends here
#include "dtkVisualizationDecoratorScalarColorMap.h"
\ No newline at end of file
......@@ -15,11 +15,11 @@
#include "dtkVisualizationDecoratorScalarGlyphs.h"
#include "dtkVisualizationDecoratorWithClut_p.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgetsCategory.h>
#include <dtkLog>
#include <QtGui>
......@@ -66,7 +66,6 @@ public:
vtkSmartPointer<vtkCellCenters> cell_centers;
public:
QCheckBox *show_actor_cb = nullptr;
QDoubleSpinBox *glyphs_size_sb = nullptr;
QComboBox *glyphs_source_cb = nullptr;
......@@ -130,18 +129,15 @@ dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(voi
d->actor->SetMapper(d->mapper);
//////////
// Inspectors creation
// Inspectors
d->show_actor_cb = new QCheckBox;
d->glyphs_size_sb = new QDoubleSpinBox;
d->glyphs_source_cb = new QComboBox;
//////////
// Inspectors setup
d->glyphs_size_sb->setObjectName("Glyphs Size");
d->glyphs_size_sb->setMaximum(1000);
d->glyphs_size_sb->setKeyboardTracking(false);
d->glyphs_source_cb = new QComboBox;
d->glyphs_source_cb->setObjectName("Source Shape");
d->glyphs_source_cb->addItem("Arrow");
d->glyphs_source_cb->addItem("Cube");
d->glyphs_source_cb->addItem("Cylinder");
......@@ -151,7 +147,7 @@ dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(voi
//////////
// Inspectors connections
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
connect(d_func()->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
this->saveSettings("visibility",state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
......@@ -191,11 +187,13 @@ dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(voi
});
this->setObjectName("Scalar Glyphs");
d->show_actor_cb->setObjectName("Display");
d->glyphs_size_sb->setObjectName("Glyphs Size");
d->glyphs_source_cb->setObjectName("Source Shape");
d_func()->inspectors << d->show_actor_cb << d->glyphs_size_sb << d->glyphs_source_cb;
QWidget *styling_box = new dtkVisualizationWidgetsCategory("Styling", {
d->glyphs_size_sb,
d->glyphs_source_cb
});
d_func()->inspectors << styling_box;
}
dtkVisualizationDecoratorScalarGlyphs::~dtkVisualizationDecoratorScalarGlyphs(void)
......@@ -219,11 +217,6 @@ void dtkVisualizationDecoratorScalarGlyphs::restoreSettings(void)
d->default_glyph_size = settings.value(name+"_glyph_size", 1.0).toDouble();
d->default_glyph_shape = settings.value(name+"_glyph_shape", "Sphere").toString();
settings.endGroup();
d->actor->SetVisibility(d_func()->default_visibility);
d->show_actor_cb->blockSignals(true);
d->show_actor_cb->setChecked(d_func()->default_visibility);
d->show_actor_cb->blockSignals(false);
}
void dtkVisualizationDecoratorScalarGlyphs::setData(const QVariant& data)
......@@ -454,19 +447,6 @@ void dtkVisualizationDecoratorScalarGlyphs::setColorMap(const QMap<double, QColo
auto&& range = d_func()->ranges[d_func()->current_field_name];
d->mapper->SetScalarRange(range[0], range[1]);
d->mapper->Modified();
// Set opacity
// int size = opacity_function->GetSize();
// double val[4];
// double opacity_min = 1.;
// for(std::size_t i = 0; i < size; ++i) {
// opacity_function->GetNodeValue(i, val);
// if(val[1] < opacity_min) opacity_min = val[1];
// }
// d->actor->GetProperty()->SetOpacity(opacity_min);
// d->actor->Modified();
}
void *dtkVisualizationDecoratorScalarGlyphs::glyphs(void)
......
#include "dtkVisualizationDecoratorScalarIsolines.h"
......@@ -13,10 +13,13 @@
// Code:
#include "dtkVisualizationDecoratorSlices.h"
#include "dtkVisualizationDecoratorWithClut_p.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsCategory>
#include <dtkLog>
#include <dtkVisualizationWidgets>
......@@ -96,7 +99,6 @@ public:
vtkSmartPointer<vtkCellDataToPointData> c2p_filter;
public:
QCheckBox *show_actor_cb = nullptr;
dtkVisualizationWidgetsSliceControls *enable_slicing_x = nullptr;
dtkVisualizationWidgetsSliceControls *enable_slicing_y = nullptr;
dtkVisualizationWidgetsSliceControls *enable_slicing_z = nullptr;
......@@ -174,7 +176,6 @@ dtkVisualizationDecoratorSlices::dtkVisualizationDecoratorSlices(void): dtkVisua
d->volume_slice_y = vtkImagePlaneWidget::New();
d->volume_slice_z = vtkImagePlaneWidget::New();
d->show_actor_cb = new QCheckBox;
d->enable_slicing_x = new dtkVisualizationWidgetsSliceControls;
d->enable_slicing_y = new dtkVisualizationWidgetsSliceControls;
d->enable_slicing_z = new dtkVisualizationWidgetsSliceControls;
......@@ -194,12 +195,6 @@ dtkVisualizationDecoratorSlices::dtkVisualizationDecoratorSlices(void): dtkVisua
//////////
// 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->enable_slicing_x, &dtkVisualizationWidgetsSliceControls::toggled, [=] (bool checked) {
d->volume_slice_x->SetEnabled(checked);
this->draw();
......@@ -256,12 +251,16 @@ dtkVisualizationDecoratorSlices::dtkVisualizationDecoratorSlices(void): dtkVisua
this->setObjectName("Slices");
d->show_actor_cb->setObjectName("Display");
d->enable_slicing_x->setObjectName("X");
d->enable_slicing_y->setObjectName("Y");
d->enable_slicing_z->setObjectName("Z");
d_func()->inspectors << d->show_actor_cb << d->enable_slicing_x << d->enable_slicing_y << d->enable_slicing_z ;
d_func()->inspectors << new dtkVisualizationWidgetsCategory("Slices Positions", {
d->enable_slicing_x,
d->enable_slicing_y,
d->enable_slicing_z
});
}
dtkVisualizationDecoratorSlices::~dtkVisualizationDecoratorSlices(void)
......@@ -272,6 +271,20 @@ dtkVisualizationDecoratorSlices::~dtkVisualizationDecoratorSlices(void)
d = nullptr;
}
bool dtkVisualizationDecoratorSlices::isDecorating(void)
{
auto img = vtkImageData::SafeDownCast(d_func()->dataset);
if (!img) {
return false;
}
auto dims = img->GetDimensions();
if (dims[0] == 1 || dims[1] == 1 || dims[2] == 1) {
return false;
}
return dtkVisualizationDecoratorWithClut::isDecorating();
}
void dtkVisualizationDecoratorSlices::setData(const QVariant& data)
{
vtkDataSet *dataset = data.value<vtkDataSet *>();
......@@ -284,12 +297,12 @@ void dtkVisualizationDecoratorSlices::setData(const QVariant& data)
d_func()->retrieveScalarPoints(dataset);
d_func()->retrieveScalarCells(dataset);
d_func()->dataset = dataset;
if (!this->isDecorating()) {
dtkWarn() << Q_FUNC_INFO << "vtkDataSet has no field to decorate. Nothing is done.";
d_func()->clear();
return;
}
d_func()->dataset = dataset;
d->c2p_filter->SetInputData(dataset);
this->restoreSettings();
......@@ -325,7 +338,6 @@ void dtkVisualizationDecoratorSlices::setCanvas(dtkVisualizationCanvas *canvas)
d->setupSlices();
}
d_func()->enableScalarBar();
}
......@@ -359,59 +371,51 @@ void dtkVisualizationDecoratorSlices::restoreSettings(void)
dtkVisualizationDecoratorWithClut::restoreSettings();
d->show_actor_cb->blockSignals(true);
d->show_actor_cb->setChecked(d_func()->default_visibility);
d->show_actor_cb->blockSignals(false);
d->start_on = d_func()->default_visibility;
}
void dtkVisualizationDecoratorSlices::touch(void)
{
dtkVisualizationDecoratorWithClut::touch();
vtkSmartPointer<vtkImageData> data = vtkImageData::SafeDownCast(d->c2p_filter->GetOutput());
d->c2p_filter->Update();
data->GetPointData()->SetActiveScalars(qPrintable(d_func()->current_field_name));
d->volume_slice_x->SetInputData(data);
d->volume_slice_y->SetInputData(data);
d->volume_slice_z->SetInputData(data);
d->volume_slice_x->SetSlicePosition(d->enable_slicing_x->value());
d->volume_slice_y->SetSlicePosition(d->enable_slicing_y->value());
d->volume_slice_z->SetSlicePosition(d->enable_slicing_z->value());
}
bool dtkVisualizationDecoratorSlices::setCurrentFieldName(const QString& field_name)
{
if (!dtkVisualizationDecoratorWithClut::setCurrentFieldName(field_name)) {
if (field_name.isEmpty()) {
dtkWarn() << Q_FUNC_INFO << "Field name is empty, nothing is done.";
return false;
}
if (!d_func()->dataset) {
dtkWarn() << Q_FUNC_INFO << "Before calling setCurrentFieldName, setDataSet must be called.";
return false;
}
if(!d_func()->eligible_field_names.contains(field_name)) {
dtkWarn() << Q_FUNC_INFO << "The field name :" << field_name << "that was specified doesn't match any of the eligible scalar field names";
return false;
}
using Support = dtkVisualizationDecoratorWithClut::Support;
int support = d_func()->supports[field_name];
if(support == Support::Cell) {
d->c2p_filter->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, qPrintable(field_name));
vtkSmartPointer<vtkImageData> data = vtkImageData::SafeDownCast(d->c2p_filter->GetOutput());
d->c2p_filter->Update();
data->GetPointData()->SetActiveScalars(qPrintable(field_name));
d->volume_slice_x->SetInputData(data);
d->volume_slice_y->SetInputData(data);
d->volume_slice_z->SetInputData(data);
} else {
if(support == Support::Point) {
d->volume_slice_x->SetInputData(d_func()->dataset);
d->volume_slice_y->SetInputData(d_func()->dataset);
d->volume_slice_z->SetInputData(d_func()->dataset);
} else if(support == Support::Cell) {
d->c2p_filter->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, qPrintable(field_name));
d->volume_slice_x->SetInputConnection(d->c2p_filter->GetOutputPort());
d->volume_slice_y->SetInputConnection(d->c2p_filter->GetOutputPort());
d->volume_slice_z->SetInputConnection(d->c2p_filter->GetOutputPort());
d->c2p_filter->Modified();
}
d->volume_slice_x->SetSlicePosition(d->enable_slicing_x->value());
d->volume_slice_y->SetSlicePosition(d->enable_slicing_y->value());
d->volume_slice_z->SetSlicePosition(d->enable_slicing_z->value());
return true;
return dtkVisualizationDecoratorWithClut::setCurrentFieldName(field_name);
}
void dtkVisualizationDecoratorSlices::setColorMap(const QMap<double, QColor>& new_colormap)
......
......@@ -31,7 +31,9 @@ public:
void setCanvas(dtkVisualizationCanvas *) override;
void unsetCanvas(void) override;
void touch(void) override;
public:
bool isDecorating(void) override;
bool setCurrentFieldName(const QString&) override;
public:
......
#include "dtkVisualizationDecoratorSurfaceColor.h"
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
// dtkVisualizationDecoratorSurfaceColor.cpp
//
// Code:
#include "dtkVisualizationDecoratorSurfaceColor.h"
#include "dtkVisualizationDecoratorScalarColorMap.h"
#include "dtkVisualizationDecoratorWithClut_p.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgetsCategory.h>
#include <dtkLog>
#include <QtGui>
......@@ -35,27 +27,21 @@
#include <vtkTransform.h>
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorScalarColorMapPrivate declaration
// dtkVisualizationDecoratorSurfaceColorPrivate declaration
// ///////////////////////////////////////////////////////////////////
class dtkVisualizationDecoratorScalarColorMapPrivate
class dtkVisualizationDecoratorSurfaceColorPrivate
{
public:
vtkSmartPointer<vtkActor> actor;
vtkSmartPointer<vtkDataSetMapper> mapper;
public:
QCheckBox *show_actor_cb = nullptr;
public slots:
void onCanvasFocused(void);
};
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorScalarColorMap implementation
// dtkVisualizationDecoratorSurfaceColor implementation
// ///////////////////////////////////////////////////////////////////
dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap(void): dtkVisualizationDecoratorWithClut(), d(new dtkVisualizationDecoratorScalarColorMapPrivate())
dtkVisualizationDecoratorSurfaceColor::dtkVisualizationDecoratorSurfaceColor(void): dtkVisualizationDecoratorWithClut(), d(new dtkVisualizationDecoratorSurfaceColorPrivate())
{
d->mapper = vtkSmartPointer<vtkDataSetMapper>::New();
d->mapper->SetColorModeToMapScalars();
......@@ -64,28 +50,26 @@ dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap
d->actor = vtkSmartPointer<vtkActor>::New();
d->actor->SetMapper(d->mapper);
//////////
// Inspectors creation
d->show_actor_cb = new QCheckBox;
//////////
// 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_func()->show_actor_cb, &QCheckBox::stateChanged, [=] (int state)
{
this->saveSettings("visibility",state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
});
this->setObjectName("Scalar ColorMap");
d->show_actor_cb->setObjectName("Display");
this->setObjectName("Surface Color");
d_func()->inspectors << d->show_actor_cb;
QWidget *styling_box = new dtkVisualizationWidgetsCategory("Styling", {
d_func()->opacity_widget
});
d_func()->inspectors << styling_box;
}
dtkVisualizationDecoratorScalarColorMap::~dtkVisualizationDecoratorScalarColorMap(void)
dtkVisualizationDecoratorSurfaceColor::~dtkVisualizationDecoratorSurfaceColor(void)
{
this->unsetCanvas();
......@@ -93,7 +77,7 @@ dtkVisualizationDecoratorScalarColorMap::~dtkVisualizationDecoratorScalarColorMa
d = nullptr;
}
void dtkVisualizationDecoratorScalarColorMap::setData(const QVariant& data)
void dtkVisualizationDecoratorSurfaceColor::setData(const QVariant& data)
{
vtkDataSet *dataset = data.value<vtkDataSet *>();
if (!dataset) {
......@@ -104,6 +88,8 @@ void dtkVisualizationDecoratorScalarColorMap::setData(const QVariant& data)
d_func()->clear();
d_func()->retrieveScalarPoints(dataset);
d_func()->retrieveScalarCells(dataset);
d_func()->retrieveVectorPoints(dataset);
d_func()->retrieveVectorCells(dataset);
if (!this->isDecorating()) {
dtkWarn() << Q_FUNC_INFO << "vtkDataSet has no field to decorate. Nothing is done.";
......@@ -124,7 +110,7 @@ void dtkVisualizationDecoratorScalarColorMap::setData(const QVariant& data)
d_func()->enableScalarBar();
}
void dtkVisualizationDecoratorScalarColorMap::setCanvas(dtkVisualizationCanvas *canvas)
void dtkVisualizationDecoratorSurfaceColor::setCanvas(dtkVisualizationCanvas *canvas)
{
this->unsetCanvas();
......@@ -141,7 +127,7 @@ void dtkVisualizationDecoratorScalarColorMap::setCanvas(dtkVisualizationCanvas *
d_func()->enableScalarBar();
}
void dtkVisualizationDecoratorScalarColorMap::unsetCanvas(void)
void dtkVisualizationDecoratorSurfaceColor::unsetCanvas(void)
{
if (d_func()->view) {
d_func()->view->renderer()->RemoveActor(d->actor);
......@@ -152,24 +138,24 @@ void dtkVisualizationDecoratorScalarColorMap::unsetCanvas(void)
d_func()->view = nullptr;
}
void dtkVisualizationDecoratorScalarColorMap::setVisibility(bool visible)
void dtkVisualizationDecoratorSurfaceColor::setVisibility(bool visible)
{
d->actor->SetVisibility(visible);
dtkVisualizationDecoratorWithClut::setVisibility(visible);
}
void dtkVisualizationDecoratorScalarColorMap::restoreSettings(void)
void dtkVisualizationDecoratorSurfaceColor::setOpacity(double opacity)
{
dtkVisualizationDecoratorWithClut::restoreSettings();
d->actor->SetVisibility(d_func()->default_visibility);
d->show_actor_cb->blockSignals(true);
d->show_actor_cb->setChecked(d_func()->default_visibility);
d->show_actor_cb->blockSignals(false);
d->actor->GetProperty()->SetOpacity(opacity);
d->actor->Modified();
}
void dtkVisualizationDecoratorSurfaceColor::restoreSettings(void)
{
dtkVisualizationDecoratorWithClut::restoreSettings();
}
bool dtkVisualizationDecoratorScalarColorMap::setCurrentFieldName(const QString& field_name)
bool dtkVisualizationDecoratorSurfaceColor::setCurrentFieldName(const QString& field_name)
{
if (!dtkVisualizationDecoratorWithClut::setCurrentFieldName(field_name)) {
return false;
......@@ -188,7 +174,7 @@ bool dtkVisualizationDecoratorScalarColorMap::setCurrentFieldName(const QString&
return true;
}
void dtkVisualizationDecoratorScalarColorMap::setColorMap(const QMap<double, QColor>& new_colormap)
void dtkVisualizationDecoratorSurfaceColor::setColorMap(const QMap<double, QColor>& new_colormap)
{
dtkVisualizationDecoratorWithClut::setColorMap(new_colormap);
......@@ -197,29 +183,13 @@ void dtkVisualizationDecoratorScalarColorMap::setColorMap(const QMap<double, QCo
auto&& range = d_func()->ranges[d_func()->current_field_name];
d->mapper->SetScalarRange(range[0], range[1]);
d->mapper->Modified();
// -- set opacity
// int size = opacity_function->GetSize();
// double val[4];
// double opacity_min = 1.;
// for(std::size_t i = 0; i < size; ++i) {
// opacity_function->GetNodeValue(i, val);
// if(val[1] < opacity_min) opacity_min = val[1];
// }
// d->actor->GetProperty()->SetOpacity(opacity_min);
// d->actor->Modified();
}
void dtkVisualizationDecoratorScalarColorMap::setTransform(vtkTransform *transform)
void dtkVisualizationDecoratorSurfaceColor::setTransform(vtkTransform *transform)
{
d_func()->transform = transform;
d->actor->SetUserTransform(transform);
}
// /////////////////////////////////////////////////////////////////////////////
//
// dtkVisualizationDecoratorScalarColorMap.cpp ends here
// dtkVisualizationDecoratorSurfaceColor.cpp ends here
// Version: $Id$
// dtkVisualizationDecoratorSurfaceColor.h
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
......@@ -18,13 +7,13 @@
#include "dtkVisualizationDecoratorWithClut.h"
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarColorMap : public dtkVisualizationDecoratorWithClut
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorSurfaceColor : public dtkVisualizationDecoratorWithClut
{
Q_OBJECT
public:
dtkVisualizationDecoratorScalarColorMap(void);
~dtkVisualizationDecoratorScalarColorMap(void);
dtkVisualizationDecoratorSurfaceColor(void);
~dtkVisualizationDecoratorSurfaceColor(void);
public:
void setData(const QVariant&) override;
......@@ -35,17 +24,15 @@ public:
public:
void setVisibility(bool) override;
// /////////////////////////////////////////////////////////////////////////////