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

Finalize cmake refactoring for sources.

parent 7631538d
......@@ -86,10 +86,12 @@ find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
find_package(Qt5 COMPONENTS Core Widgets OpenGL Xml Multimedia MultimediaWidgets WebSockets REQUIRED)
#include_directories(${Qt5Multimedia_PRIVATE_INCLUDE_DIRS})
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_library(QtMultimedia_Private INTERFACE)
target_include_directories(QtMultimedia_Private INTERFACE ${Qt5Multimedia_PRIVATE_INCLUDE_DIRS})
find_package(dtkCore 2.4.0 REQUIRED)
find_package(dtkFonts 2.1.0 REQUIRED)
find_package(dtkWidgets 2.10.0 REQUIRED)
......
......@@ -14,8 +14,8 @@
set(layer_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
#add_subdirectory(dtkVisualization)
#add_subdirectory(dtkVisualizationFactory)
add_subdirectory(dtkVisualization)
add_subdirectory(dtkVisualizationFactory)
add_subdirectory(dtkVisualizationWidgets)
## #################################################################
......
......@@ -20,6 +20,7 @@ project(dtkVisualization VERSION ${dtkVisualization_VERSION})
set(${PROJECT_NAME}_HEADERS
dtkVisualization
dtkVisualization.h
dtkVisualizationCanvas
dtkVisualizationCanvas.h
dtkVisualizationDecorator
......@@ -40,10 +41,15 @@ set(${PROJECT_NAME}_HEADERS
dtkVisualizationDecoratorScalarGlyphs.h
dtkVisualizationDecoratorScalarIsolines
dtkVisualizationDecoratorScalarIsolines.h
dtkVisualizationMetaType
dtkVisualizationMetaType.h
dtkVisualizationMetaType.tpp
dtkVisualizationPlot2D
dtkVisualizationPlot2D.h
dtkVisualizationPlot3D
dtkVisualizationPlot3D.h
dtkVisualizationTypeTraits
dtkVisualizationTypeTraits.h
dtkVisualizationVTKReader
dtkVisualizationVTKReader.h
dtkVisualizationViewHybrid
......@@ -65,6 +71,7 @@ set(${PROJECT_NAME}_HEADERS
)
set(${PROJECT_NAME}_SOURCES
dtkVisualization.cpp
dtkVisualizationCanvas.cpp
dtkVisualizationDecorator.cpp
dtkVisualizationDecoratorWithClut.cpp
......@@ -74,6 +81,7 @@ set(${PROJECT_NAME}_SOURCES
dtkVisualizationDecoratorScalarColorMap.cpp
dtkVisualizationDecoratorScalarGlyphs.cpp
dtkVisualizationDecoratorScalarIsolines.cpp
dtkVisualizationMetaType.cpp
dtkVisualizationPlot2D.cpp
dtkVisualizationPlot3D.cpp
dtkVisualizationVTKReader.cpp
......@@ -102,25 +110,30 @@ add_library(${PROJECT_NAME} SHARED
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Multimedia)
target_link_libraries(${PROJECT_NAME} Qt5::MultimediaWidgets)
target_link_libraries(${PROJECT_NAME} Qt5::OpenGL)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} PRIVATE QtMultimedia_Private)
target_link_libraries(${PROJECT_NAME} dtkFonts)
target_link_libraries(${PROJECT_NAME} dtkWidgets)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Multimedia)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::MultimediaWidgets)
target_link_libraries(${PROJECT_NAME} dtkVisualizationWidgets)
target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Core)
target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Gui)
target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE dtkThemes)
target_link_libraries(${PROJECT_NAME} PRIVATE dtkVisualizationWidgets)
target_link_libraries(${PROJECT_NAME} PUBLIC dtkCore)
target_link_libraries(${PROJECT_NAME} PUBLIC dtkFonts)
target_link_libraries(${PROJECT_NAME} PUBLIC dtkWidgets)
target_link_libraries(${PROJECT_NAME} PUBLIC ${VTK_LIBRARIES})
if(WIN32)
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENGL_LIBRARIES})
endif(WIN32)
if(APPLE)
target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework OpenGL")
endif(APPLE)
target_include_directories(${PROJECT_NAME} PUBLIC
......
#include "dtkVisualization.h"
#include "dtkVisualizationCanvas.h"
#include "dtkVisualizationDecorator.h"
#include "dtkVisualizationDecoratorWithClut.h"
......@@ -8,8 +9,10 @@
#include "dtkVisualizationDecoratorScalarColorMap.h"
#include "dtkVisualizationDecoratorScalarIsolines.h"
#include "dtkVisualizationDecoratorScalarGlyphs.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationPlot2D.h"
#include "dtkVisualizationPlot3D.h"
#include "dtkVisualizationTypeTraits.h"
#include "dtkVisualizationVTKReader.h"
#include "dtkVisualizationView2D.h"
#include "dtkVisualizationView3D.h"
......
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkVisualization.h"
#include "dtkVisualizationMetaType.h"
namespace dtk { namespace visualization {
void initialize(void)
{
initialize(QString());
}
void initialize(const QString& path)
{
dtk::visualization::registerVTKToMetaType();
}
void uninitialize(void)
{
}
} };
//
// dtkVisualization.cpp ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <dtkVisualizationExport>
class QString;
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
namespace dtk { namespace visualization {
DTKVISUALIZATION_EXPORT void initialize(void);
DTKVISUALIZATION_EXPORT void initialize(const QString& path);
DTKVISUALIZATION_EXPORT void uninitialize(void);
} };
//
// dtkVisualization.h ends here
......@@ -16,6 +16,10 @@
#include <dtkWidgets>
#include <QtCore>
#include <QtGui>
#include <QtWidgets>
#include <QVTKOpenGLWidget.h>
#include <vtkCamera.h>
......@@ -23,6 +27,7 @@
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkScalarBarActor.h>
#include <vtkSmartPointer.h>
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationCanvasPrivate
......@@ -33,7 +38,7 @@ class dtkVisualizationCanvasPrivate : public QVTKOpenGLWidget
Q_OBJECT
public:
dtkVisualizationCanvasPrivate(QWidget *parent = Q_NULLPTR);
dtkVisualizationCanvasPrivate(QWidget *parent = nullptr);
~dtkVisualizationCanvasPrivate(void);
public:
......@@ -58,12 +63,14 @@ public:
dtkVisualizationCanvas *q = nullptr;
public:
dtkWidgetsHUD *hud = nullptr;
dtkWidgetsHUD *hud = nullptr;
public:
std::size_t nb_scalar_bars = 0;
};
// ///////////////////////////////////////////////////////////////////
dtkVisualizationCanvasPrivate::dtkVisualizationCanvasPrivate(QWidget *parent) : QVTKOpenGLWidget(parent)
{
this->setFormat(QVTKOpenGLWidget::defaultFormat());
......@@ -120,14 +127,12 @@ void dtkVisualizationCanvasPrivate::onFocus(void)
}
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationCanvas
// ///////////////////////////////////////////////////////////////////
dtkVisualizationCanvas::dtkVisualizationCanvas(QWidget *parent) : dtkWidgetsWidget(parent)
dtkVisualizationCanvas::dtkVisualizationCanvas(QWidget *parent) : dtkWidgetsWidget(parent), d(new dtkVisualizationCanvasPrivate(this))
{
d = new dtkVisualizationCanvasPrivate(this);
d->q = this;
static int count = 1;
......
......@@ -16,9 +16,6 @@
#include <dtkVisualizationExport>
#include <QtCore>
#include <QtWidgets>
#include <dtkWidgets/dtkWidgetsWidget>
class vtkRenderer;
......@@ -26,14 +23,15 @@ class vtkRenderWindowInteractor;
class vtkScalarBarActor;
class dtkWidgetsHUD;
class QWidget;
class DTKVISUALIZATION_EXPORT dtkVisualizationCanvas : public dtkWidgetsWidget
{
Q_OBJECT
public:
dtkVisualizationCanvas(QWidget *parent = nullptr);
virtual ~dtkVisualizationCanvas(void);
dtkVisualizationCanvas(QWidget *parent = nullptr);
~dtkVisualizationCanvas(void);
public:
QWidget *widget(void) override;
......@@ -43,10 +41,10 @@ public slots:
void unlink(void);
public:
dtkWidgetsHUD *hud(void);
dtkWidgetsHUD *hud(void);
public:
vtkRenderer *renderer(void);
vtkRenderer *renderer(void);
vtkRenderWindowInteractor *interactor(void);
public:
......
......@@ -18,14 +18,8 @@
#include <QtCore>
#include <vtkUnstructuredGrid.h>
#include <vtkPolyData.h>
Q_DECLARE_METATYPE(vtkDataSet *);
Q_DECLARE_METATYPE(vtkUnstructuredGrid *);
Q_DECLARE_METATYPE(vtkPolyData *);
class dtkVisualizationCanvas;
class QWidget;
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDataDecorator declaration
......@@ -36,7 +30,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecorator : public QObject
Q_OBJECT
public:
dtkVisualizationDecorator(const QString& name = "");
dtkVisualizationDecorator(const QString& name = QString());
~dtkVisualizationDecorator(void);
public slots:
......
......@@ -16,14 +16,15 @@
#include "dtkVisualizationDecorator_p.h"
#include "dtkVisualizationCanvas.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsClutEditor>
#include <dtkWidgets>
#include <dtkLog>
#include <QtGui/QColor>
#include <QtGui>
#include <QtWidgets>
#include <vtkCellData.h>
#include <vtkColorTransferFunction.h>
......
......@@ -14,9 +14,7 @@
#pragma once
#include <dtkVisualizationExport.h>
#include <QtCore>
#include <dtkVisualizationExport>
#include "dtkVisualizationDecoratorClutEditorBase.h"
......@@ -25,7 +23,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorClutEditor : public dtkVi
Q_OBJECT
public:
dtkVisualizationDecoratorClutEditor(const QString& name="");
dtkVisualizationDecoratorClutEditor(const QString& name = QString());
~dtkVisualizationDecoratorClutEditor(void);
public:
......
......@@ -14,13 +14,13 @@
#pragma once
#include <dtkVisualizationExport.h>
#include <dtkVisualizationExport>
#include <QtCore>
#include "dtkVisualizationDecorator.h"
#include <vtkSmartPointer.h>
template <typename T> class vtkSmartPointer;
class vtkColorTransferFunction;
class vtkPiecewiseFunction;
......
......@@ -16,14 +16,15 @@
#include "dtkVisualizationDecorator_p.h"
#include "dtkVisualizationCanvas.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsColorMapEditor>
#include <dtkWidgets>
#include <dtkLog>
#include <QtGui/QColor>
#include <QtGui>
#include <QtWidgets>
#include <vtkCellData.h>
#include <vtkColorTransferFunction.h>
......
......@@ -14,9 +14,7 @@
#pragma once
#include <dtkVisualizationExport.h>
#include <QtCore>
#include <dtkVisualizationExport>
#include "dtkVisualizationDecoratorClutEditorBase.h"
......
......@@ -13,15 +13,20 @@
// Code:
#include "dtkVisualizationDecoratorInfo.h"
#include "dtkVisualizationDecorator_p.h"
#include "dtkVisualizationCanvas.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkThemes>
#include <dtkThemes/dtkThemesEngine>
#include <dtkWidgets>
#include <vtkCellData.h>
#include <vtkDataArray.h>
#include <vtkDataSet.h>
#include <vtkFieldData.h>
#include <vtkPointData.h>
// ///////////////////////////////////////////////////////////////////
......@@ -50,7 +55,7 @@ void dtkVisualizationDecoratorInfoPrivate::addVTKInfo(dtkVisualizationDecoratorI
+ vector_color + "\">vector</font>";
QStringList point_fields;
for(int i=0; i < dataset->GetPointData()->GetNumberOfArrays(); ++i) {
for (int i=0; i < dataset->GetPointData()->GetNumberOfArrays(); ++i) {
switch(dataset->GetPointData()->GetArray(i)->GetNumberOfComponents()) {
case 1: {
QString s = "<font color=\"" + scalar_color + "\">"
......@@ -78,7 +83,7 @@ void dtkVisualizationDecoratorInfoPrivate::addVTKInfo(dtkVisualizationDecoratorI
q->setInformation("PointFields:", point_fields.join("; "), fields_tooltip);
QStringList cell_fields;
for(int i=0; i < dataset->GetCellData()->GetNumberOfArrays(); ++i) {
for (int i=0; i < dataset->GetCellData()->GetNumberOfArrays(); ++i) {
switch(dataset->GetCellData()->GetArray(i)->GetNumberOfComponents()) {
case 1: {
QString s = "<font color=\"" + scalar_color + "\">"
......@@ -156,7 +161,7 @@ void dtkVisualizationDecoratorInfo::setData(const QVariant& data)
}
vtkDataSet *dataset = data.value<vtkDataSet *>();
if(dataset)
if (dataset)
d->addVTKInfo(this, dataset);
//TODO
......@@ -197,7 +202,7 @@ void dtkVisualizationDecoratorInfo::setFileInfo(const QFileInfo& f_info)
void dtkVisualizationDecoratorInfo::setInformation(const QString& key, const QString& value, const QString& tooltip)
{
if(!this->canvas()) {
qDebug() << Q_FUNC_INFO << __LINE__ << "setCanvas must be called first";
qDebug() << Q_FUNC_INFO << "setCanvas must be called first";
return;
}
......
......@@ -14,9 +14,7 @@
#pragma once
#include <dtkVisualizationExport.h>
#include <QtCore>
#include <dtkVisualizationExport>
#include "dtkVisualizationDecorator.h"
......@@ -25,7 +23,7 @@ class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorInfo : public dtkVisualiz
Q_OBJECT
public:
dtkVisualizationDecoratorInfo(const QString& name="");
dtkVisualizationDecoratorInfo(const QString& name = QString());
~dtkVisualizationDecoratorInfo(void);
public:
......
......@@ -21,7 +21,8 @@
#include <dtkLog>
#include <QtGui/QColor>
#include <QtGui>
#include <QtWidgets>
#include <vtkActor.h>
#include <vtkColorTransferFunction.h>
......
......@@ -18,8 +18,6 @@
#include "dtkVisualizationDecoratorWithClut.h"
#include <QtCore>
class DTKVISUALIZATION_EXPORT dtkVisualizationDecoratorScalarColorMap : public dtkVisualizationDecoratorWithClut
{
Q_OBJECT
......
......@@ -21,7 +21,8 @@
#include <dtkLog>
#include <QtGui/QColor>
#include <QtGui>
#include <QtWidgets>
#include <vtkActor.h>
#include <vtkArrowSource.h>
......
......@@ -16,8 +16,6 @@
#include <dtkVisualizationExport>
#include <QtCore>
#include "dtkVisualizationDecoratorWithClut.h"
// ///////////////////////////////////////////////////////////////////
......
......@@ -16,15 +16,14 @@
#include "dtkVisualizationDecorator_p.h"
#include "dtkVisualizationDecoratorWithClut_p.h"
#include "dtkVisualizationCanvas.h"
#include "dtkVisualizationDecoratorClutEditorBase.h"
#include "dtkVisualizationMetaType.h"
#include "dtkVisualizationView2D.h"
#include <dtkWidgets>
#include <dtkLog>
#include <QtGui/QColor>
#include <QtGui>
#include <QtWidgets>
#include <vtkActor.h>
#include <vtkColorTransferFunction.h>
......
......@@ -16,14 +16,8 @@
#include <dtkVisualizationExport>
#include <QtCore>
#include "dtkVisualizationDecoratorWithClut.h"
#include <vtkSmartPointer.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
// ///////////////////////////////////////////////////////////////////
// dtkVisualizationDecoratorScalarIsolines declaration
// ///////////////////////////////////////////////////////////////////
......
......@@ -15,14 +15,18 @@
#include "dtkVisualizationDecoratorWithClut.h"
#include "dtkVisualizationDecoratorWithClut_p.h"
#include "dtkVisualizationMetaType.h"
#include <dtkVisualizationWidgets/dtkVisualizationWidgetsColorMapEditor.h>
#include <dtkLog>
#include <QtGui/QColor>
#include <QtGui>
#include <QtWidgets>
#include <vtkColorTransferFunction.h>
#include <vtkCellData.h>
#include <vtkDataArray.h>
#include <vtkDataSet.h>
#include <vtkPiecewiseFunction.h>
#include <vtkPointData.h>
......@@ -139,7 +143,6 @@ void dtkVisualizationDecoratorWithClut::setDataPoints(vtkDataSet *dataset)
{
using Support = dtkVisualizationDecoratorPrivate::Support;
vtkPointData *point_data = dataset->GetPointData();
vtkIdType number_of_point_arrays = point_data->GetNumberOfArrays();
for (vtkIdType i = 0; i < number_of_point_arrays; ++i) {
......
......@@ -14,7 +14,7 @@
#pragma once
#include <dtkVisualizationExport.h>
#include <dtkVisualizationExport>
#include "dtkVisualizationDecorator.h"
......
#include "dtkVisualizationMetaType.h"
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkVisualizationMetaType.h"
#include <QtCore>
namespace dtk { namespace visualization {
void registerVTKToMetaType(void)
{
qRegisterMetaType<vtkDataSet *>();
qRegisterMetaType<vtkImageData *>();
qRegisterMetaType<vtkPolyData *>();
qRegisterMetaType<vtkRectilinearGrid *>();
qRegisterMetaType<vtkStructuredGrid *>();
qRegisterMetaType<vtkUnstructuredGrid *>();
QMetaType::registerConverter<vtkImageData *, vtkDataSet *>();
QMetaType::registerConverter<vtkPolyData *, vtkDataSet *>();
QMetaType::registerConverter<vtkRectilinearGrid *, vtkDataSet *>();
QMetaType::registerConverter<vtkStructuredGrid *, vtkDataSet *>();
QMetaType::registerConverter<vtkUnstructuredGrid *, vtkDataSet *>();
}
} };
//
// dtkVisualizationMetaType.cpp ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <dtkVisualizationExport>
namespace dtk { namespace visualization {
DTKVISUALIZATION_EXPORT void registerVTKToMetaType(void);
} };
// ///////////////////////////////////////////////////////////////////
#include "dtkVisualizationMetaType.tpp"
//
// dtkVisualizationMetaType.h ends here