Commit 3e565ecd authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud

Archive of changes

parent 2a0c063f
......@@ -110,7 +110,14 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
QList<dtkVisualizationDecorator *> decorators;
decorators << decorator_scalar_colormap << decorator_scalar_isolines;// << decorator_scalar_glyphs;
if (decorator_scalar_colormap->decorate())
decorators << decorator_scalar_colormap;
if (decorator_scalar_isolines->decorate())
decorators << decorator_scalar_isolines ;
if (decorator_scalar_glyphs->decorate())
decorators << decorator_scalar_glyphs;
dtkWidgetsMenuBar *menu_bar = dtkApp->window()->menubar();
......
......@@ -190,13 +190,14 @@ vtkRenderWindowInteractor *dtkVisualizationCanvas::interactor(void)
void dtkVisualizationCanvas::addScalarBar(vtkScalarBarActor *scalar_bar)
{
++d->nb_scalar_bars;
if (this->renderer()) {
++d->nb_scalar_bars;
std::size_t orientation = d->nb_scalar_bars % 2; // 0: horizontal, 1: vertical
std::size_t side = (d->nb_scalar_bars % 4) >= 2; // 0: right, 1: left
std::size_t loop = d->nb_scalar_bars / 4;
std::size_t orientation = d->nb_scalar_bars % 2; // 0: horizontal, 1: vertical
std::size_t side = (d->nb_scalar_bars % 4) >= 2; // 0: right, 1: left
std::size_t loop = d->nb_scalar_bars / 4;
scalar_bar->SetOrientation(orientation);
scalar_bar->SetOrientation(orientation);
double xref = 0.9;
double yref = 1;
......@@ -209,15 +210,14 @@ void dtkVisualizationCanvas::addScalarBar(vtkScalarBarActor *scalar_bar)
yref = 0.9;
}
scalar_bar->SetWidth(width);
scalar_bar->SetHeight(height);
scalar_bar->SetWidth(width);
scalar_bar->SetHeight(height);
double x = (xref - width) * double(!side && !orientation) + (xref - width) * double(!side && orientation);
double y = (yref - height) * double(!side && orientation) + (yref - height) * double(side && !orientation);
scalar_bar->SetPosition(x, y);
if(this->renderer()) {
this->renderer()->AddActor2D(scalar_bar);
}
}
......
......@@ -92,6 +92,16 @@ const QString &dtkVisualizationDecorator::name(void)
return d->name;
}
bool dtkVisualizationDecorator::decorate(void) const
{
return d->decorate;
}
void dtkVisualizationDecorator::setDecorate(bool decorate)
{
d->decorate = decorate;
}
QVariant dtkVisualizationDecorator::data(void) const
{
return d->data;
......
......@@ -52,6 +52,7 @@ public:
const QString& name(void);
public:
bool decorate(void) const;
QVariant data(void) const;
dtkVisualizationCanvas *canvas(void) const;
......@@ -70,6 +71,8 @@ protected:
void drawAndForward(void);
void setDecorate(bool);
protected:
class dtkVisualizationDecoratorPrivate *d = nullptr;
};
......
......@@ -30,21 +30,11 @@ public:
public:
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
void unsetCanvas(void) override;
protected:
bool setCurrentFieldName(const QString&) override;
void setColorMap(const QMap<double, QColor>&) override;
public:
void setVisibility(bool);
void show(void);
void hide(void);
protected:
void draw(void) override;
protected:
class dtkVisualizationDecoratorScalarColorMapPrivate *d;
};
......
......@@ -16,10 +16,10 @@
#include <dtkVisualizationExport>
#include <QtCore>
#include "dtkVisualizationDecoratorWithClut.h"
#include <QtCore>
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorScalarGlyphs declaration
// ///////////////////////////////////////////////////////////////////
......@@ -34,17 +34,11 @@ public:
public:
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
void unsetCanvas(void) override;
protected:
bool setCurrentFieldName(const QString&) override;
void setColorMap(const QMap<double, QColor>&) override;
public:
void show(void);
void hide(void);
public:
void setCurrentGlyphsSize(double);
void setCurrentGlyphsSource(const QString&);
......@@ -53,9 +47,6 @@ signals:
void currentGlyphsSizeChanged(double);
void currentGlyphsSourceChanged(const QString&);
protected:
void draw(void) override;
protected:
class dtkVisualizationDecoratorScalarGlyphsPrivate *d = nullptr;
};
......
......@@ -16,13 +16,9 @@
#include <dtkVisualizationExport>
#include <QtCore>
#include "dtkVisualizationDecoratorWithClut.h"
#include <vtkSmartPointer.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#include <QtCore>
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorScalarIsolines declaration
......@@ -36,18 +32,12 @@ public:
~dtkVisualizationDecoratorScalarIsolines(void);
public:
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
void unsetCanvas(void) override;
void setData(const QVariant&) override;
protected:
bool setCurrentFieldName(const QString&) override;
bool setCurrentFieldName(const QString&) override;
void setColorMap(const QMap<double, QColor>&) override;
public:
void show(void);
void hide(void);
public:
void setCurrentIsolinesRange(double, double);
void setCurrentIsolinesCount(std::size_t);
......@@ -56,9 +46,6 @@ signals:
void currentIsolinesRangeChanged(double, double);
void currentIsolinesCountChanged(std::size_t);
protected:
void draw(void) override;
protected:
class dtkVisualizationDecoratorScalarIsolinesPrivate *d = nullptr;
};
......
......@@ -32,7 +32,8 @@ public:
~dtkVisualizationDecoratorWithClut(void);
public:
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
void unsetCanvas(void) override;
protected:
void draw(void) override;
......@@ -44,7 +45,8 @@ protected:
void sort(void);
protected:
virtual void setCurrentRange(double, double);
virtual void setVisibility(bool);
virtual bool setCurrentRange(double, double);
virtual bool setCurrentFieldName(const QString&);
virtual void setColorMap(const QMap<double, QColor>&);
......
......@@ -28,10 +28,12 @@ class QComboBox;
class QCheckBox;
class QLineEdit;
class vtkActor;
class vtkDataSet;
class vtkColorTransferFunction;
class vtkPiecewiseFunction;
class vtkPiecewiseFunction;
class vtkScalarBarActor;
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorWithClutPrivate declaration
......@@ -44,6 +46,8 @@ public:
QCheckBox *fixed_range = nullptr;
QLineEdit *min_range = nullptr;
QLineEdit *max_range = nullptr;
QCheckBox *show_actor_cb = nullptr;
QCheckBox *show_scalar_bar_cb = nullptr;
dtkVisualizationWidgetsColorMapEditor *colormap_editor = nullptr;
......@@ -56,6 +60,8 @@ public:
vtkSmartPointer<vtkColorTransferFunction> color_function;
vtkSmartPointer<vtkPiecewiseFunction> opacity;
vtkSmartPointer<vtkActor> actor;
vtkSmartPointer<vtkScalarBarActor> scalar_bar;
public:
QHash<QString, QString> color_transfer_functions; // <field_name, colormap_name>
......
......@@ -35,6 +35,7 @@ public:
};
public:
bool decorate = false;
QString name;
QVariant data;
dtkVisualizationCanvas *canvas = 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