Commit 7347fe3f authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

Merge branch 'release/2.17.0'

parents 5ed29c55 a728c40f
# Change Log:
# 2.17.0 14-Jan-2020
- use QVTKOpenGLNativeWidget (requires VTK 8.2.0 and up)
- fix display of menubar on macos in dtkVisualizationViewer
- stream tracer widget refactoring
- major update to decorators:
- fix draw/touch usage
- uniform coloring is available for all vector decorators
- management of color map can be enhanced especially to include opacity
- dtkVisualizationDecoratorScalarIsolines -> dtkVisualizationDecoratorIsocontours
- dtkVisualizationDecoratorScalarScalarColormap -> dtkVisualizationDecoratorSurfaceColor
- add cmake option to build with VTK git (```DTKVISUALIZATION_USE_UPCOMING_VTK```)
# 2.16.1 20-Dec-2019
- use vtkGlyph3DMapper in glyph decorators
......
......@@ -23,8 +23,8 @@ project(dtkVisualization)
## ###################################################################
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 16)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION_MINOR 17)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......@@ -93,6 +93,31 @@ option(DTKVISUALIZATION_USE_UPCOMING_VTK "" FALSE)
## Dependencies - external
## #################################################################
if(DTKVISUALIZATION_USE_UPCOMING_VTK)
find_package(VTK COMPONENTS
ChartsCore
CommonCore
CommonDataModel
FiltersFlowPaths
FiltersModeling
FiltersSources
GUISupportQt
InteractionImage
InteractionStyle
IOCore
IOImage
IOXML
RenderingAnnotation
RenderingContext2D
RenderingContextOpenGL2
RenderingCore
RenderingFreeType
RenderingGL2PSOpenGL2
RenderingOpenGL2
RenderingVolumeOpenGL2
ViewsContext2D
REQUIRED)
else(DTKVISUALIZATION_USE_UPCOMING_VTK)
find_package(VTK COMPONENTS
vtkChartsCore
vtkCommonCore
......@@ -109,6 +134,7 @@ find_package(VTK COMPONENTS
vtkRenderingVolumeOpenGL2
vtkViewsContext2D
REQUIRED)
endif(DTKVISUALIZATION_USE_UPCOMING_VTK)
if(NOT DTKVISUALIZATION_USE_UPCOMING_VTK)
include(${VTK_USE_FILE})
......
......@@ -190,9 +190,6 @@ dtkVisualizationViewer::dtkVisualizationViewer(QWidget *parent) : dtkWidgetsMain
dtkWidgetsParameterMenuBarGenerator menubar_generator(":menu.json", ":parameters.json");
menubar_generator.populate(this->menubar());
this->populate();
this->menubar()->touch();
QHash<QString, dtkCoreParameter *> parameters = menubar_generator.parameters();
......@@ -251,6 +248,10 @@ dtkVisualizationViewer::dtkVisualizationViewer(QWidget *parent) : dtkWidgetsMain
this->setAttribute(Qt::WA_DeleteOnClose);
this->setCentralWidget(widget);
this->setup();
this->populate();
this->menubar()->touch();
widget->stackUnder(this->titlebar());
}
dtkVisualizationViewer::~dtkVisualizationViewer(void)
......@@ -285,6 +286,9 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
if(!canvas)
return;
if (d->dataset)
d->dataset->Delete();
d->dataset = dtkVisualizationVTKReader(path);
if (!d->dataset) {
......@@ -299,10 +303,10 @@ 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;
//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;
......@@ -312,11 +316,11 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
dtkVisualizationDecoratorVolume *decorator_volume = new dtkVisualizationDecoratorVolume;
QList<dtkVisualizationDecorator *> decorators;
decorators << decorator_points
decorators //<< decorator_points
<< decorator_delaunay_2D
<< decorator_scalar_colormap
<< decorator_scalar_isolines
<< decorator_scalar_glyphs
<< decorator_surface_color
<< decorator_isocontours
//<< decorator_scalar_glyphs
<< decorator_vector_glyphs
<< decorator_vector_curved_glyphs
<< decorator_vector_streamlines
......
......@@ -14,7 +14,7 @@
#include <QtGui>
#include <QVTKOpenGLWidget.h>
#include <QVTKOpenGLNativeWidget.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <dtkCore>
......@@ -36,7 +36,7 @@ int main(int argc, char **argv)
dtk::widgets::initialize();
dtkThemesEngine::instance()->apply();
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
vtkOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples(0);
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
......@@ -55,7 +55,7 @@ int main(int argc, char **argv)
dtkWidgetsLayoutItem::setActions(actions);
dtkVisualizationViewer *viewer = new dtkVisualizationViewer;
viewer->setWindowTitle("dtkVisualizationViewer");
application->setWindow(viewer);
application->initialize();
......
......@@ -16,8 +16,8 @@ channels:
- dtk
dependencies:
- qt >=5.9.0
- vtk=8.1.2
- dtk-widgets >=2.11.2, <2.12
- vtk=8.2.0
- dtk-widgets >=2.12.0, <2.17
- gst-plugins-good
- gst-libav
......
......@@ -17,7 +17,7 @@ channels:
- dtk
dependencies:
- qt >=5.9.0
- vtk=8.1.2
- vtk=8.2.0
- dtk-widgets >=2.11.2
#
......
......@@ -2,9 +2,14 @@
mkdir build
cd build
if [[ "$c_compiler" == "gcc" ]]; then
export PATH="${PATH}:${BUILD_PREFIX}/${HOST}/sysroot/usr/lib:${BUILD_PREFIX}/${HOST}/sysroot/usr/include"
fi
cmake .. \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DDTKVISUALIZATION_USE_UPCOMING_VTK=OFF \
-DCMAKE_INSTALL_LIBDIR=lib
make -j${CPU_COUNT}
......
......@@ -44,10 +44,10 @@ requirements:
- qt >=5.9.0
- dtk-widgets >=2.12.0
- dtk-themes >=2.1.0,<2.2
- vtk >=8.1.2,<8.2.0
- vtk >=8.2.0
run:
- vtk >=8.1.2,<8.2.0
- vtk >=8.2.0
- qt >=5.9.0
- dtk-widgets >=2.12.0
- dtk-themes >=2.1.0,<2.2
......
......@@ -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"
......
......@@ -20,7 +20,7 @@
#include <QtGui>
#include <QtWidgets>
#include <QVTKOpenGLWidget.h>
#include <QVTKOpenGLNativeWidget.h>
#include <vtkCamera.h>
#include <vtkGenericOpenGLRenderWindow.h>
......@@ -34,7 +34,7 @@
// dtkVisualizationCanvasPrivate
// ///////////////////////////////////////////////////////////////////
class dtkVisualizationCanvasPrivate : public QVTKOpenGLWidget
class dtkVisualizationCanvasPrivate : public QVTKOpenGLNativeWidget
{
Q_OBJECT
......@@ -72,9 +72,9 @@ public:
// ///////////////////////////////////////////////////////////////////
dtkVisualizationCanvasPrivate::dtkVisualizationCanvasPrivate(QWidget *parent) : QVTKOpenGLWidget(parent)
dtkVisualizationCanvasPrivate::dtkVisualizationCanvasPrivate(QWidget *parent) : QVTKOpenGLNativeWidget(parent)
{
this->setFormat(QVTKOpenGLWidget::defaultFormat());
this->setFormat(QVTKOpenGLNativeWidget::defaultFormat());
this->renderer = vtkSmartPointer<vtkRenderer>::New();
this->renderer->SetBackground(0.290, 0.295, 0.300);
......@@ -111,7 +111,7 @@ QSize dtkVisualizationCanvasPrivate::sizeHint(void) const
void dtkVisualizationCanvasPrivate::resizeEvent(QResizeEvent *event)
{
QVTKOpenGLWidget::resizeEvent(event);
QVTKOpenGLNativeWidget::resizeEvent(event);
this->hud->resize(event->size());
}
......@@ -120,7 +120,7 @@ void dtkVisualizationCanvasPrivate::mousePressEvent(QMouseEvent *event)
{
q->emit focused();
QVTKOpenGLWidget::mousePressEvent(event);
QVTKOpenGLNativeWidget::mousePressEvent(event);
}
void dtkVisualizationCanvasPrivate::onFocus(void)
......
......@@ -23,6 +23,7 @@ class vtkRenderWindowInteractor;
class vtkScalarBarActor;
class dtkWidgetsHUD;
class QWidget;
class DTKVISUALIZATION_EXPORT dtkVisualizationCanvas : public dtkWidgetsWidget
......
......@@ -17,6 +17,9 @@
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsCategory>
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsColorDialog>
#include <dtkLog>
#include <QtGui>
......@@ -56,10 +59,11 @@ public:
public:
bool default_visibility;
QColor default_color = QColor();
public:
QCheckBox *show_actor_cb = nullptr;
QPushButton *color_button = nullptr;
dtkVisualizationWidgetsColorDialog *col_dialog = nullptr;
QDoubleSpinBox *opacity_spinbox = nullptr;
public:
......@@ -91,43 +95,59 @@ dtkVisualizationDecoratorDelaunay2D::dtkVisualizationDecoratorDelaunay2D(void):
d->actor->SetMapper(d->mapper);
d->actor->SetVisibility(d->default_visibility);
d->actor->GetProperty()->SetPointSize(30);
d->actor->GetProperty()->SetColor(0.5,0.5,0.5);
d->actor->GetProperty()->SetColor(d->default_color.red(),
d->default_color.green(),
d->default_color.blue());
//////////
// Inspectors creation
d->color_button = new QPushButton("Color");
d->opacity_spinbox = new QDoubleSpinBox;
d->show_actor_cb = new QCheckBox;
d->col_dialog = new dtkVisualizationWidgetsColorDialog;
d->col_dialog->setObjectName("Color");
d->opacity_spinbox = new QDoubleSpinBox;
d->opacity_spinbox->setObjectName("Opacity");
d->opacity_spinbox->setRange(0, 1);
d->opacity_spinbox->setDecimals(2);
d->opacity_spinbox->setSingleStep(0.01);
d->opacity_spinbox->setValue(1.);
d->show_actor_cb = new QCheckBox;
d->show_actor_cb->setObjectName("Display");
d->show_actor_cb->setChecked(d->default_visibility);
//////////
// Inspectors connections
connect(d->color_button, &QPushButton::released, [=] (void) {
double *vtk_color = d->actor->GetProperty()->GetColor();
QColor qt_color = QColor(vtk_color[0], vtk_color[1], vtk_color[2]);
qt_color = QColorDialog::getColor(qt_color, d->color_button);
this->setColor(qt_color);
connect(d->col_dialog, &dtkVisualizationWidgetsColorDialog::colorChanged, [=] (QColor c)
{
if (c.isValid()) {
this->saveSettings("color", c);
d->actor->GetProperty()->SetColor(c.red(), c.green(), c.blue());
this->draw();
}
});
connect(d->opacity_spinbox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &dtkVisualizationDecoratorDelaunay2D::setOpacity);
connect(d->opacity_spinbox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double opacity)
{
this->saveSettings("opacity", opacity);
d->actor->GetProperty()->SetOpacity(opacity);
this->draw();
});
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state) {
this->saveSettings("visibility",state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
connect(d->show_actor_cb, &QCheckBox::stateChanged, [=] (int state)
{
this->saveSettings("visibility",state == Qt::Checked);
this->setVisibility(state == Qt::Checked);
this->draw();
});
auto styling_box = new dtkVisualizationWidgetsCategory("Styling", {
d->col_dialog,
d->opacity_spinbox
});
d->inspectors << d->color_button << d->opacity_spinbox << d->show_actor_cb;
d->inspectors << d->show_actor_cb << styling_box;
}
dtkVisualizationDecoratorDelaunay2D::~dtkVisualizationDecoratorDelaunay2D(void)
......@@ -147,7 +167,13 @@ void dtkVisualizationDecoratorDelaunay2D::restoreSettings(void)
QSettings settings;
settings.beginGroup("canvas");
d->default_visibility = settings.value(name+"_visibility", false).toBool();
d->default_color = QColor(settings.value(name+"_color", "").toString());
double opacity = settings.value(name+"_opacity", 1.0).toDouble();
settings.endGroup();
this->setVisibility(d->default_visibility);
this->setColor(d->default_color);
this->setOpacity(opacity);
}
void dtkVisualizationDecoratorDelaunay2D::touch(void)
......@@ -229,7 +255,9 @@ void dtkVisualizationDecoratorDelaunay2D::setColor(const QColor& color)
{
d->actor->GetProperty()->SetColor(color.red(), color.green(), color.blue());
this->draw();
d->col_dialog->blockSignals(true);
d->col_dialog->setColor(d->default_color);
d->col_dialog->blockSignals(false);
}
void dtkVisualizationDecoratorDelaunay2D::setOpacity(const double& alpha)
......@@ -239,8 +267,6 @@ void dtkVisualizationDecoratorDelaunay2D::setOpacity(const double& alpha)
d->opacity_spinbox->blockSignals(true);
d->opacity_spinbox->setValue(alpha);
d->opacity_spinbox->blockSignals(false);
this->draw();
}
QVariant dtkVisualizationDecoratorDelaunay2D::data(void) const
......
#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"
......@@ -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