@@ -0,0 +1,42 | |||||
|
1 | #ifndef SCIQLOP_FINDVARIABLEOPERATION_H | |||
|
2 | #define SCIQLOP_FINDVARIABLEOPERATION_H | |||
|
3 | ||||
|
4 | #include "Visualization/IVisualizationWidgetVisitor.h" | |||
|
5 | ||||
|
6 | #include <Common/spimpl.h> | |||
|
7 | ||||
|
8 | #include <set> | |||
|
9 | ||||
|
10 | class IVisualizationWidget; | |||
|
11 | class Variable; | |||
|
12 | ||||
|
13 | /** | |||
|
14 | * @brief The FindVariableOperation class defines an operation that traverses all of visualization | |||
|
15 | * widgets to determine which ones contain the variable passed as parameter. The result of the | |||
|
16 | * operation is the list of widgets that contain the variable. | |||
|
17 | */ | |||
|
18 | class FindVariableOperation : public IVisualizationWidgetVisitor { | |||
|
19 | public: | |||
|
20 | /** | |||
|
21 | * Ctor | |||
|
22 | * @param variable the variable to find | |||
|
23 | */ | |||
|
24 | explicit FindVariableOperation(std::shared_ptr<Variable> variable); | |||
|
25 | ||||
|
26 | void visitEnter(VisualizationWidget *widget) override final; | |||
|
27 | void visitLeave(VisualizationWidget *widget) override final; | |||
|
28 | void visitEnter(VisualizationTabWidget *tabWidget) override final; | |||
|
29 | void visitLeave(VisualizationTabWidget *tabWidget) override final; | |||
|
30 | void visitEnter(VisualizationZoneWidget *zoneWidget) override final; | |||
|
31 | void visitLeave(VisualizationZoneWidget *zoneWidget) override final; | |||
|
32 | void visit(VisualizationGraphWidget *graphWidget) override final; | |||
|
33 | ||||
|
34 | /// @return the widgets that contain the variable | |||
|
35 | std::set<IVisualizationWidget *> result() const noexcept; | |||
|
36 | ||||
|
37 | private: | |||
|
38 | class FindVariableOperationPrivate; | |||
|
39 | spimpl::unique_impl_ptr<FindVariableOperationPrivate> impl; | |||
|
40 | }; | |||
|
41 | ||||
|
42 | #endif // SCIQLOP_FINDVARIABLEOPERATION_H |
@@ -0,0 +1,72 | |||||
|
1 | #include "Visualization/operations/FindVariableOperation.h" | |||
|
2 | ||||
|
3 | #include "Visualization/VisualizationGraphWidget.h" | |||
|
4 | #include "Visualization/VisualizationTabWidget.h" | |||
|
5 | #include "Visualization/VisualizationWidget.h" | |||
|
6 | #include "Visualization/VisualizationZoneWidget.h" | |||
|
7 | ||||
|
8 | #include <Variable/Variable.h> | |||
|
9 | ||||
|
10 | struct FindVariableOperation::FindVariableOperationPrivate { | |||
|
11 | explicit FindVariableOperationPrivate(std::shared_ptr<Variable> variable) : m_Variable{variable} | |||
|
12 | { | |||
|
13 | } | |||
|
14 | ||||
|
15 | void visit(IVisualizationWidget *widget) | |||
|
16 | { | |||
|
17 | if (m_Variable && widget && widget->contains(*m_Variable)) { | |||
|
18 | m_Containers.insert(widget); | |||
|
19 | } | |||
|
20 | } | |||
|
21 | ||||
|
22 | std::shared_ptr<Variable> m_Variable; ///< Variable to find | |||
|
23 | std::set<IVisualizationWidget *> m_Containers; ///< Containers found for the variable | |||
|
24 | }; | |||
|
25 | ||||
|
26 | FindVariableOperation::FindVariableOperation(std::shared_ptr<Variable> variable) | |||
|
27 | : impl{spimpl::make_unique_impl<FindVariableOperationPrivate>(variable)} | |||
|
28 | { | |||
|
29 | } | |||
|
30 | ||||
|
31 | void FindVariableOperation::visitEnter(VisualizationWidget *widget) | |||
|
32 | { | |||
|
33 | impl->visit(widget); | |||
|
34 | } | |||
|
35 | ||||
|
36 | void FindVariableOperation::visitLeave(VisualizationWidget *widget) | |||
|
37 | { | |||
|
38 | // Does nothing | |||
|
39 | Q_UNUSED(widget); | |||
|
40 | } | |||
|
41 | ||||
|
42 | void FindVariableOperation::visitEnter(VisualizationTabWidget *tabWidget) | |||
|
43 | { | |||
|
44 | impl->visit(tabWidget); | |||
|
45 | } | |||
|
46 | ||||
|
47 | void FindVariableOperation::visitLeave(VisualizationTabWidget *tabWidget) | |||
|
48 | { | |||
|
49 | // Does nothing | |||
|
50 | Q_UNUSED(tabWidget); | |||
|
51 | } | |||
|
52 | ||||
|
53 | void FindVariableOperation::visitEnter(VisualizationZoneWidget *zoneWidget) | |||
|
54 | { | |||
|
55 | impl->visit(zoneWidget); | |||
|
56 | } | |||
|
57 | ||||
|
58 | void FindVariableOperation::visitLeave(VisualizationZoneWidget *zoneWidget) | |||
|
59 | { | |||
|
60 | // Does nothing | |||
|
61 | Q_UNUSED(zoneWidget); | |||
|
62 | } | |||
|
63 | ||||
|
64 | void FindVariableOperation::visit(VisualizationGraphWidget *graphWidget) | |||
|
65 | { | |||
|
66 | impl->visit(graphWidget); | |||
|
67 | } | |||
|
68 | ||||
|
69 | std::set<IVisualizationWidget *> FindVariableOperation::result() const noexcept | |||
|
70 | { | |||
|
71 | return impl->m_Containers; | |||
|
72 | } |
@@ -1,76 +1,77 | |||||
1 |
|
1 | |||
2 | gui_moc_headers = [ |
|
2 | gui_moc_headers = [ | |
3 | 'include/DataSource/DataSourceWidget.h', |
|
3 | 'include/DataSource/DataSourceWidget.h', | |
4 | 'include/Settings/SqpSettingsDialog.h', |
|
4 | 'include/Settings/SqpSettingsDialog.h', | |
5 | 'include/Settings/SqpSettingsGeneralWidget.h', |
|
5 | 'include/Settings/SqpSettingsGeneralWidget.h', | |
6 | 'include/SidePane/SqpSidePane.h', |
|
6 | 'include/SidePane/SqpSidePane.h', | |
7 | 'include/SqpApplication.h', |
|
7 | 'include/SqpApplication.h', | |
8 | 'include/TimeWidget/TimeWidget.h', |
|
8 | 'include/TimeWidget/TimeWidget.h', | |
9 | 'include/Variable/VariableInspectorWidget.h', |
|
9 | 'include/Variable/VariableInspectorWidget.h', | |
10 | 'include/Visualization/qcustomplot.h', |
|
10 | 'include/Visualization/qcustomplot.h', | |
11 | 'include/Visualization/VisualizationGraphWidget.h', |
|
11 | 'include/Visualization/VisualizationGraphWidget.h', | |
12 | 'include/Visualization/VisualizationTabWidget.h', |
|
12 | 'include/Visualization/VisualizationTabWidget.h', | |
13 | 'include/Visualization/VisualizationWidget.h', |
|
13 | 'include/Visualization/VisualizationWidget.h', | |
14 | 'include/Visualization/VisualizationZoneWidget.h' |
|
14 | 'include/Visualization/VisualizationZoneWidget.h' | |
15 | ] |
|
15 | ] | |
16 |
|
16 | |||
17 | gui_ui_files = [ |
|
17 | gui_ui_files = [ | |
18 | 'ui/DataSource/DataSourceWidget.ui', |
|
18 | 'ui/DataSource/DataSourceWidget.ui', | |
19 | 'ui/Settings/SqpSettingsDialog.ui', |
|
19 | 'ui/Settings/SqpSettingsDialog.ui', | |
20 | 'ui/Settings/SqpSettingsGeneralWidget.ui', |
|
20 | 'ui/Settings/SqpSettingsGeneralWidget.ui', | |
21 | 'ui/SidePane/SqpSidePane.ui', |
|
21 | 'ui/SidePane/SqpSidePane.ui', | |
22 | 'ui/TimeWidget/TimeWidget.ui', |
|
22 | 'ui/TimeWidget/TimeWidget.ui', | |
23 | 'ui/Variable/VariableInspectorWidget.ui', |
|
23 | 'ui/Variable/VariableInspectorWidget.ui', | |
24 | 'ui/Variable/VariableMenuHeaderWidget.ui', |
|
24 | 'ui/Variable/VariableMenuHeaderWidget.ui', | |
25 | 'ui/Visualization/VisualizationGraphWidget.ui', |
|
25 | 'ui/Visualization/VisualizationGraphWidget.ui', | |
26 | 'ui/Visualization/VisualizationTabWidget.ui', |
|
26 | 'ui/Visualization/VisualizationTabWidget.ui', | |
27 | 'ui/Visualization/VisualizationWidget.ui', |
|
27 | 'ui/Visualization/VisualizationWidget.ui', | |
28 | 'ui/Visualization/VisualizationZoneWidget.ui' |
|
28 | 'ui/Visualization/VisualizationZoneWidget.ui' | |
29 | ] |
|
29 | ] | |
30 |
|
30 | |||
31 | gui_qresources = ['resources/sqpguiresources.qrc'] |
|
31 | gui_qresources = ['resources/sqpguiresources.qrc'] | |
32 |
|
32 | |||
33 | gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers, |
|
33 | gui_moc_files = qt5.preprocess(moc_headers : gui_moc_headers, | |
34 | ui_files : gui_ui_files, |
|
34 | ui_files : gui_ui_files, | |
35 | qresources : gui_qresources) |
|
35 | qresources : gui_qresources) | |
36 |
|
36 | |||
37 | gui_sources = [ |
|
37 | gui_sources = [ | |
38 | 'src/SqpApplication.cpp', |
|
38 | 'src/SqpApplication.cpp', | |
39 | 'src/Common/ColorUtils.cpp', |
|
39 | 'src/Common/ColorUtils.cpp', | |
40 | 'src/DataSource/DataSourceTreeWidgetItem.cpp', |
|
40 | 'src/DataSource/DataSourceTreeWidgetItem.cpp', | |
41 | 'src/DataSource/DataSourceTreeWidgetHelper.cpp', |
|
41 | 'src/DataSource/DataSourceTreeWidgetHelper.cpp', | |
42 | 'src/DataSource/DataSourceWidget.cpp', |
|
42 | 'src/DataSource/DataSourceWidget.cpp', | |
43 | 'src/Settings/SqpSettingsDialog.cpp', |
|
43 | 'src/Settings/SqpSettingsDialog.cpp', | |
44 | 'src/Settings/SqpSettingsGeneralWidget.cpp', |
|
44 | 'src/Settings/SqpSettingsGeneralWidget.cpp', | |
45 | 'src/SidePane/SqpSidePane.cpp', |
|
45 | 'src/SidePane/SqpSidePane.cpp', | |
46 | 'src/TimeWidget/TimeWidget.cpp', |
|
46 | 'src/TimeWidget/TimeWidget.cpp', | |
47 | 'src/Variable/VariableInspectorWidget.cpp', |
|
47 | 'src/Variable/VariableInspectorWidget.cpp', | |
48 | 'src/Variable/VariableMenuHeaderWidget.cpp', |
|
48 | 'src/Variable/VariableMenuHeaderWidget.cpp', | |
49 | 'src/Visualization/VisualizationGraphHelper.cpp', |
|
49 | 'src/Visualization/VisualizationGraphHelper.cpp', | |
50 | 'src/Visualization/VisualizationGraphRenderingDelegate.cpp', |
|
50 | 'src/Visualization/VisualizationGraphRenderingDelegate.cpp', | |
51 | 'src/Visualization/VisualizationGraphWidget.cpp', |
|
51 | 'src/Visualization/VisualizationGraphWidget.cpp', | |
52 | 'src/Visualization/VisualizationTabWidget.cpp', |
|
52 | 'src/Visualization/VisualizationTabWidget.cpp', | |
53 | 'src/Visualization/VisualizationWidget.cpp', |
|
53 | 'src/Visualization/VisualizationWidget.cpp', | |
54 | 'src/Visualization/VisualizationZoneWidget.cpp', |
|
54 | 'src/Visualization/VisualizationZoneWidget.cpp', | |
55 | 'src/Visualization/qcustomplot.cpp', |
|
55 | 'src/Visualization/qcustomplot.cpp', | |
56 | 'src/Visualization/QCustomPlotSynchronizer.cpp', |
|
56 | 'src/Visualization/QCustomPlotSynchronizer.cpp', | |
|
57 | 'src/Visualization/operations/FindVariableOperation.cpp', | |||
57 | 'src/Visualization/operations/GenerateVariableMenuOperation.cpp', |
|
58 | 'src/Visualization/operations/GenerateVariableMenuOperation.cpp', | |
58 | 'src/Visualization/operations/MenuBuilder.cpp', |
|
59 | 'src/Visualization/operations/MenuBuilder.cpp', | |
59 | 'src/Visualization/operations/RemoveVariableOperation.cpp', |
|
60 | 'src/Visualization/operations/RemoveVariableOperation.cpp', | |
60 | 'src/Visualization/operations/RescaleAxeOperation.cpp' |
|
61 | 'src/Visualization/operations/RescaleAxeOperation.cpp' | |
61 | ] |
|
62 | ] | |
62 |
|
63 | |||
63 | gui_inc = include_directories(['include']) |
|
64 | gui_inc = include_directories(['include']) | |
64 |
|
65 | |||
65 | sciqlop_gui_lib = library('sciqlopgui', |
|
66 | sciqlop_gui_lib = library('sciqlopgui', | |
66 | gui_sources, |
|
67 | gui_sources, | |
67 | gui_moc_files, |
|
68 | gui_moc_files, | |
68 | include_directories : [gui_inc], |
|
69 | include_directories : [gui_inc], | |
69 | dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core], |
|
70 | dependencies : [ qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core], | |
70 | install : true |
|
71 | install : true | |
71 | ) |
|
72 | ) | |
72 |
|
73 | |||
73 | sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib, |
|
74 | sciqlop_gui = declare_dependency(link_with : sciqlop_gui_lib, | |
74 | include_directories : gui_inc, |
|
75 | include_directories : gui_inc, | |
75 | dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core]) |
|
76 | dependencies : [qt5printsupport, qt5gui, qt5widgets, qt5svg, sciqlop_core]) | |
76 |
|
77 |
General Comments 0
You need to be logged in to leave comments.
Login now