Commit 2cbc321c authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

Merge branch 'release/2.15.0'

parents fee68f1d 32e98c7e
# Change Log:
# 2.15.0 05-Dec-2019
- add setTransform in decorator API
- rewrite 2d plot class
- fix Slice decorator
- add clut from sdm topography
# 2.14.3 29-Nov-2019
- fix restore when using slice decorator fixed range
......
......@@ -23,8 +23,8 @@ project(dtkVisualization)
## ###################################################################
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 14)
set(${PROJECT_NAME}_VERSION_PATCH 3)
set(${PROJECT_NAME}_VERSION_MINOR 15)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......@@ -95,10 +95,19 @@ option(DTKVISUALIZATION_USE_UPCOMING_VTK "" FALSE)
find_package(VTK COMPONENTS
vtkChartsCore
vtkCommonCore
vtkCommonDataModel
vtkFiltersFlowPaths
vtkGUISupportQtOpenGL
vtkInteractionImage
vtkRenderingContext2D
vtkRenderingContextOpenGL2
vtkRenderingCore
vtkRenderingFreeType
vtkRenderingGL2PSOpenGL2
vtkRenderingOpenGL2
vtkRenderingVolumeOpenGL2
vtkViewsContext2D
REQUIRED)
if(NOT DTKVISUALIZATION_USE_UPCOMING_VTK)
......
......@@ -167,24 +167,6 @@ void dtkVisualizationViewerPrivate::createPlot2DData(dtkVisualizationPlot2D *plo
plot->addFieldY(field_2, true, vtkChart::LINE, vtkPlotPoints::NONE);
plot->addFieldY(field_3);
// insert in menu
dtkWidgetsMenuBar *menu_bar = dtkApp->window()->menubar();
dtkWidgetsMenu *plot_menu = menu_bar->menu("View " + plot->objectName());
if(!plot_menu) {
plot_menu = menu_bar->addMenu(0, "View " + plot->objectName());
}
dtkWidgetsMenu *plot_group = plot_menu->addMenu(0, "Views");
for(auto inspector : plot->inspectors()) {
inspector->setVisible(true);
dtkWidgetsMenuItemDIY *item = new dtkWidgetsMenuItemDIY(inspector->objectName(), inspector);
plot_group->addItem(item);
}
menu_bar->touch();
plot_is_init = true;
}
......
......@@ -58,10 +58,13 @@ dtkWidgetsWidget *dtkVisualizationViewerStack::create(const QString& type)
dtkWidgetsMenuBar *menu_bar = dtkApp->window()->menubar();
dtkWidgetsMenu *menu = menu_bar->menu("View " + view->objectName());
dtkWidgetsMenu *menu = nullptr;
menu = menu_bar->menu("View " + view->objectName());
if( menu) {
menu->clear();
if(type != "Plot2D") {
menu->clear(); // dont clear plot 2d menu
}
menu_bar->touch();
} else {
menu_bar->addMenu(fa::desktop, "View " + view->objectName());
......
......@@ -17,6 +17,8 @@
#include "dtkVisualization.h"
#include "dtkVisualizationCanvas.h"
#include <vtkTransform.h>
// ///////////////////////////////////////////////////////////////////
// Register to dtkVisualization layer
// ///////////////////////////////////////////////////////////////////
......@@ -59,5 +61,10 @@ void dtkVisualizationDecorator::setObjectName(const QString & name)
QObject::setObjectName(name);
}
void dtkVisualizationDecorator::setTransform(vtkTransform *transform)
{
qWarning() << Q_FUNC_INFO << "nothing is done";
}
//
// dtkVisualizationDecorator.cpp ends here
......@@ -21,6 +21,7 @@
#include <QtCore/QObject>
class dtkVisualizationCanvas;
class vtkTransform;
class QWidget;
// ///////////////////////////////////////////////////////////////////
......@@ -57,6 +58,8 @@ public:
virtual void setData(const QVariant&) = 0;
virtual void setTransform(vtkTransform *);
virtual void setCanvas(dtkVisualizationCanvas *) = 0;
virtual void unsetCanvas(void) = 0;
......
......@@ -174,8 +174,12 @@ void dtkVisualizationDecoratorAxes::setCanvas(dtkVisualizationCanvas *canvas)
d->marker->SetEnabled(d->show_axes_cb->checkState() == Qt::Checked);
d->cube_axes_actor->SetCamera(d->view->renderer()->GetActiveCamera());
d->cube_axes_actor->SetBounds(d->view->renderer()->ComputeVisiblePropBounds());
if(!d->dataset){
d->cube_axes_actor->SetBounds(d->view->renderer()->ComputeVisiblePropBounds());
} else {
d->cube_axes_actor->SetBounds(d->dataset->GetBounds());
}
}
void dtkVisualizationDecoratorAxes::unsetCanvas(void)
......
......@@ -43,7 +43,6 @@ class dtkVisualizationDecoratorScalarColorMapPrivate
public:
vtkSmartPointer<vtkActor> actor;
vtkSmartPointer<vtkDataSetMapper> mapper;
vtkSmartPointer<vtkTransform> transform;
public:
QCheckBox *show_actor_cb = nullptr;
......@@ -58,15 +57,12 @@ public slots:
dtkVisualizationDecoratorScalarColorMap::dtkVisualizationDecoratorScalarColorMap(void): dtkVisualizationDecoratorWithClut(), d(new dtkVisualizationDecoratorScalarColorMapPrivate())
{
d->transform = vtkSmartPointer<vtkTransform>::New();
d->mapper = vtkSmartPointer<vtkDataSetMapper>::New();
d->mapper->SetColorModeToMapScalars();
d->mapper->SetScalarVisibility(true);
d->actor = vtkSmartPointer<vtkActor>::New();
d->actor->SetMapper(d->mapper);
d->actor->SetUserTransform(d->transform);
//////////
// Inspectors creation
......@@ -217,13 +213,10 @@ void dtkVisualizationDecoratorScalarColorMap::setColorMap(const QMap<double, QCo
// d->actor->Modified();
}
// /////////////////////////////////////////////////////////////////////////////
// TODO: Factorise upwards
// /////////////////////////////////////////////////////////////////////////////
void dtkVisualizationDecoratorScalarColorMap::scale(qreal x, qreal y, qreal z)
void dtkVisualizationDecoratorScalarColorMap::setTransform(vtkTransform *transform)
{
d->transform->Scale(x, y, z);
d_func()->transform = transform;
d->actor->SetUserTransform(transform);
}
// /////////////////////////////////////////////////////////////////////////////
......
......@@ -29,20 +29,15 @@ public:
public:
void setData(const QVariant&) override;
void setCanvas(dtkVisualizationCanvas *) override;
void setTransform(vtkTransform *) override;
void unsetCanvas(void) override;
public:
void setVisibility(bool) override;
// /////////////////////////////////////////////////////////////////////////////
// TODO: Factorise upwards
// /////////////////////////////////////////////////////////////////////////////
public:
void scale(qreal, qreal, qreal);
// /////////////////////////////////////////////////////////////////////////////
protected:
bool setCurrentFieldName(const QString&) override;
void setColorMap(const QMap<double, QColor>&) override;
......
......@@ -316,6 +316,10 @@ void dtkVisualizationDecoratorSlices::unsetCanvas(void)
// d_func()->view->renderer()->RemoveActor(d->actor);
}
d->volume_slice_x->SetInteractor(nullptr);
d->volume_slice_y->SetInteractor(nullptr);
d->volume_slice_z->SetInteractor(nullptr);
d_func()->disableScalarBar();
d_func()->view = nullptr;
......
......@@ -82,6 +82,7 @@ public:
public:
vtkSmartPointer<vtkColorTransferFunction> color_function;
vtkSmartPointer<vtkPiecewiseFunction> opacity;
vtkSmartPointer<vtkTransform> transform;
vtkSmartPointer<vtkScalarBarActor> scalar_bar;
......
......@@ -16,20 +16,15 @@
#include <dtkVisualizationExport>
#include <dtkWidgets/dtkWidgetsWidget>
#include "dtkVisualizationCanvas.h"
#include <vtkChartXY.h>
#include <vtkPlotPoints.h>
template <typename T> class vtkSmartPointer;
class vtkAbstractArray;
class vtkRenderer;
class dtkWidgetsHUD;
class dtkWidgetsOverlayPane;
class DTKVISUALIZATION_EXPORT dtkVisualizationPlot2D : public dtkWidgetsWidget
class DTKVISUALIZATION_EXPORT dtkVisualizationPlot2D : public dtkVisualizationCanvas
{
Q_OBJECT
......@@ -37,16 +32,6 @@ public:
dtkVisualizationPlot2D(QWidget *parent = nullptr);
~dtkVisualizationPlot2D(void);
public:
QWidget *widget(void) override;
public slots:
void render(void);
public:
const QList<QWidget *> inspectors(void) const;
dtkWidgetsHUD *hud(void);
public:
void setGridVisible(bool visible);
QStringList fields(void);
......@@ -58,14 +43,24 @@ public:
int type = vtkChart::POINTS,
int marker_style = vtkPlotPoints::PLUS,
QColor color = Qt::transparent,
int width = 1);
int width = 3);
void clearFields(void);
void removeField(vtkSmartPointer<vtkAbstractArray>);
void removeField(const QString&);
void setShowLegend(bool);
public:
vtkRenderer *renderer(void);
QStringList selectedFields(void);
void setAddPlotSuffix(const QString& s);
void setShowLegend(bool);
private slots:
void exportAsCSV(const QString &);
void exportAsPNG(const QString &);
protected:
void render(void);
//void keyPressEvent(QKeyEvent *e);
private:
class dtkVisualizationPlot2DPrivate *d;
......
<!DOCTYPE clut>
<clut min="0" max="255" log="0">
<vertex v="0" r="0" g="0" b="255" a="255"/>
<vertex v="122" r="0" g="255" b="0" a="255"/>
<vertex v="255" r="255" g="0" b="0" a="255"/>
</clut>
......@@ -55,7 +55,8 @@
<file>cluts/quercus.clut</file>
<file>cluts/temperature.clut</file>
<file>cluts/tourmaline.clut</file>
<file>cluts/topography.clut</file>
<file>cluts/viridis.clut</file>
<file>cluts/wine.clut</file>
</qresource>
</RCC>
\ No newline at end of file
</RCC>
......@@ -796,9 +796,10 @@ dtkVisualizationWidgetsClutEditor::dtkVisualizationWidgetsClutEditor(QWidget *pa
d->button_presets->addItem("leaf");
// d->button_presets->addItem("morocco");
d->button_presets->addItem("ocean");
d->button_presets->addItem("topography");
// d->button_presets->addItem("primordia_jet");
// d->button_presets->addItem("quercus");
// d->button_presets->addItem("temperature");
d->button_presets->addItem("temperature");
// d->button_presets->addItem("tourmaline");
d->button_presets->addItem("viridis");
// d->button_presets->addItem("wine");
......
......@@ -197,6 +197,7 @@ dtkVisualizationWidgetsColorMapEditor::dtkVisualizationWidgetsColorMapEditor(QWi
d->colormap_names.append("jet");
d->colormap_names.append("leaf");
d->colormap_names.append("ocean");
d->colormap_names.append("topography");
d->colormap_names.append("viridis");
d->colormap_box = new StackedComboBox(this);
......
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