##// END OF EJS Templates
Handles rendering of plottables (1)...
Alexandre Leroux -
r918:8264fa4b2aa2
parent child
Show More
@@ -0,0 +1,29
1 #ifndef SCIQLOP_PLOTTABLESRENDERINGUTILS_H
2 #define SCIQLOP_PLOTTABLESRENDERINGUTILS_H
3
4 #include <Visualization/VisualizationDefs.h>
5
6 #include <memory>
7
8 class IDataSeries;
9 class QCPColorScale;
10 class QCustomPlot;
11
12 /**
13 * Helper used to handle plottables rendering
14 */
15 struct IPlottablesHelper {
16 virtual ~IPlottablesHelper() noexcept = default;
17
18 /// Set properties of the plottables passed as parameter
19 /// @param plottables the plottables for which to set properties
20 virtual void setProperties(PlottablesMap &plottables) = 0;
21 };
22
23 struct IPlottablesHelperFactory {
24 /// Creates IPlottablesHelper according to a data series
25 static std::unique_ptr<IPlottablesHelper>
26 create(std::shared_ptr<IDataSeries> dataSeries) noexcept;
27 };
28
29 #endif // SCIQLOP_PLOTTABLESRENDERINGUTILS_H
@@ -0,0 +1,65
1 #include "Visualization/PlottablesRenderingUtils.h"
2
3 #include <Data/ScalarSeries.h>
4 #include <Data/VectorSeries.h>
5
6 #include <Visualization/qcustomplot.h>
7
8 namespace {
9
10 /**
11 * Delegate used to set plottables properties
12 */
13 template <typename T, typename Enabled = void>
14 struct PlottablesSetter {
15 static void setProperties(T &, PlottablesMap &)
16 {
17 // Default implementation does nothing
18 }
19 };
20
21 /**
22 * Specialization of PlottablesSetter for scalars and vectors
23 * @sa ScalarSeries
24 * @sa VectorSeries
25 */
26 template <typename T>
27 struct PlottablesSetter<T, typename std::enable_if_t<std::is_base_of<ScalarSeries, T>::value
28 or std::is_base_of<VectorSeries, T>::value> > {
29 static void setProperties(T &dataSeries, PlottablesMap &plottables)
30 {
31 /// @todo ALX
32 }
33 };
34
35 /**
36 * Default implementation of IPlottablesHelper, which takes data series to set plottables properties
37 * @tparam T the data series' type
38 */
39 template <typename T>
40 struct PlottablesHelper : public IPlottablesHelper {
41 explicit PlottablesHelper(T &dataSeries) : m_DataSeries{dataSeries} {}
42
43 void setProperties(PlottablesMap &plottables) override
44 {
45 PlottablesSetter<T>::setProperties(m_DataSeries, plottables);
46 }
47
48 T &m_DataSeries;
49 };
50
51 } // namespace
52
53 std::unique_ptr<IPlottablesHelper>
54 IPlottablesHelperFactory::create(std::shared_ptr<IDataSeries> dataSeries) noexcept
55 {
56 if (auto scalarSeries = std::dynamic_pointer_cast<ScalarSeries>(dataSeries)) {
57 return std::make_unique<PlottablesHelper<ScalarSeries> >(*scalarSeries);
58 }
59 else if (auto vectorSeries = std::dynamic_pointer_cast<VectorSeries>(dataSeries)) {
60 return std::make_unique<PlottablesHelper<VectorSeries> >(*vectorSeries);
61 }
62 else {
63 return std::make_unique<PlottablesHelper<IDataSeries> >(*dataSeries);
64 }
65 }
@@ -1,96 +1,97
1
1
2 gui_moc_headers = [
2 gui_moc_headers = [
3 'include/DataSource/DataSourceWidget.h',
3 'include/DataSource/DataSourceWidget.h',
4 'include/DataSource/DataSourceTreeWidget.h',
4 'include/DataSource/DataSourceTreeWidget.h',
5 'include/Settings/SqpSettingsDialog.h',
5 'include/Settings/SqpSettingsDialog.h',
6 'include/Settings/SqpSettingsGeneralWidget.h',
6 'include/Settings/SqpSettingsGeneralWidget.h',
7 'include/SidePane/SqpSidePane.h',
7 'include/SidePane/SqpSidePane.h',
8 'include/SqpApplication.h',
8 'include/SqpApplication.h',
9 'include/DragAndDrop/DragDropHelper.h',
9 'include/DragAndDrop/DragDropHelper.h',
10 'include/DragAndDrop/DragDropScroller.h',
10 'include/DragAndDrop/DragDropScroller.h',
11 'include/DragAndDrop/DragDropTabSwitcher.h',
11 'include/DragAndDrop/DragDropTabSwitcher.h',
12 'include/TimeWidget/TimeWidget.h',
12 'include/TimeWidget/TimeWidget.h',
13 'include/Variable/VariableInspectorWidget.h',
13 'include/Variable/VariableInspectorWidget.h',
14 'include/Variable/VariableInspectorTableView.h',
14 'include/Variable/VariableInspectorTableView.h',
15 'include/Variable/RenameVariableDialog.h',
15 'include/Variable/RenameVariableDialog.h',
16 'include/Visualization/qcustomplot.h',
16 'include/Visualization/qcustomplot.h',
17 'include/Visualization/VisualizationGraphWidget.h',
17 'include/Visualization/VisualizationGraphWidget.h',
18 'include/Visualization/VisualizationTabWidget.h',
18 'include/Visualization/VisualizationTabWidget.h',
19 'include/Visualization/VisualizationWidget.h',
19 'include/Visualization/VisualizationWidget.h',
20 'include/Visualization/VisualizationZoneWidget.h',
20 'include/Visualization/VisualizationZoneWidget.h',
21 'include/Visualization/VisualizationDragDropContainer.h',
21 'include/Visualization/VisualizationDragDropContainer.h',
22 'include/Visualization/VisualizationDragWidget.h'
22 'include/Visualization/VisualizationDragWidget.h'
23 ]
23 ]
24
24
25 gui_ui_files = [
25 gui_ui_files = [
26 'ui/DataSource/DataSourceWidget.ui',
26 'ui/DataSource/DataSourceWidget.ui',
27 'ui/Settings/SqpSettingsDialog.ui',
27 'ui/Settings/SqpSettingsDialog.ui',
28 'ui/Settings/SqpSettingsGeneralWidget.ui',
28 'ui/Settings/SqpSettingsGeneralWidget.ui',
29 'ui/SidePane/SqpSidePane.ui',
29 'ui/SidePane/SqpSidePane.ui',
30 'ui/TimeWidget/TimeWidget.ui',
30 'ui/TimeWidget/TimeWidget.ui',
31 'ui/Variable/VariableInspectorWidget.ui',
31 'ui/Variable/VariableInspectorWidget.ui',
32 'ui/Variable/RenameVariableDialog.ui',
32 'ui/Variable/RenameVariableDialog.ui',
33 'ui/Variable/VariableMenuHeaderWidget.ui',
33 'ui/Variable/VariableMenuHeaderWidget.ui',
34 'ui/Visualization/VisualizationGraphWidget.ui',
34 'ui/Visualization/VisualizationGraphWidget.ui',
35 'ui/Visualization/VisualizationTabWidget.ui',
35 'ui/Visualization/VisualizationTabWidget.ui',
36 'ui/Visualization/VisualizationWidget.ui',
36 'ui/Visualization/VisualizationWidget.ui',
37 'ui/Visualization/VisualizationZoneWidget.ui'
37 'ui/Visualization/VisualizationZoneWidget.ui'
38 ]
38 ]
39
39
40 gui_qresources = ['resources/sqpguiresources.qrc']
40 gui_qresources = ['resources/sqpguiresources.qrc']
41
41
42 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
42 gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers,
43 ui_files : gui_ui_files,
43 ui_files : gui_ui_files,
44 qresources : gui_qresources)
44 qresources : gui_qresources)
45
45
46 gui_sources = [
46 gui_sources = [
47 'src/SqpApplication.cpp',
47 'src/SqpApplication.cpp',
48 'src/DragAndDrop/DragDropHelper.cpp',
48 'src/DragAndDrop/DragDropHelper.cpp',
49 'src/DragAndDrop/DragDropScroller.cpp',
49 'src/DragAndDrop/DragDropScroller.cpp',
50 'src/DragAndDrop/DragDropTabSwitcher.cpp',
50 'src/DragAndDrop/DragDropTabSwitcher.cpp',
51 'src/Common/ColorUtils.cpp',
51 'src/Common/ColorUtils.cpp',
52 'src/Common/VisualizationDef.cpp',
52 'src/Common/VisualizationDef.cpp',
53 'src/DataSource/DataSourceTreeWidgetItem.cpp',
53 'src/DataSource/DataSourceTreeWidgetItem.cpp',
54 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
54 'src/DataSource/DataSourceTreeWidgetHelper.cpp',
55 'src/DataSource/DataSourceWidget.cpp',
55 'src/DataSource/DataSourceWidget.cpp',
56 'src/DataSource/DataSourceTreeWidget.cpp',
56 'src/DataSource/DataSourceTreeWidget.cpp',
57 'src/Settings/SqpSettingsDialog.cpp',
57 'src/Settings/SqpSettingsDialog.cpp',
58 'src/Settings/SqpSettingsGeneralWidget.cpp',
58 'src/Settings/SqpSettingsGeneralWidget.cpp',
59 'src/SidePane/SqpSidePane.cpp',
59 'src/SidePane/SqpSidePane.cpp',
60 'src/TimeWidget/TimeWidget.cpp',
60 'src/TimeWidget/TimeWidget.cpp',
61 'src/Variable/VariableInspectorWidget.cpp',
61 'src/Variable/VariableInspectorWidget.cpp',
62 'src/Variable/VariableInspectorTableView.cpp',
62 'src/Variable/VariableInspectorTableView.cpp',
63 'src/Variable/VariableMenuHeaderWidget.cpp',
63 'src/Variable/VariableMenuHeaderWidget.cpp',
64 'src/Variable/RenameVariableDialog.cpp',
64 'src/Variable/RenameVariableDialog.cpp',
65 'src/Visualization/VisualizationGraphHelper.cpp',
65 'src/Visualization/VisualizationGraphHelper.cpp',
66 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
66 'src/Visualization/VisualizationGraphRenderingDelegate.cpp',
67 'src/Visualization/VisualizationGraphWidget.cpp',
67 'src/Visualization/VisualizationGraphWidget.cpp',
68 'src/Visualization/VisualizationTabWidget.cpp',
68 'src/Visualization/VisualizationTabWidget.cpp',
69 'src/Visualization/VisualizationWidget.cpp',
69 'src/Visualization/VisualizationWidget.cpp',
70 'src/Visualization/VisualizationZoneWidget.cpp',
70 'src/Visualization/VisualizationZoneWidget.cpp',
71 'src/Visualization/qcustomplot.cpp',
71 'src/Visualization/qcustomplot.cpp',
72 'src/Visualization/QCustomPlotSynchronizer.cpp',
72 'src/Visualization/QCustomPlotSynchronizer.cpp',
73 'src/Visualization/operations/FindVariableOperation.cpp',
73 'src/Visualization/operations/FindVariableOperation.cpp',
74 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
74 'src/Visualization/operations/GenerateVariableMenuOperation.cpp',
75 'src/Visualization/operations/MenuBuilder.cpp',
75 'src/Visualization/operations/MenuBuilder.cpp',
76 'src/Visualization/operations/RemoveVariableOperation.cpp',
76 'src/Visualization/operations/RemoveVariableOperation.cpp',
77 'src/Visualization/operations/RescaleAxeOperation.cpp',
77 'src/Visualization/operations/RescaleAxeOperation.cpp',
78 'src/Visualization/VisualizationDragDropContainer.cpp',
78 'src/Visualization/VisualizationDragDropContainer.cpp',
79 'src/Visualization/VisualizationDragWidget.cpp'
79 'src/Visualization/VisualizationDragWidget.cpp'
80 'src/Visualization/AxisRenderingUtils.cpp',
80 'src/Visualization/AxisRenderingUtils.cpp',
81 'src/Visualization/PlottablesRenderingUtils.cpp'
81 ]
82 ]
82
83
83 gui_inc = include_directories(['include'])
84 gui_inc = include_directories(['include'])
84
85
85 sciqlop_gui_lib = library('sciqlopgui',
86 sciqlop_gui_lib = library('sciqlopgui',
86 gui_sources,
87 gui_sources,
87 gui_moc_files,
88 gui_moc_files,
88 include_directories : [gui_inc],
89 include_directories : [gui_inc],
89 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
90 dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core],
90 install : true
91 install : true
91 )
92 )
92
93
93 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
94 sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib,
94 include_directories : gui_inc,
95 include_directories : gui_inc,
95 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
96 dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core])
96
97
General Comments 0
You need to be logged in to leave comments. Login now