Commit 4ee1896e authored by CABEL Tristan's avatar CABEL Tristan

add names on decorators

parent 0aa4f1e3
......@@ -162,6 +162,7 @@ void dtkVisualizationViewer::importDataSet(const QString& path)
dtkVisualizationDecoratorScalarIsolines *decorator_scalar_isolines = new dtkVisualizationDecoratorScalarIsolines;
dtkVisualizationDecoratorScalarGlyphs *decorator_scalar_glyphs = new dtkVisualizationDecoratorScalarGlyphs;
decorator_clut_editor->setName("my clut editor");
//chain all decorators
*decorator_clut_editor << *decorator_scalar_isolines << *decorator_scalar_glyphs << *decorator_scalar_color_map ;
......
......@@ -27,6 +27,7 @@
class dtkVisualizationDecoratorPrivate
{
public:
QString name;
QVariant data;
dtkVisualizationCanvas *canvas = nullptr;
dtkVisualizationDecorator *previous = nullptr;
......@@ -37,9 +38,9 @@ public:
// dtkVisualizationDecorator implementation
// ///////////////////////////////////////////////////////////////////
dtkVisualizationDecorator::dtkVisualizationDecorator(void) : d(new dtkVisualizationDecoratorPrivate)
dtkVisualizationDecorator::dtkVisualizationDecorator(const QString &name) : d(new dtkVisualizationDecoratorPrivate)
{
d->name = name;
}
dtkVisualizationDecorator::~dtkVisualizationDecorator(void)
......@@ -90,6 +91,16 @@ void dtkVisualizationDecorator::unsetCanvas(void)
d->canvas = nullptr;
}
void dtkVisualizationDecorator::setName(const QString &name)
{
d->name = name;
}
const QString &dtkVisualizationDecorator::name(void)
{
return d->name;
}
QVariant dtkVisualizationDecorator::data(void) const
{
return d->data;
......
......@@ -36,7 +36,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecorator : public QObject
Q_OBJECT
public:
dtkVisualizationDecorator(void);
dtkVisualizationDecorator(const QString& name = "");
~dtkVisualizationDecorator(void);
public slots:
......@@ -47,6 +47,10 @@ public:
virtual void setCanvas(dtkVisualizationCanvas *);
virtual void unsetCanvas(void);
public:
void setName(const QString& name);
const QString& name(void);
public:
QVariant data(void) const;
dtkVisualizationCanvas *canvas(void) const;
......
......@@ -78,8 +78,11 @@ public:
// dtkVisualizationDecoratorClutEditor implementation
// ///////////////////////////////////////////////////////////////////
dtkVisualizationDecoratorClutEditor::dtkVisualizationDecoratorClutEditor(void): d(new dtkVisualizationDecoratorClutEditorPrivate())
dtkVisualizationDecoratorClutEditor::dtkVisualizationDecoratorClutEditor(const QString& name): dtkVisualizationDecorator("clut Editor"), d(new dtkVisualizationDecoratorClutEditorPrivate())
{
if(!name.isEmpty())
this->setName(name);
d->scalar_bar = vtkSmartPointer<vtkScalarBarActor>::New();
d->scalar_bar->SetWidth(0.08);
d->scalar_bar->SetHeight(0.6);
......@@ -307,7 +310,7 @@ void dtkVisualizationDecoratorClutEditor::setCanvas(dtkVisualizationCanvas *canv
dtkVisualizationWidgetsClutEditor *clut_editor = new dtkVisualizationWidgetsClutEditor;
dtkWidgetsOverlayPaneItem *pane_item = new dtkWidgetsOverlayPaneItem;
pane_item->setTitle("Clut Editor");
pane_item->setTitle(this->name());
pane_item->addWidget(widget_bar_and_fields);
pane_item->addWidget(clut_editor);
pane_item->addWidget(range_widget);
......
......@@ -29,7 +29,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorClutEditor : public dtkVi
Q_OBJECT
public:
dtkVisualizationDecoratorClutEditor(void);
dtkVisualizationDecoratorClutEditor(const QString& name="");
~dtkVisualizationDecoratorClutEditor(void);
public:
......
......@@ -76,8 +76,11 @@ public:
// dtkVisualizationDecoratorScalarColorMap implementation
// ///////////////////////////////////////////////////////////////////
dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap(void): d(new dtkVisualizationDecoratorScalarColorMapPrivate())
dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap(const QString& name): dtkVisualizationDecorator("Scalar Color Map"), d(new dtkVisualizationDecoratorScalarColorMapPrivate())
{
if(!name.isEmpty())
this->setName(name);
d->mapper = vtkSmartPointer<vtkDataSetMapper>::New();
d->mapper->SetColorModeToMapScalars();
d->mapper->SetScalarVisibility(true);
......@@ -199,7 +202,7 @@ void dtkVisualizationDecoratorScalarColorMap::setCanvas(dtkVisualizationCanvas *
form_layout->addRow("Field", d->fields_box);
dtkWidgetsOverlayPaneItem *pane_item = new dtkWidgetsOverlayPaneItem;
pane_item->setTitle("Scalar Color Map");
pane_item->setTitle(this->name());
pane_item->addWidget(model_widget);
canvas_pane->addWidget(pane_item);
......
......@@ -29,7 +29,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarColorMap : public d
Q_OBJECT
public:
dtkVisualizationDecoratorScalarColorMap(void);
dtkVisualizationDecoratorScalarColorMap(const QString& name="");
~dtkVisualizationDecoratorScalarColorMap(void);
public:
......
......@@ -91,8 +91,11 @@ public:
// dtkVisualizationDecoratorScalarGlyphs implementation
// ///////////////////////////////////////////////////////////////////
dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(void): d(new dtkVisualizationDecoratorScalarGlyphsPrivate())
dtkVisualizationDecoratorScalarGlyphs::dtkVisualizationDecoratorScalarGlyphs(const QString& name): dtkVisualizationDecorator("Scalar Glyphs"), d(new dtkVisualizationDecoratorScalarGlyphsPrivate())
{
if(!name.isEmpty())
this->setName(name);
d->source_arrow = vtkSmartPointer<vtkArrowSource>::New();
d->source_cube = vtkSmartPointer<vtkCubeSource>::New();
......@@ -247,7 +250,7 @@ void dtkVisualizationDecoratorScalarGlyphs::setCanvas(dtkVisualizationCanvas *ca
form_layout->addRow("Source", glyphs_source_cb);
dtkWidgetsOverlayPaneItem *pane_item = new dtkWidgetsOverlayPaneItem;
pane_item->setTitle("Scalar Glyphs");
pane_item->setTitle(this->name());
pane_item->addWidget(model_widget);
canvas_pane->addWidget(pane_item);
......
......@@ -32,7 +32,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarGlyphs : public dtk
{
Q_OBJECT
public:
dtkVisualizationDecoratorScalarGlyphs(void);
dtkVisualizationDecoratorScalarGlyphs(const QString& name="");
~dtkVisualizationDecoratorScalarGlyphs(void);
public:
......
......@@ -85,8 +85,10 @@ public:
// dtkVisualizationDecoratorScalarIsolines implementation
// ///////////////////////////////////////////////////////////////////
dtkVisualizationDecoratorScalarIsolines::dtkVisualizationDecoratorScalarIsolines(void): d(new dtkVisualizationDecoratorScalarIsolinesPrivate())
dtkVisualizationDecoratorScalarIsolines::dtkVisualizationDecoratorScalarIsolines(const QString &name): dtkVisualizationDecorator("Scalar Isolines"), d(new dtkVisualizationDecoratorScalarIsolinesPrivate())
{
if(!name.isEmpty())
this->setName(name);
d->isolines = vtkSmartPointer<vtkContourFilter>::New();
......@@ -228,7 +230,7 @@ void dtkVisualizationDecoratorScalarIsolines::setCanvas(dtkVisualizationCanvas *
form_layout->addRow("Max", isolines_max_sb);
dtkWidgetsOverlayPaneItem *pane_item = new dtkWidgetsOverlayPaneItem;
pane_item->setTitle("Scalar Isolines");
pane_item->setTitle(this->name());
pane_item->addWidget(model_widget);
canvas_pane->addWidget(pane_item);
......
......@@ -32,7 +32,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarIsolines : public d
{
Q_OBJECT
public:
dtkVisualizationDecoratorScalarIsolines(void);
dtkVisualizationDecoratorScalarIsolines(const QString& name="");
~dtkVisualizationDecoratorScalarIsolines(void);
public:
......
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