Commit 6176bb21 authored by ZUBIAGA Carlos J.'s avatar ZUBIAGA Carlos J.

Merge branch 'release/2.18.2'

parents ba69870b f838d779
# Change Log:
# 2.18.2 28-Jan-2020
- Fix set visibility for Streamlines decorator when source sphere widget doesn't have an interactor
# 2.18.1 28-Jan-2020
- Fix scalar bar position
# 2.18.0 16-Jan-2020
- update decorator API: add setInputConnection/outputPort
......
......@@ -24,7 +24,7 @@ project(dtkVisualization)
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 18)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION_PATCH 2)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......
......@@ -39,7 +39,6 @@
#include <vtkMatrix4x4.h>
#include <vtkPiecewiseFunction.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
......@@ -59,8 +58,7 @@
class dtkVisualizationDecoratorStreamlinesSphereObserver : public vtkCommand
{
private:
dtkVisualizationDecoratorStreamlinesSphereObserver(void) {
};
dtkVisualizationDecoratorStreamlinesSphereObserver(void) = default;
public:
static dtkVisualizationDecoratorStreamlinesSphereObserver *New(void)
......@@ -107,14 +105,15 @@ public:
QDoubleSpinBox *sp_start_pos_y = nullptr;
public:
double bounds[6];
double bounds[6]{};
};
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorVectorStreamlines implementation
// ///////////////////////////////////////////////////////////////////
dtkVisualizationDecoratorVectorStreamlines::dtkVisualizationDecoratorVectorStreamlines(void): dtkVisualizationDecoratorWithClut(), d(new dtkVisualizationDecoratorVectorStreamlinesPrivate())
dtkVisualizationDecoratorVectorStreamlines::dtkVisualizationDecoratorVectorStreamlines(void)
: dtkVisualizationDecoratorWithClut(), d(new dtkVisualizationDecoratorVectorStreamlinesPrivate())
{
vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New();
matrix->Identity();
......@@ -189,30 +188,27 @@ dtkVisualizationDecoratorVectorStreamlines::dtkVisualizationDecoratorVectorStrea
d->sp_start_pos_y->setDecimals(6);
d->sp_start_pos_y->setKeyboardTracking(false);
QHBoxLayout *h_layout_start_pos = new QHBoxLayout;
auto h_layout_start_pos = new QHBoxLayout;
h_layout_start_pos->addWidget(d->sp_start_pos_x);
h_layout_start_pos->addWidget(d->sp_start_pos_y);
QWidget *start_pos_widget = new QWidget;
auto start_pos_widget = new QWidget;
start_pos_widget->setObjectName("Start Position");
start_pos_widget->setLayout(h_layout_start_pos);
//////////
// Inspectors connections
connect(d->show_source_actor_cb, &QCheckBox::stateChanged, [=] (int state)
{
connect(d->show_source_actor_cb, &QCheckBox::stateChanged, [=](int state) {
d->source_sphere_widget->SetEnabled(state == Qt::Checked);
this->draw();
});
connect(d->sp_radius, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double val)
{
connect(d->sp_radius, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](double val) {
d->tube_filter->SetRadius(val);
this->draw();
});
connect(d->sp_start_pos_x, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double val)
{
connect(d->sp_start_pos_x, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](double val) {
double *pos = d->streamlines->GetStartPosition();
pos[0] = val;
......@@ -220,13 +216,13 @@ dtkVisualizationDecoratorVectorStreamlines::dtkVisualizationDecoratorVectorStrea
d->source_sphere->SetCenter(pos);
d->source_sphere->Modified();
//d->streamlines->Modified();
qDebug() << Q_FUNC_INFO << "Changing start position is not available since VTK crash. Have to wait for next version of VTK.";
qDebug() << Q_FUNC_INFO
<< "Changing start position is not available since VTK crash. Have to wait for next version of VTK.";
this->draw();
});
connect(d->sp_start_pos_y, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double val)
{
connect(d->sp_start_pos_y, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](double val) {
double *pos = d->streamlines->GetStartPosition();
pos[1] = val;
......@@ -234,7 +230,8 @@ dtkVisualizationDecoratorVectorStreamlines::dtkVisualizationDecoratorVectorStrea
d->source_sphere->SetCenter(pos);
d->source_sphere->Modified();
//d->streamlines->Modified();
qDebug() << Q_FUNC_INFO << "Changing start position is not available since VTK crash. Have to wait for next version of VTK.";
qDebug() << Q_FUNC_INFO
<< "Changing start position is not available since VTK crash. Have to wait for next version of VTK.";
this->draw();
});
......@@ -245,7 +242,7 @@ dtkVisualizationDecoratorVectorStreamlines::dtkVisualizationDecoratorVectorStrea
start_pos_widget,
d->sp_radius,
d_func()->opacity_widget
});
});
d_func()->inspectors << styling_box;
}
......@@ -262,8 +259,9 @@ dtkVisualizationDecoratorVectorStreamlines::~dtkVisualizationDecoratorVectorStre
void dtkVisualizationDecoratorVectorStreamlines::restoreSettings(void)
{
QString name = this->objectName();
if (name.isEmpty())
if (name.isEmpty()) {
return;
}
dtkVisualizationDecoratorWithClut::restoreSettings();
d->actor->SetVisibility(d_func()->default_visibility);
......@@ -272,15 +270,12 @@ void dtkVisualizationDecoratorVectorStreamlines::restoreSettings(void)
bool dtkVisualizationDecoratorVectorStreamlines::isCurrentFieldUniform(void)
{
auto r = d_func()->ranges[d_func()->current_field_name];
if (std::abs(r[0] - r[1]) < 1.e-12) {
return true;
}
return false;
return std::abs(r[0] - r[1]) < 1.e-12;
}
void dtkVisualizationDecoratorVectorStreamlines::setData(const QVariant& data)
{
vtkDataSet *dataset = data.value<vtkDataSet *>();
auto *dataset = data.value<vtkDataSet *>();
if (!dataset) {
dtkWarn() << Q_FUNC_INFO << "vtkDataSet is expected. Input data is not stored.";
......@@ -303,11 +298,12 @@ void dtkVisualizationDecoratorVectorStreamlines::setData(const QVariant& data)
dataset->GetBounds(d->bounds);
vtkBoundingBox box;
box.SetBounds(d->bounds);
double center[3]; box.GetCenter(center);
double center[3];
box.GetCenter(center);
d->sp_radius->blockSignals(true);
d->sp_radius->setValue(box.GetDiagonalLength()/500.0);
d->tube_filter->SetRadius(box.GetDiagonalLength()/500.0);
d->sp_radius->setValue(box.GetDiagonalLength() / 500.0);
d->tube_filter->SetRadius(box.GetDiagonalLength() / 500.0);
d->sp_radius->blockSignals(false);
d->transform_filter->SetInputData(dataset);
......@@ -318,14 +314,14 @@ void dtkVisualizationDecoratorVectorStreamlines::setData(const QVariant& data)
d->sp_start_pos_x->blockSignals(true);
d->sp_start_pos_x->setMinimum(d->bounds[0]);
d->sp_start_pos_x->setMaximum(d->bounds[1]);
d->sp_start_pos_x->setSingleStep(std::abs(d->bounds[1]-d->bounds[0])/100);
d->sp_start_pos_x->setSingleStep(std::abs(d->bounds[1] - d->bounds[0]) / 100);
d->sp_start_pos_x->setValue(center[0]);
d->sp_start_pos_x->blockSignals(false);
d->sp_start_pos_y->blockSignals(true);
d->sp_start_pos_y->setValue(center[1]);
d->sp_start_pos_y->setMinimum(d->bounds[2]);
d->sp_start_pos_y->setMaximum(d->bounds[3]);
d->sp_start_pos_y->setSingleStep(std::abs(d->bounds[3]-d->bounds[2])/100);
d->sp_start_pos_y->setSingleStep(std::abs(d->bounds[3] - d->bounds[2]) / 100);
d->sp_start_pos_y->blockSignals(false);
d->streamlines->Modified();
......@@ -388,7 +384,9 @@ void dtkVisualizationDecoratorVectorStreamlines::setVisibility(bool visible)
{
dtkVisualizationDecoratorWithClut::setVisibility(visible);
d->actor->SetVisibility(visible);
d->source_sphere_widget->SetEnabled(visible);
if (d->source_sphere_widget->GetInteractor()) {
d->source_sphere_widget->SetEnabled(visible);
}
}
bool dtkVisualizationDecoratorVectorStreamlines::setCurrentFieldName(const QString& field_name)
......@@ -403,8 +401,9 @@ bool dtkVisualizationDecoratorVectorStreamlines::setCurrentFieldName(const QStri
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";
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;
}
......@@ -412,9 +411,10 @@ bool dtkVisualizationDecoratorVectorStreamlines::setCurrentFieldName(const QStri
using Support = dtkVisualizationDecoratorWithClut::Support;
int support = d_func()->supports[field_name];
if(support == Support::Point) {
d->streamlines->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, qPrintable(field_name));
} else if(support == Support::Cell) {
if (support == Support::Point) {
d->streamlines->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS,
qPrintable(field_name));
} else if (support == Support::Cell) {
d->streamlines->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, qPrintable(field_name));
}
d->streamlines->Modified();
......
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