Auto status change to "Under Review"
@@ -0,0 +1,42 | |||||
|
1 | #ifndef SCIQLOP_RESCALEAXEOPERATION_H | |||
|
2 | #define SCIQLOP_RESCALEAXEOPERATION_H | |||
|
3 | ||||
|
4 | #include "Visualization/IVisualizationWidgetVisitor.h" | |||
|
5 | #include <Data/SqpDateTime.h> | |||
|
6 | ||||
|
7 | #include <Common/spimpl.h> | |||
|
8 | ||||
|
9 | #include <QLoggingCategory> | |||
|
10 | ||||
|
11 | #include <memory> | |||
|
12 | ||||
|
13 | class Variable; | |||
|
14 | ||||
|
15 | Q_DECLARE_LOGGING_CATEGORY(LOG_RescaleAxeOperation) | |||
|
16 | ||||
|
17 | /** | |||
|
18 | * @brief The RescaleAxeOperation class defines an operation that traverses all of visualization | |||
|
19 | * widgets to remove a variable if they contain it | |||
|
20 | */ | |||
|
21 | class RescaleAxeOperation : public IVisualizationWidgetVisitor { | |||
|
22 | public: | |||
|
23 | /** | |||
|
24 | * Ctor | |||
|
25 | * @param variable the variable to remove from widgets | |||
|
26 | */ | |||
|
27 | explicit RescaleAxeOperation(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
|
28 | ||||
|
29 | void visitEnter(VisualizationWidget *widget) override final; | |||
|
30 | void visitLeave(VisualizationWidget *widget) override final; | |||
|
31 | void visitEnter(VisualizationTabWidget *tabWidget) override final; | |||
|
32 | void visitLeave(VisualizationTabWidget *tabWidget) override final; | |||
|
33 | void visitEnter(VisualizationZoneWidget *zoneWidget) override final; | |||
|
34 | void visitLeave(VisualizationZoneWidget *zoneWidget) override final; | |||
|
35 | void visit(VisualizationGraphWidget *graphWidget) override final; | |||
|
36 | ||||
|
37 | private: | |||
|
38 | class RescaleAxeOperationPrivate; | |||
|
39 | spimpl::unique_impl_ptr<RescaleAxeOperationPrivate> impl; | |||
|
40 | }; | |||
|
41 | ||||
|
42 | #endif // SCIQLOP_RESCALEAXEOPERATION_H |
@@ -0,0 +1,71 | |||||
|
1 | #include "Visualization/operations/RescaleAxeOperation.h" | |||
|
2 | #include "Visualization/VisualizationGraphWidget.h" | |||
|
3 | ||||
|
4 | Q_LOGGING_CATEGORY(LOG_RescaleAxeOperation, "RescaleAxeOperation") | |||
|
5 | ||||
|
6 | struct RescaleAxeOperation::RescaleAxeOperationPrivate { | |||
|
7 | explicit RescaleAxeOperationPrivate(std::shared_ptr<Variable> variable, | |||
|
8 | const SqpDateTime &range) | |||
|
9 | : m_Variable(variable), m_Range(range) | |||
|
10 | { | |||
|
11 | } | |||
|
12 | ||||
|
13 | std::shared_ptr<Variable> m_Variable; | |||
|
14 | SqpDateTime m_Range; | |||
|
15 | }; | |||
|
16 | ||||
|
17 | RescaleAxeOperation::RescaleAxeOperation(std::shared_ptr<Variable> variable, | |||
|
18 | const SqpDateTime &range) | |||
|
19 | : impl{spimpl::make_unique_impl<RescaleAxeOperationPrivate>(variable, range)} | |||
|
20 | { | |||
|
21 | } | |||
|
22 | ||||
|
23 | void RescaleAxeOperation::visitEnter(VisualizationWidget *widget) | |||
|
24 | { | |||
|
25 | // VisualizationWidget is not intended to contain a variable | |||
|
26 | Q_UNUSED(widget) | |||
|
27 | } | |||
|
28 | ||||
|
29 | void RescaleAxeOperation::visitLeave(VisualizationWidget *widget) | |||
|
30 | { | |||
|
31 | // VisualizationWidget is not intended to contain a variable | |||
|
32 | Q_UNUSED(widget) | |||
|
33 | } | |||
|
34 | ||||
|
35 | void RescaleAxeOperation::visitEnter(VisualizationTabWidget *tabWidget) | |||
|
36 | { | |||
|
37 | // VisualizationTabWidget is not intended to contain a variable | |||
|
38 | Q_UNUSED(tabWidget) | |||
|
39 | } | |||
|
40 | ||||
|
41 | void RescaleAxeOperation::visitLeave(VisualizationTabWidget *tabWidget) | |||
|
42 | { | |||
|
43 | // VisualizationTabWidget is not intended to contain a variable | |||
|
44 | Q_UNUSED(tabWidget) | |||
|
45 | } | |||
|
46 | ||||
|
47 | void RescaleAxeOperation::visitEnter(VisualizationZoneWidget *zoneWidget) | |||
|
48 | { | |||
|
49 | // VisualizationZoneWidget is not intended to contain a variable | |||
|
50 | Q_UNUSED(zoneWidget) | |||
|
51 | } | |||
|
52 | ||||
|
53 | void RescaleAxeOperation::visitLeave(VisualizationZoneWidget *zoneWidget) | |||
|
54 | { | |||
|
55 | // VisualizationZoneWidget is not intended to contain a variable | |||
|
56 | Q_UNUSED(zoneWidget) | |||
|
57 | } | |||
|
58 | ||||
|
59 | void RescaleAxeOperation::visit(VisualizationGraphWidget *graphWidget) | |||
|
60 | { | |||
|
61 | if (graphWidget) { | |||
|
62 | // If the widget contains the variable, removes it | |||
|
63 | if (impl->m_Variable && graphWidget->contains(*impl->m_Variable)) { | |||
|
64 | graphWidget->setRange(impl->m_Variable, impl->m_Range); | |||
|
65 | } | |||
|
66 | } | |||
|
67 | else { | |||
|
68 | qCCritical(LOG_RescaleAxeOperation(), | |||
|
69 | "Can't visit VisualizationGraphWidget : the widget is null"); | |||
|
70 | } | |||
|
71 | } |
@@ -1,265 +1,269 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the SciQLop Software |
|
2 | -- This file is a part of the SciQLop Software | |
3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "MainWindow.h" |
|
22 | #include "MainWindow.h" | |
23 | #include "ui_MainWindow.h" |
|
23 | #include "ui_MainWindow.h" | |
24 |
|
24 | |||
25 | #include <DataSource/DataSourceController.h> |
|
25 | #include <DataSource/DataSourceController.h> | |
26 | #include <DataSource/DataSourceWidget.h> |
|
26 | #include <DataSource/DataSourceWidget.h> | |
27 | #include <SidePane/SqpSidePane.h> |
|
27 | #include <SidePane/SqpSidePane.h> | |
28 | #include <SqpApplication.h> |
|
28 | #include <SqpApplication.h> | |
29 | #include <Time/TimeController.h> |
|
29 | #include <Time/TimeController.h> | |
30 | #include <TimeWidget/TimeWidget.h> |
|
30 | #include <TimeWidget/TimeWidget.h> | |
31 | #include <Variable/Variable.h> |
|
31 | #include <Variable/Variable.h> | |
32 | #include <Variable/VariableController.h> |
|
32 | #include <Variable/VariableController.h> | |
33 | #include <Visualization/VisualizationController.h> |
|
33 | #include <Visualization/VisualizationController.h> | |
34 |
|
34 | |||
35 | #include <QAction> |
|
35 | #include <QAction> | |
36 | #include <QDate> |
|
36 | #include <QDate> | |
37 | #include <QDateTime> |
|
37 | #include <QDateTime> | |
38 | #include <QDir> |
|
38 | #include <QDir> | |
39 | #include <QFileDialog> |
|
39 | #include <QFileDialog> | |
40 | #include <QToolBar> |
|
40 | #include <QToolBar> | |
41 | #include <QToolButton> |
|
41 | #include <QToolButton> | |
42 | #include <memory.h> |
|
42 | #include <memory.h> | |
43 |
|
43 | |||
44 | //#include <omp.h> |
|
44 | //#include <omp.h> | |
45 | //#include <network/filedownloader.h> |
|
45 | //#include <network/filedownloader.h> | |
46 | //#include <qlopdatabase.h> |
|
46 | //#include <qlopdatabase.h> | |
47 | //#include <qlopsettings.h> |
|
47 | //#include <qlopsettings.h> | |
48 | //#include <qlopgui.h> |
|
48 | //#include <qlopgui.h> | |
49 | //#include <spacedata.h> |
|
49 | //#include <spacedata.h> | |
50 | //#include "qlopcore.h" |
|
50 | //#include "qlopcore.h" | |
51 | //#include "qlopcodecmanager.h" |
|
51 | //#include "qlopcodecmanager.h" | |
52 | //#include "cdfcodec.h" |
|
52 | //#include "cdfcodec.h" | |
53 | //#include "amdatxtcodec.h" |
|
53 | //#include "amdatxtcodec.h" | |
54 | //#include <qlopplotmanager.h> |
|
54 | //#include <qlopplotmanager.h> | |
55 |
|
55 | |||
56 | #include "iostream" |
|
56 | #include "iostream" | |
57 |
|
57 | |||
58 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") |
|
58 | Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow") | |
59 |
|
59 | |||
60 | namespace { |
|
60 | namespace { | |
61 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; |
|
61 | const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0; | |
62 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; |
|
62 | const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1; | |
63 | const auto VIEWPLITTERINDEX = 2; |
|
63 | const auto VIEWPLITTERINDEX = 2; | |
64 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; |
|
64 | const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3; | |
65 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; |
|
65 | const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4; | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | class MainWindow::MainWindowPrivate { |
|
68 | class MainWindow::MainWindowPrivate { | |
69 | public: |
|
69 | public: | |
70 | QSize m_LastOpenLeftInspectorSize; |
|
70 | QSize m_LastOpenLeftInspectorSize; | |
71 | QSize m_LastOpenRightInspectorSize; |
|
71 | QSize m_LastOpenRightInspectorSize; | |
72 | }; |
|
72 | }; | |
73 |
|
73 | |||
74 | MainWindow::MainWindow(QWidget *parent) |
|
74 | MainWindow::MainWindow(QWidget *parent) | |
75 | : QMainWindow{parent}, |
|
75 | : QMainWindow{parent}, | |
76 | m_Ui{new Ui::MainWindow}, |
|
76 | m_Ui{new Ui::MainWindow}, | |
77 | impl{spimpl::make_unique_impl<MainWindowPrivate>()} |
|
77 | impl{spimpl::make_unique_impl<MainWindowPrivate>()} | |
78 | { |
|
78 | { | |
79 | m_Ui->setupUi(this); |
|
79 | m_Ui->setupUi(this); | |
80 |
|
80 | |||
81 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
81 | m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false); | |
82 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); |
|
82 | m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false); | |
83 |
|
83 | |||
84 |
|
84 | |||
85 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); |
|
85 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); | |
86 | auto openLeftInspectorAction = new QAction{QIcon{ |
|
86 | auto openLeftInspectorAction = new QAction{QIcon{ | |
87 | ":/icones/previous.png", |
|
87 | ":/icones/previous.png", | |
88 | }, |
|
88 | }, | |
89 | tr("Show/hide the left inspector"), this}; |
|
89 | tr("Show/hide the left inspector"), this}; | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | auto spacerLeftTop = new QWidget{}; |
|
92 | auto spacerLeftTop = new QWidget{}; | |
93 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
93 | spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
94 |
|
94 | |||
95 | auto spacerLeftBottom = new QWidget{}; |
|
95 | auto spacerLeftBottom = new QWidget{}; | |
96 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
96 | spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
97 |
|
97 | |||
98 | leftSidePane->addWidget(spacerLeftTop); |
|
98 | leftSidePane->addWidget(spacerLeftTop); | |
99 | leftSidePane->addAction(openLeftInspectorAction); |
|
99 | leftSidePane->addAction(openLeftInspectorAction); | |
100 | leftSidePane->addWidget(spacerLeftBottom); |
|
100 | leftSidePane->addWidget(spacerLeftBottom); | |
101 |
|
101 | |||
102 |
|
102 | |||
103 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); |
|
103 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); | |
104 | auto openRightInspectorAction = new QAction{QIcon{ |
|
104 | auto openRightInspectorAction = new QAction{QIcon{ | |
105 | ":/icones/next.png", |
|
105 | ":/icones/next.png", | |
106 | }, |
|
106 | }, | |
107 | tr("Show/hide the right inspector"), this}; |
|
107 | tr("Show/hide the right inspector"), this}; | |
108 |
|
108 | |||
109 | auto spacerRightTop = new QWidget{}; |
|
109 | auto spacerRightTop = new QWidget{}; | |
110 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
110 | spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
111 |
|
111 | |||
112 | auto spacerRightBottom = new QWidget{}; |
|
112 | auto spacerRightBottom = new QWidget{}; | |
113 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
113 | spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | |
114 |
|
114 | |||
115 | rightSidePane->addWidget(spacerRightTop); |
|
115 | rightSidePane->addWidget(spacerRightTop); | |
116 | rightSidePane->addAction(openRightInspectorAction); |
|
116 | rightSidePane->addAction(openRightInspectorAction); | |
117 | rightSidePane->addWidget(spacerRightBottom); |
|
117 | rightSidePane->addWidget(spacerRightBottom); | |
118 |
|
118 | |||
119 | openLeftInspectorAction->setCheckable(true); |
|
119 | openLeftInspectorAction->setCheckable(true); | |
120 | openRightInspectorAction->setCheckable(true); |
|
120 | openRightInspectorAction->setCheckable(true); | |
121 |
|
121 | |||
122 | auto openInspector = [this](bool checked, bool right, auto action) { |
|
122 | auto openInspector = [this](bool checked, bool right, auto action) { | |
123 |
|
123 | |||
124 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); |
|
124 | action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"}); | |
125 |
|
125 | |||
126 | auto &lastInspectorSize |
|
126 | auto &lastInspectorSize | |
127 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; |
|
127 | = right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize; | |
128 |
|
128 | |||
129 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() |
|
129 | auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size() | |
130 | : m_Ui->leftMainInspectorWidget->size(); |
|
130 | : m_Ui->leftMainInspectorWidget->size(); | |
131 |
|
131 | |||
132 | // Update of the last opened geometry |
|
132 | // Update of the last opened geometry | |
133 | if (checked) { |
|
133 | if (checked) { | |
134 | lastInspectorSize = nextInspectorSize; |
|
134 | lastInspectorSize = nextInspectorSize; | |
135 | } |
|
135 | } | |
136 |
|
136 | |||
137 | auto startSize = lastInspectorSize; |
|
137 | auto startSize = lastInspectorSize; | |
138 | auto endSize = startSize; |
|
138 | auto endSize = startSize; | |
139 | endSize.setWidth(0); |
|
139 | endSize.setWidth(0); | |
140 |
|
140 | |||
141 | auto splitterInspectorIndex |
|
141 | auto splitterInspectorIndex | |
142 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; |
|
142 | = right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX; | |
143 |
|
143 | |||
144 | auto currentSizes = m_Ui->splitter->sizes(); |
|
144 | auto currentSizes = m_Ui->splitter->sizes(); | |
145 | if (checked) { |
|
145 | if (checked) { | |
146 | // adjust sizes individually here, e.g. |
|
146 | // adjust sizes individually here, e.g. | |
147 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); |
|
147 | currentSizes[splitterInspectorIndex] -= lastInspectorSize.width(); | |
148 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); |
|
148 | currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width(); | |
149 | m_Ui->splitter->setSizes(currentSizes); |
|
149 | m_Ui->splitter->setSizes(currentSizes); | |
150 | } |
|
150 | } | |
151 | else { |
|
151 | else { | |
152 | // adjust sizes individually here, e.g. |
|
152 | // adjust sizes individually here, e.g. | |
153 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); |
|
153 | currentSizes[splitterInspectorIndex] += lastInspectorSize.width(); | |
154 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); |
|
154 | currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width(); | |
155 | m_Ui->splitter->setSizes(currentSizes); |
|
155 | m_Ui->splitter->setSizes(currentSizes); | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | }; |
|
158 | }; | |
159 |
|
159 | |||
160 |
|
160 | |||
161 | connect(openLeftInspectorAction, &QAction::triggered, |
|
161 | connect(openLeftInspectorAction, &QAction::triggered, | |
162 | [openInspector, openLeftInspectorAction](bool checked) { |
|
162 | [openInspector, openLeftInspectorAction](bool checked) { | |
163 | openInspector(checked, false, openLeftInspectorAction); |
|
163 | openInspector(checked, false, openLeftInspectorAction); | |
164 | }); |
|
164 | }); | |
165 | connect(openRightInspectorAction, &QAction::triggered, |
|
165 | connect(openRightInspectorAction, &QAction::triggered, | |
166 | [openInspector, openRightInspectorAction](bool checked) { |
|
166 | [openInspector, openRightInspectorAction](bool checked) { | |
167 | openInspector(checked, true, openRightInspectorAction); |
|
167 | openInspector(checked, true, openRightInspectorAction); | |
168 | }); |
|
168 | }); | |
169 |
|
169 | |||
170 | this->menuBar()->addAction(tr("File")); |
|
170 | this->menuBar()->addAction(tr("File")); | |
171 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); |
|
171 | auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar")); | |
172 |
|
172 | |||
173 | auto timeWidget = new TimeWidget{}; |
|
173 | auto timeWidget = new TimeWidget{}; | |
174 | mainToolBar->addWidget(timeWidget); |
|
174 | mainToolBar->addWidget(timeWidget); | |
175 |
|
175 | |||
176 | // Controllers / controllers connections |
|
176 | // Controllers / controllers connections | |
177 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)), |
|
177 | connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)), | |
178 | &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime))); |
|
178 | &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime))); | |
179 |
|
179 | |||
180 | // Widgets / controllers connections |
|
180 | // Widgets / controllers connections | |
181 |
|
181 | |||
182 | // DataSource |
|
182 | // DataSource | |
183 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), |
|
183 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), | |
184 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); |
|
184 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); | |
185 |
|
185 | |||
186 | // Time |
|
186 | // Time | |
187 | connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(), |
|
187 | connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(), | |
188 | SLOT(onTimeToUpdate(SqpDateTime))); |
|
188 | SLOT(onTimeToUpdate(SqpDateTime))); | |
189 |
|
189 | |||
190 | // Visualization |
|
190 | // Visualization | |
191 | connect(&sqpApp->visualizationController(), |
|
191 | connect(&sqpApp->visualizationController(), | |
192 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, |
|
192 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), m_Ui->view, | |
193 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); |
|
193 | SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>))); | |
194 |
|
194 | |||
|
195 | connect(&sqpApp->visualizationController(), | |||
|
196 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)), m_Ui->view, | |||
|
197 | SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpDateTime &))); | |||
|
198 | ||||
195 | // Widgets / widgets connections |
|
199 | // Widgets / widgets connections | |
196 |
|
200 | |||
197 | // For the following connections, we use DirectConnection to allow each widget that can |
|
201 | // For the following connections, we use DirectConnection to allow each widget that can | |
198 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. |
|
202 | // potentially attach a menu to the variable's menu to do so before this menu is displayed. | |
199 | // The order of connections is also important, since it determines the order in which each |
|
203 | // The order of connections is also important, since it determines the order in which each | |
200 | // widget will attach its menu |
|
204 | // widget will attach its menu | |
201 | connect( |
|
205 | connect( | |
202 | m_Ui->variableInspectorWidget, |
|
206 | m_Ui->variableInspectorWidget, | |
203 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
207 | SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)), | |
204 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), |
|
208 | m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)), | |
205 | Qt::DirectConnection); |
|
209 | Qt::DirectConnection); | |
206 |
|
210 | |||
207 | /* QLopGUI::registerMenuBar(menuBar()); |
|
211 | /* QLopGUI::registerMenuBar(menuBar()); | |
208 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); |
|
212 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); | |
209 | this->m_progressWidget = new QWidget(); |
|
213 | this->m_progressWidget = new QWidget(); | |
210 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); |
|
214 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); | |
211 | this->m_progressWidget->setLayout(this->m_progressLayout); |
|
215 | this->m_progressWidget->setLayout(this->m_progressLayout); | |
212 | this->m_progressWidget->setWindowModality(Qt::WindowModal); |
|
216 | this->m_progressWidget->setWindowModality(Qt::WindowModal); | |
213 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); |
|
217 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); | |
214 | for(int i=0;i<OMP_THREADS;i++) |
|
218 | for(int i=0;i<OMP_THREADS;i++) | |
215 | { |
|
219 | { | |
216 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); |
|
220 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); | |
217 | this->m_progress.last()->setMinimum(0); |
|
221 | this->m_progress.last()->setMinimum(0); | |
218 | this->m_progress.last()->setMaximum(100); |
|
222 | this->m_progress.last()->setMaximum(100); | |
219 | this->m_progressLayout->addWidget(this->m_progress.last()); |
|
223 | this->m_progressLayout->addWidget(this->m_progress.last()); | |
220 | this->m_progressWidget->hide(); |
|
224 | this->m_progressWidget->hide(); | |
221 | this->m_progressThreadIds[i] = -1; |
|
225 | this->m_progressThreadIds[i] = -1; | |
222 | } |
|
226 | } | |
223 | this->m_progressWidget->setWindowTitle("Loading File"); |
|
227 | this->m_progressWidget->setWindowTitle("Loading File"); | |
224 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() |
|
228 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() | |
225 | << QLopCore::self() |
|
229 | << QLopCore::self() | |
226 | << QLopPlotManager::self() |
|
230 | << QLopPlotManager::self() | |
227 | << QLopCodecManager::self() |
|
231 | << QLopCodecManager::self() | |
228 | << FileDownloader::self() |
|
232 | << FileDownloader::self() | |
229 | << QLopDataBase::self() |
|
233 | << QLopDataBase::self() | |
230 | << SpaceData::self(); |
|
234 | << SpaceData::self(); | |
231 |
|
235 | |||
232 | CDFCodec::registerToManager(); |
|
236 | CDFCodec::registerToManager(); | |
233 | AMDATXTCodec::registerToManager(); |
|
237 | AMDATXTCodec::registerToManager(); | |
234 |
|
238 | |||
235 |
|
239 | |||
236 | for(int i=0;i<ServicesToLoad.count();i++) |
|
240 | for(int i=0;i<ServicesToLoad.count();i++) | |
237 | { |
|
241 | { | |
238 | qDebug()<<ServicesToLoad.at(i)->serviceName(); |
|
242 | qDebug()<<ServicesToLoad.at(i)->serviceName(); | |
239 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI |
|
243 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI | |
240 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); |
|
244 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); | |
241 | if(wdgt) |
|
245 | if(wdgt) | |
242 | { |
|
246 | { | |
243 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
247 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); | |
244 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); |
|
248 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); | |
245 | } |
|
249 | } | |
246 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); |
|
250 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); | |
247 | }*/ |
|
251 | }*/ | |
248 | } |
|
252 | } | |
249 |
|
253 | |||
250 | MainWindow::~MainWindow() |
|
254 | MainWindow::~MainWindow() | |
251 | { |
|
255 | { | |
252 | } |
|
256 | } | |
253 |
|
257 | |||
254 |
|
258 | |||
255 | void MainWindow::changeEvent(QEvent *e) |
|
259 | void MainWindow::changeEvent(QEvent *e) | |
256 | { |
|
260 | { | |
257 | QMainWindow::changeEvent(e); |
|
261 | QMainWindow::changeEvent(e); | |
258 | switch (e->type()) { |
|
262 | switch (e->type()) { | |
259 | case QEvent::LanguageChange: |
|
263 | case QEvent::LanguageChange: | |
260 | m_Ui->retranslateUi(this); |
|
264 | m_Ui->retranslateUi(this); | |
261 | break; |
|
265 | break; | |
262 | default: |
|
266 | default: | |
263 | break; |
|
267 | break; | |
264 | } |
|
268 | } | |
265 | } |
|
269 | } |
@@ -1,70 +1,72 | |||||
1 | #ifndef SCIQLOP_IDATAPROVIDER_H |
|
1 | #ifndef SCIQLOP_IDATAPROVIDER_H | |
2 | #define SCIQLOP_IDATAPROVIDER_H |
|
2 | #define SCIQLOP_IDATAPROVIDER_H | |
3 |
|
3 | |||
4 | #include <memory> |
|
4 | #include <memory> | |
5 |
|
5 | |||
6 | #include <QObject> |
|
6 | #include <QObject> | |
7 | #include <QUuid> |
|
7 | #include <QUuid> | |
8 |
|
8 | |||
9 | #include <Common/MetaTypes.h> |
|
9 | #include <Common/MetaTypes.h> | |
10 |
|
10 | |||
11 | #include <Data/SqpDateTime.h> |
|
11 | #include <Data/SqpDateTime.h> | |
12 |
|
12 | |||
|
13 | #include <functional> | |||
|
14 | ||||
13 | class DataProviderParameters; |
|
15 | class DataProviderParameters; | |
14 | class IDataSeries; |
|
16 | class IDataSeries; | |
15 | class QNetworkReply; |
|
17 | class QNetworkReply; | |
16 | class QNetworkRequest; |
|
18 | class QNetworkRequest; | |
17 |
|
19 | |||
18 | /** |
|
20 | /** | |
19 | * @brief The IDataProvider interface aims to declare a data provider. |
|
21 | * @brief The IDataProvider interface aims to declare a data provider. | |
20 | * |
|
22 | * | |
21 | * A data provider is an entity that generates data and returns it according to various parameters |
|
23 | * A data provider is an entity that generates data and returns it according to various parameters | |
22 | * (time interval, product to retrieve the data, etc.) |
|
24 | * (time interval, product to retrieve the data, etc.) | |
23 | * |
|
25 | * | |
24 | * @sa IDataSeries |
|
26 | * @sa IDataSeries | |
25 | */ |
|
27 | */ | |
26 | class IDataProvider : public QObject { |
|
28 | class IDataProvider : public QObject { | |
27 |
|
29 | |||
28 | Q_OBJECT |
|
30 | Q_OBJECT | |
29 | public: |
|
31 | public: | |
30 | virtual ~IDataProvider() noexcept = default; |
|
32 | virtual ~IDataProvider() noexcept = default; | |
31 |
|
33 | |||
32 | /** |
|
34 | /** | |
33 | * @brief requestDataLoading provide datas for the data identified by identifier and parameters |
|
35 | * @brief requestDataLoading provide datas for the data identified by identifier and parameters | |
34 | */ |
|
36 | */ | |
35 | virtual void requestDataLoading(QUuid identifier, const DataProviderParameters ¶meters) = 0; |
|
37 | virtual void requestDataLoading(QUuid identifier, const DataProviderParameters ¶meters) = 0; | |
36 |
|
38 | |||
37 | /** |
|
39 | /** | |
38 | * @brief requestDataAborting stop data loading of the data identified by identifier |
|
40 | * @brief requestDataAborting stop data loading of the data identified by identifier | |
39 | */ |
|
41 | */ | |
40 | virtual void requestDataAborting(QUuid identifier) = 0; |
|
42 | virtual void requestDataAborting(QUuid identifier) = 0; | |
41 |
|
43 | |||
42 | signals: |
|
44 | signals: | |
43 | /** |
|
45 | /** | |
44 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data |
|
46 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data | |
45 | * identified by identifier |
|
47 | * identified by identifier | |
46 | */ |
|
48 | */ | |
47 | void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie, |
|
49 | void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie, | |
48 | const SqpDateTime &dateTime); |
|
50 | const SqpDateTime &dateTime); | |
49 |
|
51 | |||
50 | /** |
|
52 | /** | |
51 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data |
|
53 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data | |
52 | * identified by identifier |
|
54 | * identified by identifier | |
53 | */ |
|
55 | */ | |
54 | void dataProvidedProgress(QUuid identifier, double progress); |
|
56 | void dataProvidedProgress(QUuid identifier, double progress); | |
55 |
|
57 | |||
56 |
|
58 | |||
57 | /** |
|
59 | /** | |
58 | * @brief requestConstructed send a request for the data identified by identifier |
|
60 | * @brief requestConstructed send a request for the data identified by identifier | |
59 | * @callback is the methode call by the reply of the request when it is finished. |
|
61 | * @callback is the methode call by the reply of the request when it is finished. | |
60 | */ |
|
62 | */ | |
61 | void requestConstructed(const QNetworkRequest &request, QUuid identifier, |
|
63 | void requestConstructed(const QNetworkRequest &request, QUuid identifier, | |
62 | std::function<void(QNetworkReply *, QUuid)> callback); |
|
64 | std::function<void(QNetworkReply *, QUuid)> callback); | |
63 | }; |
|
65 | }; | |
64 |
|
66 | |||
65 | // Required for using shared_ptr in signals/slots |
|
67 | // Required for using shared_ptr in signals/slots | |
66 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) |
|
68 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) | |
67 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, |
|
69 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, | |
68 | std::function<void(QNetworkReply *, QUuid)>) |
|
70 | std::function<void(QNetworkReply *, QUuid)>) | |
69 |
|
71 | |||
70 | #endif // SCIQLOP_IDATAPROVIDER_H |
|
72 | #endif // SCIQLOP_IDATAPROVIDER_H |
@@ -1,48 +1,50 | |||||
1 | #ifndef SCIQLOP_DATASOURCEITEMACTION_H |
|
1 | #ifndef SCIQLOP_DATASOURCEITEMACTION_H | |
2 | #define SCIQLOP_DATASOURCEITEMACTION_H |
|
2 | #define SCIQLOP_DATASOURCEITEMACTION_H | |
3 |
|
3 | |||
4 | #include <Common/spimpl.h> |
|
4 | #include <Common/spimpl.h> | |
5 |
|
5 | |||
6 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
7 | #include <QObject> | |
8 |
|
8 | |||
|
9 | #include <functional> | |||
|
10 | ||||
9 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceItemAction) |
|
11 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceItemAction) | |
10 |
|
12 | |||
11 | class DataSourceItem; |
|
13 | class DataSourceItem; | |
12 |
|
14 | |||
13 | /** |
|
15 | /** | |
14 | * @brief The DataSourceItemAction class represents an action on a data source item. |
|
16 | * @brief The DataSourceItemAction class represents an action on a data source item. | |
15 | * |
|
17 | * | |
16 | * An action is a function that will be executed when the slot execute() is called. |
|
18 | * An action is a function that will be executed when the slot execute() is called. | |
17 | */ |
|
19 | */ | |
18 | class DataSourceItemAction : public QObject { |
|
20 | class DataSourceItemAction : public QObject { | |
19 |
|
21 | |||
20 | Q_OBJECT |
|
22 | Q_OBJECT | |
21 |
|
23 | |||
22 | public: |
|
24 | public: | |
23 | /// Signature of the function associated to the action |
|
25 | /// Signature of the function associated to the action | |
24 | using ExecuteFunction = std::function<void(DataSourceItem &dataSourceItem)>; |
|
26 | using ExecuteFunction = std::function<void(DataSourceItem &dataSourceItem)>; | |
25 |
|
27 | |||
26 | /** |
|
28 | /** | |
27 | * Ctor |
|
29 | * Ctor | |
28 | * @param name the name of the action |
|
30 | * @param name the name of the action | |
29 | * @param fun the function that will be called when the action is executed |
|
31 | * @param fun the function that will be called when the action is executed | |
30 | * @sa execute() |
|
32 | * @sa execute() | |
31 | */ |
|
33 | */ | |
32 | explicit DataSourceItemAction(const QString &name, ExecuteFunction fun); |
|
34 | explicit DataSourceItemAction(const QString &name, ExecuteFunction fun); | |
33 |
|
35 | |||
34 | QString name() const noexcept; |
|
36 | QString name() const noexcept; | |
35 |
|
37 | |||
36 | /// Sets the data source item concerned by the action |
|
38 | /// Sets the data source item concerned by the action | |
37 | void setDataSourceItem(DataSourceItem *dataSourceItem) noexcept; |
|
39 | void setDataSourceItem(DataSourceItem *dataSourceItem) noexcept; | |
38 |
|
40 | |||
39 | public slots: |
|
41 | public slots: | |
40 | /// Executes the action |
|
42 | /// Executes the action | |
41 | void execute(); |
|
43 | void execute(); | |
42 |
|
44 | |||
43 | private: |
|
45 | private: | |
44 | class DataSourceItemActionPrivate; |
|
46 | class DataSourceItemActionPrivate; | |
45 | spimpl::unique_impl_ptr<DataSourceItemActionPrivate> impl; |
|
47 | spimpl::unique_impl_ptr<DataSourceItemActionPrivate> impl; | |
46 | }; |
|
48 | }; | |
47 |
|
49 | |||
48 | #endif // SCIQLOP_DATASOURCEITEMACTION_H |
|
50 | #endif // SCIQLOP_DATASOURCEITEMACTION_H |
@@ -1,92 +1,95 | |||||
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H |
|
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H | |
2 | #define SCIQLOP_VARIABLECONTROLLER_H |
|
2 | #define SCIQLOP_VARIABLECONTROLLER_H | |
3 |
|
3 | |||
4 | #include <Data/SqpDateTime.h> |
|
4 | #include <Data/SqpDateTime.h> | |
5 |
|
5 | |||
6 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
7 | #include <QObject> | |
8 |
|
8 | |||
9 | #include <Common/spimpl.h> |
|
9 | #include <Common/spimpl.h> | |
10 |
|
10 | |||
11 | class IDataProvider; |
|
11 | class IDataProvider; | |
12 | class QItemSelectionModel; |
|
12 | class QItemSelectionModel; | |
13 | class TimeController; |
|
13 | class TimeController; | |
14 | class Variable; |
|
14 | class Variable; | |
15 | class VariableModel; |
|
15 | class VariableModel; | |
16 |
|
16 | |||
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) |
|
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) | |
18 |
|
18 | |||
19 | /** |
|
19 | /** | |
20 | * @brief The VariableController class aims to handle the variables in SciQlop. |
|
20 | * @brief The VariableController class aims to handle the variables in SciQlop. | |
21 | */ |
|
21 | */ | |
22 | class VariableController : public QObject { |
|
22 | class VariableController : public QObject { | |
23 | Q_OBJECT |
|
23 | Q_OBJECT | |
24 | public: |
|
24 | public: | |
25 | explicit VariableController(QObject *parent = 0); |
|
25 | explicit VariableController(QObject *parent = 0); | |
26 | virtual ~VariableController(); |
|
26 | virtual ~VariableController(); | |
27 |
|
27 | |||
28 | VariableModel *variableModel() noexcept; |
|
28 | VariableModel *variableModel() noexcept; | |
29 | QItemSelectionModel *variableSelectionModel() noexcept; |
|
29 | QItemSelectionModel *variableSelectionModel() noexcept; | |
30 |
|
30 | |||
31 | void setTimeController(TimeController *timeController) noexcept; |
|
31 | void setTimeController(TimeController *timeController) noexcept; | |
32 |
|
32 | |||
33 | /** |
|
33 | /** | |
34 | * Deletes from the controller the variable passed in parameter. |
|
34 | * Deletes from the controller the variable passed in parameter. | |
35 | * |
|
35 | * | |
36 | * Delete a variable includes: |
|
36 | * Delete a variable includes: | |
37 | * - the deletion of the various references to the variable in SciQlop |
|
37 | * - the deletion of the various references to the variable in SciQlop | |
38 | * - the deletion of the model variable |
|
38 | * - the deletion of the model variable | |
39 | * - the deletion of the provider associated with the variable |
|
39 | * - the deletion of the provider associated with the variable | |
40 | * - removing the cache associated with the variable |
|
40 | * - removing the cache associated with the variable | |
41 | * |
|
41 | * | |
42 | * @param variable the variable to delete from the controller. |
|
42 | * @param variable the variable to delete from the controller. | |
43 | */ |
|
43 | */ | |
44 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; |
|
44 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | |
45 |
|
45 | |||
46 | /** |
|
46 | /** | |
47 | * Deletes from the controller the variables passed in parameter. |
|
47 | * Deletes from the controller the variables passed in parameter. | |
48 | * @param variables the variables to delete from the controller. |
|
48 | * @param variables the variables to delete from the controller. | |
49 | * @sa deleteVariable() |
|
49 | * @sa deleteVariable() | |
50 | */ |
|
50 | */ | |
51 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; |
|
51 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; | |
52 |
|
52 | |||
53 | /** |
|
53 | /** | |
54 | * @brief abort the variable retrieve data progression |
|
54 | * @brief abort the variable retrieve data progression | |
55 | */ |
|
55 | */ | |
56 | void abortProgress(std::shared_ptr<Variable> variable); |
|
56 | void abortProgress(std::shared_ptr<Variable> variable); | |
57 |
|
57 | |||
58 | signals: |
|
58 | signals: | |
59 | /// Signal emitted when a variable is about to be deleted from the controller |
|
59 | /// Signal emitted when a variable is about to be deleted from the controller | |
60 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); |
|
60 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |
61 |
|
61 | |||
|
62 | /// Signal emitted when a data acquisition is requested on a range for a variable | |||
|
63 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
|
64 | ||||
62 | public slots: |
|
65 | public slots: | |
63 | /// Request the data loading of the variable whithin dateTime |
|
66 | /// Request the data loading of the variable whithin dateTime | |
64 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
67 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
65 | /** |
|
68 | /** | |
66 | * Creates a new variable and adds it to the model |
|
69 | * Creates a new variable and adds it to the model | |
67 | * @param name the name of the new variable |
|
70 | * @param name the name of the new variable | |
68 | * @param metadata the metadata of the new variable |
|
71 | * @param metadata the metadata of the new variable | |
69 | * @param provider the data provider for the new variable |
|
72 | * @param provider the data provider for the new variable | |
70 | */ |
|
73 | */ | |
71 | void createVariable(const QString &name, const QVariantHash &metadata, |
|
74 | void createVariable(const QString &name, const QVariantHash &metadata, | |
72 | std::shared_ptr<IDataProvider> provider) noexcept; |
|
75 | std::shared_ptr<IDataProvider> provider) noexcept; | |
73 |
|
76 | |||
74 | /// Update the temporal parameters of every selected variable to dateTime |
|
77 | /// Update the temporal parameters of every selected variable to dateTime | |
75 | void onDateTimeOnSelection(const SqpDateTime &dateTime); |
|
78 | void onDateTimeOnSelection(const SqpDateTime &dateTime); | |
76 |
|
79 | |||
77 |
|
80 | |||
78 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); |
|
81 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); | |
79 |
|
82 | |||
80 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); |
|
83 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); | |
81 |
|
84 | |||
82 | void initialize(); |
|
85 | void initialize(); | |
83 | void finalize(); |
|
86 | void finalize(); | |
84 |
|
87 | |||
85 | private: |
|
88 | private: | |
86 | void waitForFinish(); |
|
89 | void waitForFinish(); | |
87 |
|
90 | |||
88 | class VariableControllerPrivate; |
|
91 | class VariableControllerPrivate; | |
89 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; |
|
92 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; | |
90 | }; |
|
93 | }; | |
91 |
|
94 | |||
92 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
|
95 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
@@ -1,44 +1,49 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONCONTROLLER_H | |
2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
2 | #define SCIQLOP_VISUALIZATIONCONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include <Data/SqpDateTime.h> | |||
|
5 | ||||
4 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
5 | #include <QObject> |
|
7 | #include <QObject> | |
6 | #include <QUuid> |
|
8 | #include <QUuid> | |
7 |
|
9 | |||
8 | #include <Common/spimpl.h> |
|
10 | #include <Common/spimpl.h> | |
9 |
|
11 | |||
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationController) |
|
12 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationController) | |
11 |
|
13 | |||
12 | class DataSourceItem; |
|
14 | class DataSourceItem; | |
13 | class Variable; |
|
15 | class Variable; | |
14 |
|
16 | |||
15 | /** |
|
17 | /** | |
16 | * @brief The VisualizationController class aims to make the link between SciQlop and its plugins. |
|
18 | * @brief The VisualizationController class aims to make the link between SciQlop and its plugins. | |
17 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. |
|
19 | * This is the intermediate class that SciQlop has to use in the way to connect a data source. | |
18 | * Please first use register method to initialize a plugin specified by its metadata name (JSON |
|
20 | * Please first use register method to initialize a plugin specified by its metadata name (JSON | |
19 | * plugin source) then others specifics method will be able to access it. You can load a data source |
|
21 | * plugin source) then others specifics method will be able to access it. You can load a data source | |
20 | * driver plugin then create a data source. |
|
22 | * driver plugin then create a data source. | |
21 | */ |
|
23 | */ | |
22 | class VisualizationController : public QObject { |
|
24 | class VisualizationController : public QObject { | |
23 | Q_OBJECT |
|
25 | Q_OBJECT | |
24 | public: |
|
26 | public: | |
25 | explicit VisualizationController(QObject *parent = 0); |
|
27 | explicit VisualizationController(QObject *parent = 0); | |
26 | virtual ~VisualizationController(); |
|
28 | virtual ~VisualizationController(); | |
27 |
|
29 | |||
28 | signals: |
|
30 | signals: | |
29 | /// Signal emitted when a variable is about to be deleted from SciQlop |
|
31 | /// Signal emitted when a variable is about to be deleted from SciQlop | |
30 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); |
|
32 | void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | |
31 |
|
33 | |||
|
34 | /// Signal emitted when a data acquisition is requested on a range for a variable | |||
|
35 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
|
36 | ||||
32 | public slots: |
|
37 | public slots: | |
33 | /// Manage init/end of the controller |
|
38 | /// Manage init/end of the controller | |
34 | void initialize(); |
|
39 | void initialize(); | |
35 | void finalize(); |
|
40 | void finalize(); | |
36 |
|
41 | |||
37 | private: |
|
42 | private: | |
38 | void waitForFinish(); |
|
43 | void waitForFinish(); | |
39 |
|
44 | |||
40 | class VisualizationControllerPrivate; |
|
45 | class VisualizationControllerPrivate; | |
41 | spimpl::unique_impl_ptr<VisualizationControllerPrivate> impl; |
|
46 | spimpl::unique_impl_ptr<VisualizationControllerPrivate> impl; | |
42 | }; |
|
47 | }; | |
43 |
|
48 | |||
44 | #endif // SCIQLOP_VISUALIZATIONCONTROLLER_H |
|
49 | #endif // SCIQLOP_VISUALIZATIONCONTROLLER_H |
@@ -1,90 +1,90 | |||||
1 | #include "Variable/Variable.h" |
|
1 | #include "Variable/Variable.h" | |
2 |
|
2 | |||
3 | #include <Data/IDataSeries.h> |
|
3 | #include <Data/IDataSeries.h> | |
4 | #include <Data/SqpDateTime.h> |
|
4 | #include <Data/SqpDateTime.h> | |
5 |
|
5 | |||
6 | #include <QReadWriteLock> |
|
6 | #include <QReadWriteLock> | |
7 | #include <QThread> |
|
7 | #include <QThread> | |
8 |
|
8 | |||
9 | Q_LOGGING_CATEGORY(LOG_Variable, "Variable") |
|
9 | Q_LOGGING_CATEGORY(LOG_Variable, "Variable") | |
10 |
|
10 | |||
11 | struct Variable::VariablePrivate { |
|
11 | struct Variable::VariablePrivate { | |
12 | explicit VariablePrivate(const QString &name, const SqpDateTime &dateTime, |
|
12 | explicit VariablePrivate(const QString &name, const SqpDateTime &dateTime, | |
13 | const QVariantHash &metadata) |
|
13 | const QVariantHash &metadata) | |
14 | : m_Name{name}, m_DateTime{dateTime}, m_Metadata{metadata}, m_DataSeries{nullptr} |
|
14 | : m_Name{name}, m_DateTime{dateTime}, m_Metadata{metadata}, m_DataSeries{nullptr} | |
15 | { |
|
15 | { | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 | QString m_Name; |
|
18 | QString m_Name; | |
19 |
|
19 | |||
20 | SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache. |
|
20 | SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache. | |
21 | QVariantHash m_Metadata; |
|
21 | QVariantHash m_Metadata; | |
22 | std::unique_ptr<IDataSeries> m_DataSeries; |
|
22 | std::unique_ptr<IDataSeries> m_DataSeries; | |
23 | }; |
|
23 | }; | |
24 |
|
24 | |||
25 | Variable::Variable(const QString &name, const SqpDateTime &dateTime, const QVariantHash &metadata) |
|
25 | Variable::Variable(const QString &name, const SqpDateTime &dateTime, const QVariantHash &metadata) | |
26 | : impl{spimpl::make_unique_impl<VariablePrivate>(name, dateTime, metadata)} |
|
26 | : impl{spimpl::make_unique_impl<VariablePrivate>(name, dateTime, metadata)} | |
27 | { |
|
27 | { | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | QString Variable::name() const noexcept |
|
30 | QString Variable::name() const noexcept | |
31 | { |
|
31 | { | |
32 | return impl->m_Name; |
|
32 | return impl->m_Name; | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | SqpDateTime Variable::dateTime() const noexcept |
|
35 | SqpDateTime Variable::dateTime() const noexcept | |
36 | { |
|
36 | { | |
37 | return impl->m_DateTime; |
|
37 | return impl->m_DateTime; | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | void Variable::setDateTime(const SqpDateTime &dateTime) noexcept |
|
40 | void Variable::setDateTime(const SqpDateTime &dateTime) noexcept | |
41 | { |
|
41 | { | |
42 | impl->m_DateTime = dateTime; |
|
42 | impl->m_DateTime = dateTime; | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept |
|
45 | void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept | |
46 | { |
|
46 | { | |
47 | qCDebug(LOG_Variable()) << "Variable::setDataSeries" << QThread::currentThread()->objectName(); |
|
47 | qCDebug(LOG_Variable()) << "Variable::setDataSeries" << QThread::currentThread()->objectName(); | |
48 | if (!dataSeries) { |
|
48 | if (!dataSeries) { | |
49 | /// @todo ALX : log |
|
49 | /// @todo ALX : log | |
50 | return; |
|
50 | return; | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | // Inits the data series of the variable |
|
53 | // Inits the data series of the variable | |
54 | if (!impl->m_DataSeries) { |
|
54 | if (!impl->m_DataSeries) { | |
55 | impl->m_DataSeries = dataSeries->clone(); |
|
55 | impl->m_DataSeries = dataSeries->clone(); | |
56 | } |
|
56 | } | |
57 | else { |
|
57 | else { | |
58 | dataSeries->lockWrite(); |
|
58 | dataSeries->lockWrite(); | |
59 | impl->m_DataSeries->lockWrite(); |
|
59 | impl->m_DataSeries->lockWrite(); | |
60 | impl->m_DataSeries->merge(dataSeries.get()); |
|
60 | impl->m_DataSeries->merge(dataSeries.get()); | |
61 | impl->m_DataSeries->unlock(); |
|
61 | impl->m_DataSeries->unlock(); | |
62 | dataSeries->unlock(); |
|
62 | dataSeries->unlock(); | |
63 | emit updated(); |
|
63 | // emit updated(); | |
64 | } |
|
64 | } | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | IDataSeries *Variable::dataSeries() const noexcept |
|
67 | IDataSeries *Variable::dataSeries() const noexcept | |
68 | { |
|
68 | { | |
69 | return impl->m_DataSeries.get(); |
|
69 | return impl->m_DataSeries.get(); | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | QVariantHash Variable::metadata() const noexcept |
|
72 | QVariantHash Variable::metadata() const noexcept | |
73 | { |
|
73 | { | |
74 | return impl->m_Metadata; |
|
74 | return impl->m_Metadata; | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | bool Variable::contains(const SqpDateTime &dateTime) const noexcept |
|
77 | bool Variable::contains(const SqpDateTime &dateTime) const noexcept | |
78 | { |
|
78 | { | |
79 | return impl->m_DateTime.contains(dateTime); |
|
79 | return impl->m_DateTime.contains(dateTime); | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | bool Variable::intersect(const SqpDateTime &dateTime) const noexcept |
|
82 | bool Variable::intersect(const SqpDateTime &dateTime) const noexcept | |
83 | { |
|
83 | { | |
84 | return impl->m_DateTime.intersect(dateTime); |
|
84 | return impl->m_DateTime.intersect(dateTime); | |
85 | } |
|
85 | } | |
86 |
|
86 | |||
87 | bool Variable::isInside(const SqpDateTime &dateTime) const noexcept |
|
87 | bool Variable::isInside(const SqpDateTime &dateTime) const noexcept | |
88 | { |
|
88 | { | |
89 | return dateTime.contains(SqpDateTime{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd}); |
|
89 | return dateTime.contains(SqpDateTime{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd}); | |
90 | } |
|
90 | } |
@@ -1,240 +1,242 | |||||
1 | #include <Variable/Variable.h> |
|
1 | #include <Variable/Variable.h> | |
2 | #include <Variable/VariableCacheController.h> |
|
2 | #include <Variable/VariableCacheController.h> | |
3 | #include <Variable/VariableController.h> |
|
3 | #include <Variable/VariableController.h> | |
4 | #include <Variable/VariableModel.h> |
|
4 | #include <Variable/VariableModel.h> | |
5 |
|
5 | |||
6 | #include <Data/DataProviderParameters.h> |
|
6 | #include <Data/DataProviderParameters.h> | |
7 | #include <Data/IDataProvider.h> |
|
7 | #include <Data/IDataProvider.h> | |
8 | #include <Data/IDataSeries.h> |
|
8 | #include <Data/IDataSeries.h> | |
9 | #include <Time/TimeController.h> |
|
9 | #include <Time/TimeController.h> | |
10 |
|
10 | |||
11 | #include <QDateTime> |
|
11 | #include <QDateTime> | |
12 | #include <QMutex> |
|
12 | #include <QMutex> | |
13 | #include <QThread> |
|
13 | #include <QThread> | |
14 | #include <QUuid> |
|
14 | #include <QUuid> | |
15 | #include <QtCore/QItemSelectionModel> |
|
15 | #include <QtCore/QItemSelectionModel> | |
16 |
|
16 | |||
17 | #include <unordered_map> |
|
17 | #include <unordered_map> | |
18 |
|
18 | |||
19 | Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") |
|
19 | Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") | |
20 |
|
20 | |||
21 | struct VariableController::VariableControllerPrivate { |
|
21 | struct VariableController::VariableControllerPrivate { | |
22 | explicit VariableControllerPrivate(VariableController *parent) |
|
22 | explicit VariableControllerPrivate(VariableController *parent) | |
23 | : m_WorkingMutex{}, |
|
23 | : m_WorkingMutex{}, | |
24 | m_VariableModel{new VariableModel{parent}}, |
|
24 | m_VariableModel{new VariableModel{parent}}, | |
25 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, |
|
25 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, | |
26 | m_VariableCacheController{std::make_unique<VariableCacheController>()} |
|
26 | m_VariableCacheController{std::make_unique<VariableCacheController>()} | |
27 | { |
|
27 | { | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | QMutex m_WorkingMutex; |
|
30 | QMutex m_WorkingMutex; | |
31 | /// Variable model. The VariableController has the ownership |
|
31 | /// Variable model. The VariableController has the ownership | |
32 | VariableModel *m_VariableModel; |
|
32 | VariableModel *m_VariableModel; | |
33 | QItemSelectionModel *m_VariableSelectionModel; |
|
33 | QItemSelectionModel *m_VariableSelectionModel; | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | TimeController *m_TimeController{nullptr}; |
|
36 | TimeController *m_TimeController{nullptr}; | |
37 | std::unique_ptr<VariableCacheController> m_VariableCacheController; |
|
37 | std::unique_ptr<VariableCacheController> m_VariableCacheController; | |
38 |
|
38 | |||
39 | std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> > |
|
39 | std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> > | |
40 | m_VariableToProviderMap; |
|
40 | m_VariableToProviderMap; | |
41 | std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap; |
|
41 | std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap; | |
42 | }; |
|
42 | }; | |
43 |
|
43 | |||
44 | VariableController::VariableController(QObject *parent) |
|
44 | VariableController::VariableController(QObject *parent) | |
45 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} |
|
45 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} | |
46 | { |
|
46 | { | |
47 | qCDebug(LOG_VariableController()) << tr("VariableController construction") |
|
47 | qCDebug(LOG_VariableController()) << tr("VariableController construction") | |
48 | << QThread::currentThread(); |
|
48 | << QThread::currentThread(); | |
49 |
|
49 | |||
50 | connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this, |
|
50 | connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this, | |
51 | &VariableController::onAbortProgressRequested); |
|
51 | &VariableController::onAbortProgressRequested); | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | VariableController::~VariableController() |
|
54 | VariableController::~VariableController() | |
55 | { |
|
55 | { | |
56 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") |
|
56 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") | |
57 | << QThread::currentThread(); |
|
57 | << QThread::currentThread(); | |
58 | this->waitForFinish(); |
|
58 | this->waitForFinish(); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | VariableModel *VariableController::variableModel() noexcept |
|
61 | VariableModel *VariableController::variableModel() noexcept | |
62 | { |
|
62 | { | |
63 | return impl->m_VariableModel; |
|
63 | return impl->m_VariableModel; | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept |
|
66 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept | |
67 | { |
|
67 | { | |
68 | return impl->m_VariableSelectionModel; |
|
68 | return impl->m_VariableSelectionModel; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | void VariableController::setTimeController(TimeController *timeController) noexcept |
|
71 | void VariableController::setTimeController(TimeController *timeController) noexcept | |
72 | { |
|
72 | { | |
73 | impl->m_TimeController = timeController; |
|
73 | impl->m_TimeController = timeController; | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept |
|
76 | void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept | |
77 | { |
|
77 | { | |
78 | if (!variable) { |
|
78 | if (!variable) { | |
79 | qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; |
|
79 | qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; | |
80 | return; |
|
80 | return; | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | // Spreads in SciQlop that the variable will be deleted, so that potential receivers can |
|
83 | // Spreads in SciQlop that the variable will be deleted, so that potential receivers can | |
84 | // make some treatments before the deletion |
|
84 | // make some treatments before the deletion | |
85 | emit variableAboutToBeDeleted(variable); |
|
85 | emit variableAboutToBeDeleted(variable); | |
86 |
|
86 | |||
87 | // Deletes identifier |
|
87 | // Deletes identifier | |
88 | impl->m_VariableToIdentifierMap.erase(variable); |
|
88 | impl->m_VariableToIdentifierMap.erase(variable); | |
89 |
|
89 | |||
90 | // Deletes provider |
|
90 | // Deletes provider | |
91 | auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable); |
|
91 | auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable); | |
92 | qCDebug(LOG_VariableController()) |
|
92 | qCDebug(LOG_VariableController()) | |
93 | << tr("Number of providers deleted for variable %1: %2") |
|
93 | << tr("Number of providers deleted for variable %1: %2") | |
94 | .arg(variable->name(), QString::number(nbProvidersDeleted)); |
|
94 | .arg(variable->name(), QString::number(nbProvidersDeleted)); | |
95 |
|
95 | |||
96 | // Clears cache |
|
96 | // Clears cache | |
97 | impl->m_VariableCacheController->clear(variable); |
|
97 | impl->m_VariableCacheController->clear(variable); | |
98 |
|
98 | |||
99 | // Deletes from model |
|
99 | // Deletes from model | |
100 | impl->m_VariableModel->deleteVariable(variable); |
|
100 | impl->m_VariableModel->deleteVariable(variable); | |
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | void VariableController::deleteVariables( |
|
103 | void VariableController::deleteVariables( | |
104 | const QVector<std::shared_ptr<Variable> > &variables) noexcept |
|
104 | const QVector<std::shared_ptr<Variable> > &variables) noexcept | |
105 | { |
|
105 | { | |
106 | for (auto variable : qAsConst(variables)) { |
|
106 | for (auto variable : qAsConst(variables)) { | |
107 | deleteVariable(variable); |
|
107 | deleteVariable(variable); | |
108 | } |
|
108 | } | |
109 | } |
|
109 | } | |
110 |
|
110 | |||
111 | void VariableController::abortProgress(std::shared_ptr<Variable> variable) |
|
111 | void VariableController::abortProgress(std::shared_ptr<Variable> variable) | |
112 | { |
|
112 | { | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | void VariableController::createVariable(const QString &name, const QVariantHash &metadata, |
|
115 | void VariableController::createVariable(const QString &name, const QVariantHash &metadata, | |
116 | std::shared_ptr<IDataProvider> provider) noexcept |
|
116 | std::shared_ptr<IDataProvider> provider) noexcept | |
117 | { |
|
117 | { | |
118 |
|
118 | |||
119 | if (!impl->m_TimeController) { |
|
119 | if (!impl->m_TimeController) { | |
120 | qCCritical(LOG_VariableController()) |
|
120 | qCCritical(LOG_VariableController()) | |
121 | << tr("Impossible to create variable: The time controller is null"); |
|
121 | << tr("Impossible to create variable: The time controller is null"); | |
122 | return; |
|
122 | return; | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 | auto dateTime = impl->m_TimeController->dateTime(); |
|
125 | auto dateTime = impl->m_TimeController->dateTime(); | |
126 |
|
126 | |||
127 | if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime, metadata)) { |
|
127 | if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime, metadata)) { | |
128 | auto identifier = QUuid::createUuid(); |
|
128 | auto identifier = QUuid::createUuid(); | |
129 |
|
129 | |||
130 | // store the provider |
|
130 | // store the provider | |
131 | impl->m_VariableToProviderMap[newVariable] = provider; |
|
131 | impl->m_VariableToProviderMap[newVariable] = provider; | |
132 | impl->m_VariableToIdentifierMap[newVariable] = identifier; |
|
132 | impl->m_VariableToIdentifierMap[newVariable] = identifier; | |
133 |
|
133 | |||
134 | auto addDateTimeAcquired = [ this, varW = std::weak_ptr<Variable>{newVariable} ]( |
|
134 | auto addDateTimeAcquired = [ this, varW = std::weak_ptr<Variable>{newVariable} ]( | |
135 | QUuid identifier, auto dataSeriesAcquired, auto dateTimeToPutInCache) |
|
135 | QUuid identifier, auto dataSeriesAcquired, auto dateTimeToPutInCache) | |
136 | { |
|
136 | { | |
137 | if (auto variable = varW.lock()) { |
|
137 | if (auto variable = varW.lock()) { | |
138 | auto varIdentifier = impl->m_VariableToIdentifierMap.at(variable); |
|
138 | auto varIdentifier = impl->m_VariableToIdentifierMap.at(variable); | |
139 | if (varIdentifier == identifier) { |
|
139 | if (varIdentifier == identifier) { | |
140 | impl->m_VariableCacheController->addDateTime(variable, dateTimeToPutInCache); |
|
140 | impl->m_VariableCacheController->addDateTime(variable, dateTimeToPutInCache); | |
141 | variable->setDataSeries(dataSeriesAcquired); |
|
141 | variable->setDataSeries(dataSeriesAcquired); | |
|
142 | emit variable->updated(); | |||
142 | } |
|
143 | } | |
143 | } |
|
144 | } | |
144 | }; |
|
145 | }; | |
145 |
|
146 | |||
146 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); |
|
147 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); | |
147 | connect(provider.get(), &IDataProvider::dataProvidedProgress, this, |
|
148 | connect(provider.get(), &IDataProvider::dataProvidedProgress, this, | |
148 | &VariableController::onVariableRetrieveDataInProgress); |
|
149 | &VariableController::onVariableRetrieveDataInProgress); | |
149 | this->onRequestDataLoading(newVariable, dateTime); |
|
150 | this->onRequestDataLoading(newVariable, dateTime); | |
150 | } |
|
151 | } | |
151 | } |
|
152 | } | |
152 |
|
153 | |||
153 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) |
|
154 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) | |
154 | { |
|
155 | { | |
155 | qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection" |
|
156 | qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection" | |
156 | << QThread::currentThread()->objectName(); |
|
157 | << QThread::currentThread()->objectName(); | |
157 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); |
|
158 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); | |
158 |
|
159 | |||
159 | for (const auto &selectedRow : qAsConst(selectedRows)) { |
|
160 | for (const auto &selectedRow : qAsConst(selectedRows)) { | |
160 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { |
|
161 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { | |
161 | selectedVariable->setDateTime(dateTime); |
|
162 | selectedVariable->setDateTime(dateTime); | |
162 | this->onRequestDataLoading(selectedVariable, dateTime); |
|
163 | this->onRequestDataLoading(selectedVariable, dateTime); | |
|
164 | emit rangeChanged(selectedVariable, dateTime); | |||
163 | } |
|
165 | } | |
164 | } |
|
166 | } | |
165 | } |
|
167 | } | |
166 |
|
168 | |||
167 | void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress) |
|
169 | void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress) | |
168 | { |
|
170 | { | |
169 | auto findReply = [identifier](const auto &entry) { return identifier == entry.second; }; |
|
171 | auto findReply = [identifier](const auto &entry) { return identifier == entry.second; }; | |
170 |
|
172 | |||
171 | auto end = impl->m_VariableToIdentifierMap.cend(); |
|
173 | auto end = impl->m_VariableToIdentifierMap.cend(); | |
172 | auto it = std::find_if(impl->m_VariableToIdentifierMap.cbegin(), end, findReply); |
|
174 | auto it = std::find_if(impl->m_VariableToIdentifierMap.cbegin(), end, findReply); | |
173 | if (it != end) { |
|
175 | if (it != end) { | |
174 | impl->m_VariableModel->setDataProgress(it->first, progress); |
|
176 | impl->m_VariableModel->setDataProgress(it->first, progress); | |
175 | } |
|
177 | } | |
176 | } |
|
178 | } | |
177 |
|
179 | |||
178 | void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable) |
|
180 | void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable) | |
179 | { |
|
181 | { | |
180 | qCDebug(LOG_VariableController()) << "TORM: VariableController::onAbortProgressRequested" |
|
182 | qCDebug(LOG_VariableController()) << "TORM: VariableController::onAbortProgressRequested" | |
181 | << QThread::currentThread()->objectName(); |
|
183 | << QThread::currentThread()->objectName(); | |
182 |
|
184 | |||
183 | auto it = impl->m_VariableToIdentifierMap.find(variable); |
|
185 | auto it = impl->m_VariableToIdentifierMap.find(variable); | |
184 | if (it != impl->m_VariableToIdentifierMap.cend()) { |
|
186 | if (it != impl->m_VariableToIdentifierMap.cend()) { | |
185 | impl->m_VariableToProviderMap.at(variable)->requestDataAborting(it->second); |
|
187 | impl->m_VariableToProviderMap.at(variable)->requestDataAborting(it->second); | |
186 | } |
|
188 | } | |
187 | else { |
|
189 | else { | |
188 | qCWarning(LOG_VariableController()) |
|
190 | qCWarning(LOG_VariableController()) | |
189 | << tr("Aborting progression of inexistant variable detected !!!") |
|
191 | << tr("Aborting progression of inexistant variable detected !!!") | |
190 | << QThread::currentThread()->objectName(); |
|
192 | << QThread::currentThread()->objectName(); | |
191 | } |
|
193 | } | |
192 | } |
|
194 | } | |
193 |
|
195 | |||
194 |
|
196 | |||
195 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, |
|
197 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, | |
196 | const SqpDateTime &dateTime) |
|
198 | const SqpDateTime &dateTime) | |
197 | { |
|
199 | { | |
198 | qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading" |
|
200 | qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading" | |
199 | << QThread::currentThread()->objectName(); |
|
201 | << QThread::currentThread()->objectName(); | |
200 | // we want to load data of the variable for the dateTime. |
|
202 | // we want to load data of the variable for the dateTime. | |
201 | // First we check if the cache contains some of them. |
|
203 | // First we check if the cache contains some of them. | |
202 | // For the other, we ask the provider to give them. |
|
204 | // For the other, we ask the provider to give them. | |
203 | if (variable) { |
|
205 | if (variable) { | |
204 |
|
206 | |||
205 | auto dateTimeListNotInCache |
|
207 | auto dateTimeListNotInCache | |
206 | = impl->m_VariableCacheController->provideNotInCacheDateTimeList(variable, dateTime); |
|
208 | = impl->m_VariableCacheController->provideNotInCacheDateTimeList(variable, dateTime); | |
207 |
|
209 | |||
208 | if (!dateTimeListNotInCache.empty()) { |
|
210 | if (!dateTimeListNotInCache.empty()) { | |
209 | // Ask the provider for each data on the dateTimeListNotInCache |
|
211 | // Ask the provider for each data on the dateTimeListNotInCache | |
210 | auto identifier = impl->m_VariableToIdentifierMap.at(variable); |
|
212 | auto identifier = impl->m_VariableToIdentifierMap.at(variable); | |
211 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( |
|
213 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( | |
212 | identifier, |
|
214 | identifier, | |
213 | DataProviderParameters{std::move(dateTimeListNotInCache), variable->metadata()}); |
|
215 | DataProviderParameters{std::move(dateTimeListNotInCache), variable->metadata()}); | |
214 | } |
|
216 | } | |
215 | else { |
|
217 | else { | |
216 | emit variable->updated(); |
|
218 | emit variable->updated(); | |
217 | } |
|
219 | } | |
218 | } |
|
220 | } | |
219 | else { |
|
221 | else { | |
220 | qCCritical(LOG_VariableController()) << tr("Impossible to load data of a variable null"); |
|
222 | qCCritical(LOG_VariableController()) << tr("Impossible to load data of a variable null"); | |
221 | } |
|
223 | } | |
222 | } |
|
224 | } | |
223 |
|
225 | |||
224 |
|
226 | |||
225 | void VariableController::initialize() |
|
227 | void VariableController::initialize() | |
226 | { |
|
228 | { | |
227 | qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread(); |
|
229 | qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread(); | |
228 | impl->m_WorkingMutex.lock(); |
|
230 | impl->m_WorkingMutex.lock(); | |
229 | qCDebug(LOG_VariableController()) << tr("VariableController init END"); |
|
231 | qCDebug(LOG_VariableController()) << tr("VariableController init END"); | |
230 | } |
|
232 | } | |
231 |
|
233 | |||
232 | void VariableController::finalize() |
|
234 | void VariableController::finalize() | |
233 | { |
|
235 | { | |
234 | impl->m_WorkingMutex.unlock(); |
|
236 | impl->m_WorkingMutex.unlock(); | |
235 | } |
|
237 | } | |
236 |
|
238 | |||
237 | void VariableController::waitForFinish() |
|
239 | void VariableController::waitForFinish() | |
238 | { |
|
240 | { | |
239 | QMutexLocker locker{&impl->m_WorkingMutex}; |
|
241 | QMutexLocker locker{&impl->m_WorkingMutex}; | |
240 | } |
|
242 | } |
@@ -1,65 +1,66 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | |
2 | #define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
|
2 | #define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | |
3 |
|
3 | |||
4 | #include "Visualization/IVisualizationWidget.h" |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
5 |
|
5 | |||
6 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
7 | #include <QWidget> |
|
7 | #include <QWidget> | |
8 |
|
8 | |||
9 | #include <memory> |
|
9 | #include <memory> | |
10 |
|
10 | |||
11 | #include <Common/spimpl.h> |
|
11 | #include <Common/spimpl.h> | |
12 |
|
12 | |||
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) |
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) | |
14 |
|
14 | |||
15 | class QCPRange; |
|
15 | class QCPRange; | |
16 | class SqpDateTime; |
|
16 | class SqpDateTime; | |
17 | class Variable; |
|
17 | class Variable; | |
18 |
|
18 | |||
19 | namespace Ui { |
|
19 | namespace Ui { | |
20 | class VisualizationGraphWidget; |
|
20 | class VisualizationGraphWidget; | |
21 | } // namespace Ui |
|
21 | } // namespace Ui | |
22 |
|
22 | |||
23 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { |
|
23 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { | |
24 | Q_OBJECT |
|
24 | Q_OBJECT | |
25 |
|
25 | |||
26 | public: |
|
26 | public: | |
27 | explicit VisualizationGraphWidget(const QString &name = {}, QWidget *parent = 0); |
|
27 | explicit VisualizationGraphWidget(const QString &name = {}, QWidget *parent = 0); | |
28 | virtual ~VisualizationGraphWidget(); |
|
28 | virtual ~VisualizationGraphWidget(); | |
29 |
|
29 | |||
30 | void addVariable(std::shared_ptr<Variable> variable); |
|
30 | void addVariable(std::shared_ptr<Variable> variable); | |
31 | void addVariableUsingGraph(std::shared_ptr<Variable> variable); |
|
31 | void addVariableUsingGraph(std::shared_ptr<Variable> variable); | |
32 | /// Removes a variable from the graph |
|
32 | /// Removes a variable from the graph | |
33 | void removeVariable(std::shared_ptr<Variable> variable) noexcept; |
|
33 | void removeVariable(std::shared_ptr<Variable> variable) noexcept; | |
34 |
|
34 | |||
|
35 | /// Rescale the X axe to range parameter | |||
|
36 | void setRange(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
|
37 | ||||
35 | // IVisualizationWidget interface |
|
38 | // IVisualizationWidget interface | |
36 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
39 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
37 | bool canDrop(const Variable &variable) const override; |
|
40 | bool canDrop(const Variable &variable) const override; | |
38 | bool contains(const Variable &variable) const override; |
|
41 | bool contains(const Variable &variable) const override; | |
39 | QString name() const override; |
|
42 | QString name() const override; | |
40 |
|
43 | |||
41 | void updateDisplay(std::shared_ptr<Variable> variable); |
|
|||
42 |
|
||||
43 | signals: |
|
44 | signals: | |
44 | void requestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
45 | void requestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
45 |
|
46 | |||
46 |
|
47 | |||
47 | private: |
|
48 | private: | |
48 | Ui::VisualizationGraphWidget *ui; |
|
49 | Ui::VisualizationGraphWidget *ui; | |
49 |
|
50 | |||
50 | class VisualizationGraphWidgetPrivate; |
|
51 | class VisualizationGraphWidgetPrivate; | |
51 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; |
|
52 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; | |
52 |
|
53 | |||
53 | private slots: |
|
54 | private slots: | |
54 | /// Slot called when right clicking on the graph (displays a menu) |
|
55 | /// Slot called when right clicking on the graph (displays a menu) | |
55 | void onGraphMenuRequested(const QPoint &pos) noexcept; |
|
56 | void onGraphMenuRequested(const QPoint &pos) noexcept; | |
56 |
|
57 | |||
57 | void onRangeChanged(const QCPRange &t1); |
|
58 | void onRangeChanged(const QCPRange &t1); | |
58 |
|
59 | |||
59 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done |
|
60 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done | |
60 | void onMouseWheel(QWheelEvent *event) noexcept; |
|
61 | void onMouseWheel(QWheelEvent *event) noexcept; | |
61 |
|
62 | |||
62 | void onDataCacheVariableUpdated(); |
|
63 | void onDataCacheVariableUpdated(); | |
63 | }; |
|
64 | }; | |
64 |
|
65 | |||
65 | #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
|
66 | #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H |
@@ -1,48 +1,51 | |||||
1 | #ifndef SCIQLOP_VISUALIZATIONWIDGET_H |
|
1 | #ifndef SCIQLOP_VISUALIZATIONWIDGET_H | |
2 | #define SCIQLOP_VISUALIZATIONWIDGET_H |
|
2 | #define SCIQLOP_VISUALIZATIONWIDGET_H | |
3 |
|
3 | |||
4 | #include "Visualization/IVisualizationWidget.h" |
|
4 | #include "Visualization/IVisualizationWidget.h" | |
|
5 | #include <Data/SqpDateTime.h> | |||
5 |
|
6 | |||
6 | #include <QLoggingCategory> |
|
7 | #include <QLoggingCategory> | |
7 | #include <QWidget> |
|
8 | #include <QWidget> | |
8 |
|
9 | |||
9 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) |
|
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget) | |
10 |
|
11 | |||
11 | class QMenu; |
|
12 | class QMenu; | |
12 | class Variable; |
|
13 | class Variable; | |
13 | class VisualizationTabWidget; |
|
14 | class VisualizationTabWidget; | |
14 |
|
15 | |||
15 | namespace Ui { |
|
16 | namespace Ui { | |
16 | class VisualizationWidget; |
|
17 | class VisualizationWidget; | |
17 | } // namespace Ui |
|
18 | } // namespace Ui | |
18 |
|
19 | |||
19 | class VisualizationWidget : public QWidget, public IVisualizationWidget { |
|
20 | class VisualizationWidget : public QWidget, public IVisualizationWidget { | |
20 | Q_OBJECT |
|
21 | Q_OBJECT | |
21 |
|
22 | |||
22 | public: |
|
23 | public: | |
23 | explicit VisualizationWidget(QWidget *parent = 0); |
|
24 | explicit VisualizationWidget(QWidget *parent = 0); | |
24 | virtual ~VisualizationWidget(); |
|
25 | virtual ~VisualizationWidget(); | |
25 |
|
26 | |||
26 | // IVisualizationWidget interface |
|
27 | // IVisualizationWidget interface | |
27 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
28 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
28 | bool canDrop(const Variable &variable) const override; |
|
29 | bool canDrop(const Variable &variable) const override; | |
29 | bool contains(const Variable &variable) const override; |
|
30 | bool contains(const Variable &variable) const override; | |
30 | QString name() const override; |
|
31 | QString name() const override; | |
31 |
|
32 | |||
32 | public slots: |
|
33 | public slots: | |
33 | /** |
|
34 | /** | |
34 | * Attaches to a menu the menu relative to the visualization of variables |
|
35 | * Attaches to a menu the menu relative to the visualization of variables | |
35 | * @param menu the parent menu of the generated menu |
|
36 | * @param menu the parent menu of the generated menu | |
36 | * @param variables the variables for which to generate the menu |
|
37 | * @param variables the variables for which to generate the menu | |
37 | */ |
|
38 | */ | |
38 | void attachVariableMenu(QMenu *menu, |
|
39 | void attachVariableMenu(QMenu *menu, | |
39 | const QVector<std::shared_ptr<Variable> > &variables) noexcept; |
|
40 | const QVector<std::shared_ptr<Variable> > &variables) noexcept; | |
40 |
|
41 | |||
41 | /// Slot called when a variable is about to be deleted from SciQlop |
|
42 | /// Slot called when a variable is about to be deleted from SciQlop | |
42 | void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept; |
|
43 | void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept; | |
43 |
|
44 | |||
|
45 | void onRangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range) noexcept; | |||
|
46 | ||||
44 | private: |
|
47 | private: | |
45 | Ui::VisualizationWidget *ui; |
|
48 | Ui::VisualizationWidget *ui; | |
46 | }; |
|
49 | }; | |
47 |
|
50 | |||
48 | #endif // VISUALIZATIONWIDGET_H |
|
51 | #endif // VISUALIZATIONWIDGET_H |
@@ -1,146 +1,151 | |||||
1 | #include "SqpApplication.h" |
|
1 | #include "SqpApplication.h" | |
2 |
|
2 | |||
3 | #include <Data/IDataProvider.h> |
|
3 | #include <Data/IDataProvider.h> | |
4 | #include <DataSource/DataSourceController.h> |
|
4 | #include <DataSource/DataSourceController.h> | |
5 | #include <Network/NetworkController.h> |
|
5 | #include <Network/NetworkController.h> | |
6 | #include <QThread> |
|
6 | #include <QThread> | |
7 | #include <Time/TimeController.h> |
|
7 | #include <Time/TimeController.h> | |
8 | #include <Variable/Variable.h> |
|
8 | #include <Variable/Variable.h> | |
9 | #include <Variable/VariableController.h> |
|
9 | #include <Variable/VariableController.h> | |
10 | #include <Visualization/VisualizationController.h> |
|
10 | #include <Visualization/VisualizationController.h> | |
11 |
|
11 | |||
12 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
12 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
13 |
|
13 | |||
14 | class SqpApplication::SqpApplicationPrivate { |
|
14 | class SqpApplication::SqpApplicationPrivate { | |
15 | public: |
|
15 | public: | |
16 | SqpApplicationPrivate() |
|
16 | SqpApplicationPrivate() | |
17 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
17 | : m_DataSourceController{std::make_unique<DataSourceController>()}, | |
18 | m_NetworkController{std::make_unique<NetworkController>()}, |
|
18 | m_NetworkController{std::make_unique<NetworkController>()}, | |
19 | m_TimeController{std::make_unique<TimeController>()}, |
|
19 | m_TimeController{std::make_unique<TimeController>()}, | |
20 | m_VariableController{std::make_unique<VariableController>()}, |
|
20 | m_VariableController{std::make_unique<VariableController>()}, | |
21 | m_VisualizationController{std::make_unique<VisualizationController>()} |
|
21 | m_VisualizationController{std::make_unique<VisualizationController>()} | |
22 | { |
|
22 | { | |
23 | // /////////////////////////////// // |
|
23 | // /////////////////////////////// // | |
24 | // Connections between controllers // |
|
24 | // Connections between controllers // | |
25 | // /////////////////////////////// // |
|
25 | // /////////////////////////////// // | |
26 |
|
26 | |||
27 | // VariableController <-> DataSourceController |
|
27 | // VariableController <-> DataSourceController | |
28 | connect(m_DataSourceController.get(), |
|
28 | connect(m_DataSourceController.get(), | |
29 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, |
|
29 | SIGNAL(variableCreationRequested(const QString &, const QVariantHash &, | |
30 | std::shared_ptr<IDataProvider>)), |
|
30 | std::shared_ptr<IDataProvider>)), | |
31 | m_VariableController.get(), |
|
31 | m_VariableController.get(), | |
32 | SLOT(createVariable(const QString &, const QVariantHash &, |
|
32 | SLOT(createVariable(const QString &, const QVariantHash &, | |
33 | std::shared_ptr<IDataProvider>))); |
|
33 | std::shared_ptr<IDataProvider>))); | |
34 |
|
34 | |||
35 | // VariableController <-> VisualizationController |
|
35 | // VariableController <-> VisualizationController | |
36 | connect(m_VariableController.get(), |
|
36 | connect(m_VariableController.get(), | |
37 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), |
|
37 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), | |
38 | m_VisualizationController.get(), |
|
38 | m_VisualizationController.get(), | |
39 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
39 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); | |
40 |
|
40 | |||
|
41 | connect(m_VariableController.get(), | |||
|
42 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)), | |||
|
43 | m_VisualizationController.get(), | |||
|
44 | SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &))); | |||
|
45 | ||||
41 |
|
46 | |||
42 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
47 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
43 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); |
|
48 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); | |
44 | m_NetworkController->moveToThread(&m_NetworkControllerThread); |
|
49 | m_NetworkController->moveToThread(&m_NetworkControllerThread); | |
45 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); |
|
50 | m_NetworkControllerThread.setObjectName("NetworkControllerThread"); | |
46 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
51 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
47 | m_VariableControllerThread.setObjectName("VariableControllerThread"); |
|
52 | m_VariableControllerThread.setObjectName("VariableControllerThread"); | |
48 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
53 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
49 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
54 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); | |
50 |
|
55 | |||
51 |
|
56 | |||
52 | // Additionnal init |
|
57 | // Additionnal init | |
53 | m_VariableController->setTimeController(m_TimeController.get()); |
|
58 | m_VariableController->setTimeController(m_TimeController.get()); | |
54 | } |
|
59 | } | |
55 |
|
60 | |||
56 | virtual ~SqpApplicationPrivate() |
|
61 | virtual ~SqpApplicationPrivate() | |
57 | { |
|
62 | { | |
58 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); |
|
63 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); | |
59 | m_DataSourceControllerThread.quit(); |
|
64 | m_DataSourceControllerThread.quit(); | |
60 | m_DataSourceControllerThread.wait(); |
|
65 | m_DataSourceControllerThread.wait(); | |
61 |
|
66 | |||
62 | m_NetworkControllerThread.quit(); |
|
67 | m_NetworkControllerThread.quit(); | |
63 | m_NetworkControllerThread.wait(); |
|
68 | m_NetworkControllerThread.wait(); | |
64 |
|
69 | |||
65 | m_VariableControllerThread.quit(); |
|
70 | m_VariableControllerThread.quit(); | |
66 | m_VariableControllerThread.wait(); |
|
71 | m_VariableControllerThread.wait(); | |
67 |
|
72 | |||
68 | m_VisualizationControllerThread.quit(); |
|
73 | m_VisualizationControllerThread.quit(); | |
69 | m_VisualizationControllerThread.wait(); |
|
74 | m_VisualizationControllerThread.wait(); | |
70 | } |
|
75 | } | |
71 |
|
76 | |||
72 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
77 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
73 | std::unique_ptr<VariableController> m_VariableController; |
|
78 | std::unique_ptr<VariableController> m_VariableController; | |
74 | std::unique_ptr<TimeController> m_TimeController; |
|
79 | std::unique_ptr<TimeController> m_TimeController; | |
75 | std::unique_ptr<NetworkController> m_NetworkController; |
|
80 | std::unique_ptr<NetworkController> m_NetworkController; | |
76 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
81 | std::unique_ptr<VisualizationController> m_VisualizationController; | |
77 | QThread m_DataSourceControllerThread; |
|
82 | QThread m_DataSourceControllerThread; | |
78 | QThread m_NetworkControllerThread; |
|
83 | QThread m_NetworkControllerThread; | |
79 | QThread m_VariableControllerThread; |
|
84 | QThread m_VariableControllerThread; | |
80 | QThread m_VisualizationControllerThread; |
|
85 | QThread m_VisualizationControllerThread; | |
81 | }; |
|
86 | }; | |
82 |
|
87 | |||
83 |
|
88 | |||
84 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
89 | SqpApplication::SqpApplication(int &argc, char **argv) | |
85 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
90 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
86 | { |
|
91 | { | |
87 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); |
|
92 | qCDebug(LOG_SqpApplication()) << tr("SqpApplication construction") << QThread::currentThread(); | |
88 |
|
93 | |||
89 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
94 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
90 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
95 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |
91 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
96 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
92 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
97 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
93 |
|
98 | |||
94 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), |
|
99 | connect(&impl->m_NetworkControllerThread, &QThread::started, impl->m_NetworkController.get(), | |
95 | &NetworkController::initialize); |
|
100 | &NetworkController::initialize); | |
96 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), |
|
101 | connect(&impl->m_NetworkControllerThread, &QThread::finished, impl->m_NetworkController.get(), | |
97 | &NetworkController::finalize); |
|
102 | &NetworkController::finalize); | |
98 |
|
103 | |||
99 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
104 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), | |
100 | &VariableController::initialize); |
|
105 | &VariableController::initialize); | |
101 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
106 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), | |
102 | &VariableController::finalize); |
|
107 | &VariableController::finalize); | |
103 |
|
108 | |||
104 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
109 | connect(&impl->m_VisualizationControllerThread, &QThread::started, | |
105 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
110 | impl->m_VisualizationController.get(), &VisualizationController::initialize); | |
106 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
111 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, | |
107 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
112 | impl->m_VisualizationController.get(), &VisualizationController::finalize); | |
108 |
|
113 | |||
109 | impl->m_DataSourceControllerThread.start(); |
|
114 | impl->m_DataSourceControllerThread.start(); | |
110 | impl->m_NetworkControllerThread.start(); |
|
115 | impl->m_NetworkControllerThread.start(); | |
111 | impl->m_VariableControllerThread.start(); |
|
116 | impl->m_VariableControllerThread.start(); | |
112 | impl->m_VisualizationControllerThread.start(); |
|
117 | impl->m_VisualizationControllerThread.start(); | |
113 | } |
|
118 | } | |
114 |
|
119 | |||
115 | SqpApplication::~SqpApplication() |
|
120 | SqpApplication::~SqpApplication() | |
116 | { |
|
121 | { | |
117 | } |
|
122 | } | |
118 |
|
123 | |||
119 | void SqpApplication::initialize() |
|
124 | void SqpApplication::initialize() | |
120 | { |
|
125 | { | |
121 | } |
|
126 | } | |
122 |
|
127 | |||
123 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
128 | DataSourceController &SqpApplication::dataSourceController() noexcept | |
124 | { |
|
129 | { | |
125 | return *impl->m_DataSourceController; |
|
130 | return *impl->m_DataSourceController; | |
126 | } |
|
131 | } | |
127 |
|
132 | |||
128 | NetworkController &SqpApplication::networkController() noexcept |
|
133 | NetworkController &SqpApplication::networkController() noexcept | |
129 | { |
|
134 | { | |
130 | return *impl->m_NetworkController; |
|
135 | return *impl->m_NetworkController; | |
131 | } |
|
136 | } | |
132 |
|
137 | |||
133 | TimeController &SqpApplication::timeController() noexcept |
|
138 | TimeController &SqpApplication::timeController() noexcept | |
134 | { |
|
139 | { | |
135 | return *impl->m_TimeController; |
|
140 | return *impl->m_TimeController; | |
136 | } |
|
141 | } | |
137 |
|
142 | |||
138 | VariableController &SqpApplication::variableController() noexcept |
|
143 | VariableController &SqpApplication::variableController() noexcept | |
139 | { |
|
144 | { | |
140 | return *impl->m_VariableController; |
|
145 | return *impl->m_VariableController; | |
141 | } |
|
146 | } | |
142 |
|
147 | |||
143 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
148 | VisualizationController &SqpApplication::visualizationController() noexcept | |
144 | { |
|
149 | { | |
145 | return *impl->m_VisualizationController; |
|
150 | return *impl->m_VisualizationController; | |
146 | } |
|
151 | } |
@@ -1,160 +1,159 | |||||
1 | #include "Visualization/VisualizationGraphHelper.h" |
|
1 | #include "Visualization/VisualizationGraphHelper.h" | |
2 | #include "Visualization/qcustomplot.h" |
|
2 | #include "Visualization/qcustomplot.h" | |
3 |
|
3 | |||
4 | #include <Data/ScalarSeries.h> |
|
4 | #include <Data/ScalarSeries.h> | |
5 |
|
5 | |||
6 | #include <Variable/Variable.h> |
|
6 | #include <Variable/Variable.h> | |
7 |
|
7 | |||
8 | Q_LOGGING_CATEGORY(LOG_VisualizationGraphHelper, "VisualizationGraphHelper") |
|
8 | Q_LOGGING_CATEGORY(LOG_VisualizationGraphHelper, "VisualizationGraphHelper") | |
9 |
|
9 | |||
10 | namespace { |
|
10 | namespace { | |
11 |
|
11 | |||
12 | class SqpDataContainer : public QCPGraphDataContainer { |
|
12 | class SqpDataContainer : public QCPGraphDataContainer { | |
13 | public: |
|
13 | public: | |
14 | void appendGraphDataUnsorted(const QCPGraphData &data) { mData.append(data); } |
|
14 | void appendGraphDataUnsorted(const QCPGraphData &data) { mData.append(data); } | |
15 | }; |
|
15 | }; | |
16 |
|
16 | |||
17 |
|
17 | |||
18 | /// Format for datetimes on a axis |
|
18 | /// Format for datetimes on a axis | |
19 | const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss"); |
|
19 | const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss"); | |
20 |
|
20 | |||
21 | /// Generates the appropriate ticker for an axis, depending on whether the axis displays time or |
|
21 | /// Generates the appropriate ticker for an axis, depending on whether the axis displays time or | |
22 | /// non-time data |
|
22 | /// non-time data | |
23 | QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis) |
|
23 | QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis) | |
24 | { |
|
24 | { | |
25 | if (isTimeAxis) { |
|
25 | if (isTimeAxis) { | |
26 | auto dateTicker = QSharedPointer<QCPAxisTickerDateTime>::create(); |
|
26 | auto dateTicker = QSharedPointer<QCPAxisTickerDateTime>::create(); | |
27 | dateTicker->setDateTimeFormat(DATETIME_TICKER_FORMAT); |
|
27 | dateTicker->setDateTimeFormat(DATETIME_TICKER_FORMAT); | |
28 |
|
28 | |||
29 | return dateTicker; |
|
29 | return dateTicker; | |
30 | } |
|
30 | } | |
31 | else { |
|
31 | else { | |
32 | // default ticker |
|
32 | // default ticker | |
33 | return QSharedPointer<QCPAxisTicker>::create(); |
|
33 | return QSharedPointer<QCPAxisTicker>::create(); | |
34 | } |
|
34 | } | |
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 | void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSeries, |
|
37 | void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSeries, | |
38 | const SqpDateTime &dateTime) |
|
38 | const SqpDateTime &dateTime) | |
39 | { |
|
39 | { | |
40 | qCDebug(LOG_VisualizationGraphHelper()) << "TORM: updateScalarData" |
|
40 | qCDebug(LOG_VisualizationGraphHelper()) << "TORM: updateScalarData" | |
41 | << QThread::currentThread()->objectName(); |
|
41 | << QThread::currentThread()->objectName(); | |
42 | if (auto qcpGraph = dynamic_cast<QCPGraph *>(component)) { |
|
42 | if (auto qcpGraph = dynamic_cast<QCPGraph *>(component)) { | |
43 | // Clean the graph |
|
43 | // Clean the graph | |
44 | // NAIVE approch |
|
44 | // NAIVE approch | |
45 | scalarSeries.lockRead(); |
|
45 | scalarSeries.lockRead(); | |
46 | { |
|
46 | { | |
47 | const auto xData = scalarSeries.xAxisData()->data(); |
|
47 | const auto xData = scalarSeries.xAxisData()->data(); | |
48 | const auto valuesData = scalarSeries.valuesData()->data(); |
|
48 | const auto valuesData = scalarSeries.valuesData()->data(); | |
49 | const auto count = xData.count(); |
|
49 | const auto count = xData.count(); | |
50 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points in cache" |
|
50 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points in cache" | |
51 | << xData.count(); |
|
51 | << xData.count(); | |
52 |
|
52 | |||
53 | auto dataContainer = qcpGraph->data(); |
|
53 | auto dataContainer = qcpGraph->data(); | |
54 | dataContainer->clear(); |
|
54 | dataContainer->clear(); | |
55 | auto sqpDataContainer = QSharedPointer<SqpDataContainer>::create(); |
|
55 | auto sqpDataContainer = QSharedPointer<SqpDataContainer>::create(); | |
56 | qcpGraph->setData(sqpDataContainer); |
|
56 | qcpGraph->setData(sqpDataContainer); | |
57 |
|
57 | |||
58 | for (auto i = 0; i < count; ++i) { |
|
58 | for (auto i = 0; i < count; ++i) { | |
59 | const auto x = xData[i]; |
|
59 | const auto x = xData[i]; | |
60 | if (x >= dateTime.m_TStart && x <= dateTime.m_TEnd) { |
|
60 | if (x >= dateTime.m_TStart && x <= dateTime.m_TEnd) { | |
61 | sqpDataContainer->appendGraphDataUnsorted(QCPGraphData(x, valuesData[i])); |
|
61 | sqpDataContainer->appendGraphDataUnsorted(QCPGraphData(x, valuesData[i])); | |
62 | } |
|
62 | } | |
63 | } |
|
63 | } | |
64 | sqpDataContainer->sort(); |
|
64 | sqpDataContainer->sort(); | |
65 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points displayed" |
|
65 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points displayed" | |
66 | << sqpDataContainer->size(); |
|
66 | << sqpDataContainer->size(); | |
67 | } |
|
67 | } | |
68 | scalarSeries.unlock(); |
|
68 | scalarSeries.unlock(); | |
69 |
|
69 | |||
70 |
|
70 | |||
71 | // Display all data |
|
71 | // Display all data | |
72 | component->rescaleAxes(); |
|
|||
73 | component->parentPlot()->replot(); |
|
72 | component->parentPlot()->replot(); | |
74 | } |
|
73 | } | |
75 | else { |
|
74 | else { | |
76 | /// @todo DEBUG |
|
75 | /// @todo DEBUG | |
77 | } |
|
76 | } | |
78 | } |
|
77 | } | |
79 |
|
78 | |||
80 | QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QCustomPlot &plot, |
|
79 | QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QCustomPlot &plot, | |
81 | const SqpDateTime &dateTime) |
|
80 | const SqpDateTime &dateTime) | |
82 | { |
|
81 | { | |
83 | auto component = plot.addGraph(); |
|
82 | auto component = plot.addGraph(); | |
84 |
|
83 | |||
85 | if (component) { |
|
84 | if (component) { | |
86 | // // Graph data |
|
85 | // // Graph data | |
87 | component->setData(scalarSeries.xAxisData()->data(), scalarSeries.valuesData()->data(), |
|
86 | component->setData(scalarSeries.xAxisData()->data(), scalarSeries.valuesData()->data(), | |
88 | true); |
|
87 | true); | |
89 |
|
88 | |||
90 | updateScalarData(component, scalarSeries, dateTime); |
|
89 | updateScalarData(component, scalarSeries, dateTime); | |
91 |
|
90 | |||
92 | // Axes properties |
|
91 | // Axes properties | |
93 | /// @todo : for the moment, no control is performed on the axes: the units and the tickers |
|
92 | /// @todo : for the moment, no control is performed on the axes: the units and the tickers | |
94 | /// are fixed for the default x-axis and y-axis of the plot, and according to the new graph |
|
93 | /// are fixed for the default x-axis and y-axis of the plot, and according to the new graph | |
95 |
|
94 | |||
96 | auto setAxisProperties = [](auto axis, const auto &unit) { |
|
95 | auto setAxisProperties = [](auto axis, const auto &unit) { | |
97 | // label (unit name) |
|
96 | // label (unit name) | |
98 | axis->setLabel(unit.m_Name); |
|
97 | axis->setLabel(unit.m_Name); | |
99 |
|
98 | |||
100 | // ticker (depending on the type of unit) |
|
99 | // ticker (depending on the type of unit) | |
101 | axis->setTicker(axisTicker(unit.m_TimeUnit)); |
|
100 | axis->setTicker(axisTicker(unit.m_TimeUnit)); | |
102 | }; |
|
101 | }; | |
103 | setAxisProperties(plot.xAxis, scalarSeries.xAxisUnit()); |
|
102 | setAxisProperties(plot.xAxis, scalarSeries.xAxisUnit()); | |
104 | setAxisProperties(plot.yAxis, scalarSeries.valuesUnit()); |
|
103 | setAxisProperties(plot.yAxis, scalarSeries.valuesUnit()); | |
105 |
|
104 | |||
106 | // Display all data |
|
105 | // Display all data | |
107 | component->rescaleAxes(); |
|
106 | component->rescaleAxes(); | |
108 | plot.replot(); |
|
107 | plot.replot(); | |
109 | } |
|
108 | } | |
110 | else { |
|
109 | else { | |
111 | qCDebug(LOG_VisualizationGraphHelper()) |
|
110 | qCDebug(LOG_VisualizationGraphHelper()) | |
112 | << QObject::tr("Can't create graph for the scalar series"); |
|
111 | << QObject::tr("Can't create graph for the scalar series"); | |
113 | } |
|
112 | } | |
114 |
|
113 | |||
115 | return component; |
|
114 | return component; | |
116 | } |
|
115 | } | |
117 |
|
116 | |||
118 | } // namespace |
|
117 | } // namespace | |
119 |
|
118 | |||
120 | QVector<QCPAbstractPlottable *> VisualizationGraphHelper::create(std::shared_ptr<Variable> variable, |
|
119 | QVector<QCPAbstractPlottable *> VisualizationGraphHelper::create(std::shared_ptr<Variable> variable, | |
121 | QCustomPlot &plot) noexcept |
|
120 | QCustomPlot &plot) noexcept | |
122 | { |
|
121 | { | |
123 | auto result = QVector<QCPAbstractPlottable *>{}; |
|
122 | auto result = QVector<QCPAbstractPlottable *>{}; | |
124 |
|
123 | |||
125 | if (variable) { |
|
124 | if (variable) { | |
126 | // Gets the data series of the variable to call the creation of the right components |
|
125 | // Gets the data series of the variable to call the creation of the right components | |
127 | // according to its type |
|
126 | // according to its type | |
128 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(variable->dataSeries())) { |
|
127 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(variable->dataSeries())) { | |
129 | result.append(createScalarSeriesComponent(*scalarSeries, plot, variable->dateTime())); |
|
128 | result.append(createScalarSeriesComponent(*scalarSeries, plot, variable->dateTime())); | |
130 | } |
|
129 | } | |
131 | else { |
|
130 | else { | |
132 | qCDebug(LOG_VisualizationGraphHelper()) |
|
131 | qCDebug(LOG_VisualizationGraphHelper()) | |
133 | << QObject::tr("Can't create graph plottables : unmanaged data series type"); |
|
132 | << QObject::tr("Can't create graph plottables : unmanaged data series type"); | |
134 | } |
|
133 | } | |
135 | } |
|
134 | } | |
136 | else { |
|
135 | else { | |
137 | qCDebug(LOG_VisualizationGraphHelper()) |
|
136 | qCDebug(LOG_VisualizationGraphHelper()) | |
138 | << QObject::tr("Can't create graph plottables : the variable is null"); |
|
137 | << QObject::tr("Can't create graph plottables : the variable is null"); | |
139 | } |
|
138 | } | |
140 |
|
139 | |||
141 | return result; |
|
140 | return result; | |
142 | } |
|
141 | } | |
143 |
|
142 | |||
144 | void VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *> plotableVect, |
|
143 | void VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *> plotableVect, | |
145 | IDataSeries *dataSeries, const SqpDateTime &dateTime) |
|
144 | IDataSeries *dataSeries, const SqpDateTime &dateTime) | |
146 | { |
|
145 | { | |
147 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(dataSeries)) { |
|
146 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(dataSeries)) { | |
148 | if (plotableVect.size() == 1) { |
|
147 | if (plotableVect.size() == 1) { | |
149 | updateScalarData(plotableVect.at(0), *scalarSeries, dateTime); |
|
148 | updateScalarData(plotableVect.at(0), *scalarSeries, dateTime); | |
150 | } |
|
149 | } | |
151 | else { |
|
150 | else { | |
152 | qCCritical(LOG_VisualizationGraphHelper()) << QObject::tr( |
|
151 | qCCritical(LOG_VisualizationGraphHelper()) << QObject::tr( | |
153 | "Can't update Data of a scalarSeries because there is not only one component " |
|
152 | "Can't update Data of a scalarSeries because there is not only one component " | |
154 | "associated"); |
|
153 | "associated"); | |
155 | } |
|
154 | } | |
156 | } |
|
155 | } | |
157 | else { |
|
156 | else { | |
158 | /// @todo DEBUG |
|
157 | /// @todo DEBUG | |
159 | } |
|
158 | } | |
160 | } |
|
159 | } |
@@ -1,285 +1,307 | |||||
1 | #include "Visualization/VisualizationGraphWidget.h" |
|
1 | #include "Visualization/VisualizationGraphWidget.h" | |
2 | #include "Visualization/IVisualizationWidgetVisitor.h" |
|
2 | #include "Visualization/IVisualizationWidgetVisitor.h" | |
3 | #include "Visualization/VisualizationGraphHelper.h" |
|
3 | #include "Visualization/VisualizationGraphHelper.h" | |
4 | #include "ui_VisualizationGraphWidget.h" |
|
4 | #include "ui_VisualizationGraphWidget.h" | |
5 |
|
5 | |||
6 | #include <Data/ArrayData.h> |
|
6 | #include <Data/ArrayData.h> | |
7 | #include <Data/IDataSeries.h> |
|
7 | #include <Data/IDataSeries.h> | |
8 | #include <SqpApplication.h> |
|
8 | #include <SqpApplication.h> | |
9 | #include <Variable/Variable.h> |
|
9 | #include <Variable/Variable.h> | |
10 | #include <Variable/VariableController.h> |
|
10 | #include <Variable/VariableController.h> | |
11 |
|
11 | |||
12 | #include <unordered_map> |
|
12 | #include <unordered_map> | |
13 |
|
13 | |||
14 | Q_LOGGING_CATEGORY(LOG_VisualizationGraphWidget, "VisualizationGraphWidget") |
|
14 | Q_LOGGING_CATEGORY(LOG_VisualizationGraphWidget, "VisualizationGraphWidget") | |
15 |
|
15 | |||
16 | namespace { |
|
16 | namespace { | |
17 |
|
17 | |||
18 | /// Key pressed to enable zoom on horizontal axis |
|
18 | /// Key pressed to enable zoom on horizontal axis | |
19 | const auto HORIZONTAL_ZOOM_MODIFIER = Qt::NoModifier; |
|
19 | const auto HORIZONTAL_ZOOM_MODIFIER = Qt::NoModifier; | |
20 |
|
20 | |||
21 | /// Key pressed to enable zoom on vertical axis |
|
21 | /// Key pressed to enable zoom on vertical axis | |
22 | const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier; |
|
22 | const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier; | |
23 |
|
23 | |||
24 | } // namespace |
|
24 | } // namespace | |
25 |
|
25 | |||
26 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { |
|
26 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |
27 |
|
27 | |||
28 | // 1 variable -> n qcpplot |
|
28 | // 1 variable -> n qcpplot | |
29 | std::multimap<std::shared_ptr<Variable>, QCPAbstractPlottable *> m_VariableToPlotMultiMap; |
|
29 | std::multimap<std::shared_ptr<Variable>, QCPAbstractPlottable *> m_VariableToPlotMultiMap; | |
30 | }; |
|
30 | }; | |
31 |
|
31 | |||
32 | VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget *parent) |
|
32 | VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget *parent) | |
33 | : QWidget{parent}, |
|
33 | : QWidget{parent}, | |
34 | ui{new Ui::VisualizationGraphWidget}, |
|
34 | ui{new Ui::VisualizationGraphWidget}, | |
35 | impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>()} |
|
35 | impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>()} | |
36 | { |
|
36 | { | |
37 | ui->setupUi(this); |
|
37 | ui->setupUi(this); | |
38 |
|
38 | |||
39 | ui->graphNameLabel->setText(name); |
|
39 | ui->graphNameLabel->setText(name); | |
40 |
|
40 | |||
41 | // 'Close' options : widget is deleted when closed |
|
41 | // 'Close' options : widget is deleted when closed | |
42 | setAttribute(Qt::WA_DeleteOnClose); |
|
42 | setAttribute(Qt::WA_DeleteOnClose); | |
43 | connect(ui->closeButton, &QToolButton::clicked, this, &VisualizationGraphWidget::close); |
|
43 | connect(ui->closeButton, &QToolButton::clicked, this, &VisualizationGraphWidget::close); | |
44 | ui->closeButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); |
|
44 | ui->closeButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); | |
45 |
|
45 | |||
46 | // Set qcpplot properties : |
|
46 | // Set qcpplot properties : | |
47 | // - Drag (on x-axis) and zoom are enabled |
|
47 | // - Drag (on x-axis) and zoom are enabled | |
48 | // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation |
|
48 | // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation | |
49 | ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); |
|
49 | ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); | |
50 | ui->widget->axisRect()->setRangeDrag(Qt::Horizontal); |
|
50 | ui->widget->axisRect()->setRangeDrag(Qt::Horizontal); | |
51 | connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel); |
|
51 | connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel); | |
52 | connect(ui->widget->xAxis, |
|
52 | connect(ui->widget->xAxis, | |
53 | static_cast<void (QCPAxis::*)(const QCPRange &)>(&QCPAxis::rangeChanged), this, |
|
53 | static_cast<void (QCPAxis::*)(const QCPRange &)>(&QCPAxis::rangeChanged), this, | |
54 | &VisualizationGraphWidget::onRangeChanged); |
|
54 | &VisualizationGraphWidget::onRangeChanged); | |
55 |
|
55 | |||
56 | // Activates menu when right clicking on the graph |
|
56 | // Activates menu when right clicking on the graph | |
57 | ui->widget->setContextMenuPolicy(Qt::CustomContextMenu); |
|
57 | ui->widget->setContextMenuPolicy(Qt::CustomContextMenu); | |
58 | connect(ui->widget, &QCustomPlot::customContextMenuRequested, this, |
|
58 | connect(ui->widget, &QCustomPlot::customContextMenuRequested, this, | |
59 | &VisualizationGraphWidget::onGraphMenuRequested); |
|
59 | &VisualizationGraphWidget::onGraphMenuRequested); | |
60 |
|
60 | |||
61 | connect(this, &VisualizationGraphWidget::requestDataLoading, &sqpApp->variableController(), |
|
61 | connect(this, &VisualizationGraphWidget::requestDataLoading, &sqpApp->variableController(), | |
62 | &VariableController::onRequestDataLoading); |
|
62 | &VariableController::onRequestDataLoading); | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 |
|
65 | |||
66 | VisualizationGraphWidget::~VisualizationGraphWidget() |
|
66 | VisualizationGraphWidget::~VisualizationGraphWidget() | |
67 | { |
|
67 | { | |
68 | delete ui; |
|
68 | delete ui; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable) |
|
71 | void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable) | |
72 | { |
|
72 | { | |
73 | // Uses delegate to create the qcpplot components according to the variable |
|
73 | // Uses delegate to create the qcpplot components according to the variable | |
74 | auto createdPlottables = VisualizationGraphHelper::create(variable, *ui->widget); |
|
74 | auto createdPlottables = VisualizationGraphHelper::create(variable, *ui->widget); | |
75 |
|
75 | |||
76 | for (auto createdPlottable : qAsConst(createdPlottables)) { |
|
76 | for (auto createdPlottable : qAsConst(createdPlottables)) { | |
77 | impl->m_VariableToPlotMultiMap.insert({variable, createdPlottable}); |
|
77 | impl->m_VariableToPlotMultiMap.insert({variable, createdPlottable}); | |
78 | } |
|
78 | } | |
79 |
|
79 | |||
80 | connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated())); |
|
80 | connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated())); | |
81 | } |
|
81 | } | |
82 | void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> variable) |
|
82 | void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> variable) | |
83 | { |
|
83 | { | |
84 |
|
84 | |||
85 | // when adding a variable, we need to set its time range to the current graph range |
|
85 | // when adding a variable, we need to set its time range to the current graph range | |
86 | auto grapheRange = ui->widget->xAxis->range(); |
|
86 | auto grapheRange = ui->widget->xAxis->range(); | |
87 | auto dateTime = SqpDateTime{grapheRange.lower, grapheRange.upper}; |
|
87 | auto dateTime = SqpDateTime{grapheRange.lower, grapheRange.upper}; | |
88 | variable->setDateTime(dateTime); |
|
88 | variable->setDateTime(dateTime); | |
89 |
|
89 | |||
90 | auto variableDateTimeWithTolerance = dateTime; |
|
90 | auto variableDateTimeWithTolerance = dateTime; | |
91 |
|
91 | |||
92 | // add 10% tolerance for each side |
|
92 | // add 10% tolerance for each side | |
93 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
93 | auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); | |
94 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
94 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
95 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
95 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |
96 |
|
96 | |||
97 | // Uses delegate to create the qcpplot components according to the variable |
|
97 | // Uses delegate to create the qcpplot components according to the variable | |
98 | auto createdPlottables = VisualizationGraphHelper::create(variable, *ui->widget); |
|
98 | auto createdPlottables = VisualizationGraphHelper::create(variable, *ui->widget); | |
99 |
|
99 | |||
100 | for (auto createdPlottable : qAsConst(createdPlottables)) { |
|
100 | for (auto createdPlottable : qAsConst(createdPlottables)) { | |
101 | impl->m_VariableToPlotMultiMap.insert({variable, createdPlottable}); |
|
101 | impl->m_VariableToPlotMultiMap.insert({variable, createdPlottable}); | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated())); |
|
104 | connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated())); | |
105 |
|
105 | |||
106 | // CHangement detected, we need to ask controller to request data loading |
|
106 | // CHangement detected, we need to ask controller to request data loading | |
107 | emit requestDataLoading(variable, variableDateTimeWithTolerance); |
|
107 | emit requestDataLoading(variable, variableDateTimeWithTolerance); | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 | void VisualizationGraphWidget::removeVariable(std::shared_ptr<Variable> variable) noexcept |
|
110 | void VisualizationGraphWidget::removeVariable(std::shared_ptr<Variable> variable) noexcept | |
111 | { |
|
111 | { | |
112 | // Each component associated to the variable : |
|
112 | // Each component associated to the variable : | |
113 | // - is removed from qcpplot (which deletes it) |
|
113 | // - is removed from qcpplot (which deletes it) | |
114 | // - is no longer referenced in the map |
|
114 | // - is no longer referenced in the map | |
115 | auto componentsIt = impl->m_VariableToPlotMultiMap.equal_range(variable); |
|
115 | auto componentsIt = impl->m_VariableToPlotMultiMap.equal_range(variable); | |
116 | for (auto it = componentsIt.first; it != componentsIt.second;) { |
|
116 | for (auto it = componentsIt.first; it != componentsIt.second;) { | |
117 | ui->widget->removePlottable(it->second); |
|
117 | ui->widget->removePlottable(it->second); | |
118 | it = impl->m_VariableToPlotMultiMap.erase(it); |
|
118 | it = impl->m_VariableToPlotMultiMap.erase(it); | |
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 | // Updates graph |
|
121 | // Updates graph | |
122 | ui->widget->replot(); |
|
122 | ui->widget->replot(); | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
|
125 | void VisualizationGraphWidget::setRange(std::shared_ptr<Variable> variable, | |||
|
126 | const SqpDateTime &range) | |||
|
127 | { | |||
|
128 | // auto componentsIt = impl->m_VariableToPlotMultiMap.equal_range(variable); | |||
|
129 | // for (auto it = componentsIt.first; it != componentsIt.second;) { | |||
|
130 | // } | |||
|
131 | ui->widget->xAxis->setRange(range.m_TStart, range.m_TEnd); | |||
|
132 | } | |||
|
133 | ||||
125 | void VisualizationGraphWidget::accept(IVisualizationWidgetVisitor *visitor) |
|
134 | void VisualizationGraphWidget::accept(IVisualizationWidgetVisitor *visitor) | |
126 | { |
|
135 | { | |
127 | if (visitor) { |
|
136 | if (visitor) { | |
128 | visitor->visit(this); |
|
137 | visitor->visit(this); | |
129 | } |
|
138 | } | |
130 | else { |
|
139 | else { | |
131 | qCCritical(LOG_VisualizationGraphWidget()) |
|
140 | qCCritical(LOG_VisualizationGraphWidget()) | |
132 | << tr("Can't visit widget : the visitor is null"); |
|
141 | << tr("Can't visit widget : the visitor is null"); | |
133 | } |
|
142 | } | |
134 | } |
|
143 | } | |
135 |
|
144 | |||
136 | bool VisualizationGraphWidget::canDrop(const Variable &variable) const |
|
145 | bool VisualizationGraphWidget::canDrop(const Variable &variable) const | |
137 | { |
|
146 | { | |
138 | /// @todo : for the moment, a graph can always accomodate a variable |
|
147 | /// @todo : for the moment, a graph can always accomodate a variable | |
139 | Q_UNUSED(variable); |
|
148 | Q_UNUSED(variable); | |
140 | return true; |
|
149 | return true; | |
141 | } |
|
150 | } | |
142 |
|
151 | |||
143 | bool VisualizationGraphWidget::contains(const Variable &variable) const |
|
152 | bool VisualizationGraphWidget::contains(const Variable &variable) const | |
144 | { |
|
153 | { | |
145 | // Finds the variable among the keys of the map |
|
154 | // Finds the variable among the keys of the map | |
146 | auto variablePtr = &variable; |
|
155 | auto variablePtr = &variable; | |
147 | auto findVariable |
|
156 | auto findVariable | |
148 | = [variablePtr](const auto &entry) { return variablePtr == entry.first.get(); }; |
|
157 | = [variablePtr](const auto &entry) { return variablePtr == entry.first.get(); }; | |
149 |
|
158 | |||
150 | auto end = impl->m_VariableToPlotMultiMap.cend(); |
|
159 | auto end = impl->m_VariableToPlotMultiMap.cend(); | |
151 | auto it = std::find_if(impl->m_VariableToPlotMultiMap.cbegin(), end, findVariable); |
|
160 | auto it = std::find_if(impl->m_VariableToPlotMultiMap.cbegin(), end, findVariable); | |
152 | return it != end; |
|
161 | return it != end; | |
153 | } |
|
162 | } | |
154 |
|
163 | |||
155 | QString VisualizationGraphWidget::name() const |
|
164 | QString VisualizationGraphWidget::name() const | |
156 | { |
|
165 | { | |
157 | return ui->graphNameLabel->text(); |
|
166 | return ui->graphNameLabel->text(); | |
158 | } |
|
167 | } | |
159 |
|
168 | |||
160 | void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept |
|
169 | void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept | |
161 | { |
|
170 | { | |
162 | QMenu graphMenu{}; |
|
171 | QMenu graphMenu{}; | |
163 |
|
172 | |||
164 | // Iterates on variables (unique keys) |
|
173 | // Iterates on variables (unique keys) | |
165 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(), |
|
174 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(), | |
166 | end = impl->m_VariableToPlotMultiMap.cend(); |
|
175 | end = impl->m_VariableToPlotMultiMap.cend(); | |
167 | it != end; it = impl->m_VariableToPlotMultiMap.upper_bound(it->first)) { |
|
176 | it != end; it = impl->m_VariableToPlotMultiMap.upper_bound(it->first)) { | |
168 | // 'Remove variable' action |
|
177 | // 'Remove variable' action | |
169 | graphMenu.addAction(tr("Remove variable %1").arg(it->first->name()), |
|
178 | graphMenu.addAction(tr("Remove variable %1").arg(it->first->name()), | |
170 | [ this, var = it->first ]() { removeVariable(var); }); |
|
179 | [ this, var = it->first ]() { removeVariable(var); }); | |
171 | } |
|
180 | } | |
172 |
|
181 | |||
173 | if (!graphMenu.isEmpty()) { |
|
182 | if (!graphMenu.isEmpty()) { | |
174 | graphMenu.exec(mapToGlobal(pos)); |
|
183 | graphMenu.exec(mapToGlobal(pos)); | |
175 | } |
|
184 | } | |
176 | } |
|
185 | } | |
177 |
|
186 | |||
178 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) |
|
187 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) | |
179 | { |
|
188 | { | |
180 |
qC |
|
189 | qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged") | |
181 |
|
|
190 | << QThread::currentThread()->objectName(); | |
182 |
|
191 | |||
183 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); |
|
192 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); | |
184 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { |
|
193 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { | |
185 |
|
194 | |||
186 | auto variable = it->first; |
|
195 | auto variable = it->first; | |
187 | auto dateTime = SqpDateTime{t1.lower, t1.upper}; |
|
196 | auto dateTime = SqpDateTime{t1.lower, t1.upper}; | |
|
197 | auto dateTimeRange = dateTime; | |||
188 |
|
198 | |||
189 | if (!variable->contains(dateTime)) { |
|
199 | auto toleranceFactor = 0.2; | |
|
200 | auto tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |||
|
201 | auto variableDateTimeWithTolerance = dateTime; | |||
|
202 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |||
|
203 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |||
|
204 | ||||
|
205 | qCInfo(LOG_VisualizationGraphWidget()) << "v" << dateTime; | |||
|
206 | qCInfo(LOG_VisualizationGraphWidget()) << "vtol" << variableDateTimeWithTolerance; | |||
|
207 | // If new range with tol is upper than variable datetime parameters. we need to request new | |||
|
208 | // data | |||
|
209 | if (!variable->contains(variableDateTimeWithTolerance)) { | |||
190 |
|
210 | |||
191 | auto variableDateTimeWithTolerance = dateTime; |
|
211 | auto variableDateTimeWithTolerance = dateTime; | |
192 | if (!variable->isInside(dateTime)) { |
|
212 | if (!variable->isInside(dateTime)) { | |
193 | auto variableDateTime = variable->dateTime(); |
|
213 | auto variableDateTime = variable->dateTime(); | |
194 | if (variableDateTime.m_TStart < dateTime.m_TStart) { |
|
214 | if (variableDateTime.m_TStart < dateTime.m_TStart) { | |
195 |
qC |
|
215 | qCInfo(LOG_VisualizationGraphWidget()) << tr("TORM: Detection pan to right:"); | |
196 |
|
216 | |||
197 | auto diffEndToKeepDelta = dateTime.m_TEnd - variableDateTime.m_TEnd; |
|
217 | auto diffEndToKeepDelta = dateTime.m_TEnd - variableDateTime.m_TEnd; | |
198 | dateTime.m_TStart = variableDateTime.m_TStart + diffEndToKeepDelta; |
|
218 | dateTime.m_TStart = variableDateTime.m_TStart + diffEndToKeepDelta; | |
199 | // Tolerance have to be added to the right |
|
219 | // Tolerance have to be added to the right | |
200 |
// add |
|
220 | // add tolerance for right (end) side | |
201 |
|
|
221 | tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |
202 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
222 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |
203 | } |
|
223 | } | |
204 | else if (variableDateTime.m_TEnd > dateTime.m_TEnd) { |
|
224 | else if (variableDateTime.m_TEnd > dateTime.m_TEnd) { | |
205 |
qC |
|
225 | qCInfo(LOG_VisualizationGraphWidget()) << tr("TORM: Detection pan to left: "); | |
206 | auto diffStartToKeepDelta = variableDateTime.m_TStart - dateTime.m_TStart; |
|
226 | auto diffStartToKeepDelta = variableDateTime.m_TStart - dateTime.m_TStart; | |
207 | dateTime.m_TEnd = variableDateTime.m_TEnd - diffStartToKeepDelta; |
|
227 | dateTime.m_TEnd = variableDateTime.m_TEnd - diffStartToKeepDelta; | |
208 | // Tolerance have to be added to the left |
|
228 | // Tolerance have to be added to the left | |
209 |
// add |
|
229 | // add tolerance for left (start) side | |
210 |
|
|
230 | tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |
211 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
231 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
212 | } |
|
232 | } | |
213 | else { |
|
233 | else { | |
214 | qCWarning(LOG_VisualizationGraphWidget()) |
|
234 | qCWarning(LOG_VisualizationGraphWidget()) | |
215 | << tr("Detection anormal zoom detection: "); |
|
235 | << tr("Detection anormal zoom detection: "); | |
216 | } |
|
236 | } | |
217 | } |
|
237 | } | |
218 | else { |
|
238 | else { | |
219 |
qC |
|
239 | qCInfo(LOG_VisualizationGraphWidget()) << tr("Detection zoom out: "); | |
220 | // add 10% tolerance for each side |
|
240 | // add 10% tolerance for each side | |
221 |
|
|
241 | tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); | |
222 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
242 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
223 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
243 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |
224 | } |
|
244 | } | |
|
245 | if (!variable->contains(dateTimeRange)) { | |||
|
246 | qCInfo(LOG_VisualizationGraphWidget()) | |||
|
247 | << "TORM: Modif on variable datetime detected" << dateTime; | |||
225 | variable->setDateTime(dateTime); |
|
248 | variable->setDateTime(dateTime); | |
|
249 | } | |||
226 |
|
250 | |||
|
251 | qCInfo(LOG_VisualizationGraphWidget()) << tr("Request data detection: "); | |||
227 | // CHangement detected, we need to ask controller to request data loading |
|
252 | // CHangement detected, we need to ask controller to request data loading | |
228 | emit requestDataLoading(variable, variableDateTimeWithTolerance); |
|
253 | emit requestDataLoading(variable, variableDateTimeWithTolerance); | |
229 | } |
|
254 | } | |
230 | else { |
|
255 | else { | |
231 |
qC |
|
256 | qCInfo(LOG_VisualizationGraphWidget()) << tr("Detection zoom in: "); | |
232 | } |
|
257 | } | |
233 | } |
|
258 | } | |
234 | } |
|
259 | } | |
235 |
|
260 | |||
236 | void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept |
|
261 | void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept | |
237 | { |
|
262 | { | |
238 | auto zoomOrientations = QFlags<Qt::Orientation>{}; |
|
263 | auto zoomOrientations = QFlags<Qt::Orientation>{}; | |
239 |
|
264 | |||
240 | // Lambda that enables a zoom orientation if the key modifier related to this orientation |
|
265 | // Lambda that enables a zoom orientation if the key modifier related to this orientation | |
241 | // has |
|
266 | // has | |
242 | // been pressed |
|
267 | // been pressed | |
243 | auto enableOrientation |
|
268 | auto enableOrientation | |
244 | = [&zoomOrientations, event](const auto &orientation, const auto &modifier) { |
|
269 | = [&zoomOrientations, event](const auto &orientation, const auto &modifier) { | |
245 | auto orientationEnabled = event->modifiers().testFlag(modifier); |
|
270 | auto orientationEnabled = event->modifiers().testFlag(modifier); | |
246 | zoomOrientations.setFlag(orientation, orientationEnabled); |
|
271 | zoomOrientations.setFlag(orientation, orientationEnabled); | |
247 | }; |
|
272 | }; | |
248 | enableOrientation(Qt::Vertical, VERTICAL_ZOOM_MODIFIER); |
|
273 | enableOrientation(Qt::Vertical, VERTICAL_ZOOM_MODIFIER); | |
249 | enableOrientation(Qt::Horizontal, HORIZONTAL_ZOOM_MODIFIER); |
|
274 | enableOrientation(Qt::Horizontal, HORIZONTAL_ZOOM_MODIFIER); | |
250 |
|
275 | |||
251 | ui->widget->axisRect()->setRangeZoom(zoomOrientations); |
|
276 | ui->widget->axisRect()->setRangeZoom(zoomOrientations); | |
252 | } |
|
277 | } | |
253 |
|
278 | |||
254 | void VisualizationGraphWidget::onDataCacheVariableUpdated() |
|
279 | void VisualizationGraphWidget::onDataCacheVariableUpdated() | |
255 | { |
|
280 | { | |
256 | // NOTE: |
|
281 | // NOTE: | |
257 | // We don't want to call the method for each component of a variable unitarily, but for |
|
282 | // We don't want to call the method for each component of a variable unitarily, but for | |
258 | // all |
|
283 | // all | |
259 | // its components at once (eg its three components in the case of a vector). |
|
284 | // its components at once (eg its three components in the case of a vector). | |
260 |
|
285 | |||
261 | // The unordered_multimap does not do this easily, so the question is whether to: |
|
286 | // The unordered_multimap does not do this easily, so the question is whether to: | |
262 | // - use an ordered_multimap and the algos of std to group the values by key |
|
287 | // - use an ordered_multimap and the algos of std to group the values by key | |
263 | // - use a map (unique keys) and store as values directly the list of components |
|
288 | // - use a map (unique keys) and store as values directly the list of components | |
264 |
|
289 | |||
|
290 | auto grapheRange = ui->widget->xAxis->range(); | |||
|
291 | auto dateTime = SqpDateTime{grapheRange.lower, grapheRange.upper}; | |||
|
292 | ||||
265 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); |
|
293 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); | |
266 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { |
|
294 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { | |
267 | auto variable = it->first; |
|
295 | auto variable = it->first; | |
|
296 | qCInfo(LOG_VisualizationGraphWidget()) | |||
|
297 | << "TORM: VisualizationGraphWidget::onDataCacheVariableUpdated S" | |||
|
298 | << variable->dateTime(); | |||
|
299 | qCInfo(LOG_VisualizationGraphWidget()) | |||
|
300 | << "TORM: VisualizationGraphWidget::onDataCacheVariableUpdated E" << dateTime; | |||
|
301 | if (dateTime.contains(variable->dateTime()) || dateTime.intersect(variable->dateTime())) { | |||
|
302 | ||||
268 | VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *>{} << it->second, |
|
303 | VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *>{} << it->second, | |
269 | variable->dataSeries(), variable->dateTime()); |
|
304 | variable->dataSeries(), variable->dateTime()); | |
270 | } |
|
305 | } | |
271 | } |
|
306 | } | |
272 |
|
||||
273 | void VisualizationGraphWidget::updateDisplay(std::shared_ptr<Variable> variable) |
|
|||
274 | { |
|
|||
275 | auto abstractPlotableItPair = impl->m_VariableToPlotMultiMap.equal_range(variable); |
|
|||
276 |
|
||||
277 | auto abstractPlotableVect = QVector<QCPAbstractPlottable *>{}; |
|
|||
278 |
|
||||
279 | for (auto it = abstractPlotableItPair.first; it != abstractPlotableItPair.second; ++it) { |
|
|||
280 | abstractPlotableVect.push_back(it->second); |
|
|||
281 | } |
|
|||
282 |
|
||||
283 | VisualizationGraphHelper::updateData(abstractPlotableVect, variable->dataSeries(), |
|
|||
284 | variable->dateTime()); |
|
|||
285 | } |
|
307 | } |
@@ -1,143 +1,152 | |||||
1 | #include "Visualization/VisualizationWidget.h" |
|
1 | #include "Visualization/VisualizationWidget.h" | |
2 | #include "Visualization/IVisualizationWidgetVisitor.h" |
|
2 | #include "Visualization/IVisualizationWidgetVisitor.h" | |
3 | #include "Visualization/VisualizationGraphWidget.h" |
|
3 | #include "Visualization/VisualizationGraphWidget.h" | |
4 | #include "Visualization/VisualizationTabWidget.h" |
|
4 | #include "Visualization/VisualizationTabWidget.h" | |
5 | #include "Visualization/VisualizationZoneWidget.h" |
|
5 | #include "Visualization/VisualizationZoneWidget.h" | |
6 | #include "Visualization/operations/GenerateVariableMenuOperation.h" |
|
6 | #include "Visualization/operations/GenerateVariableMenuOperation.h" | |
7 | #include "Visualization/operations/RemoveVariableOperation.h" |
|
7 | #include "Visualization/operations/RemoveVariableOperation.h" | |
|
8 | #include "Visualization/operations/RescaleAxeOperation.h" | |||
8 | #include "Visualization/qcustomplot.h" |
|
9 | #include "Visualization/qcustomplot.h" | |
9 |
|
10 | |||
10 | #include "ui_VisualizationWidget.h" |
|
11 | #include "ui_VisualizationWidget.h" | |
11 |
|
12 | |||
12 | #include <QToolButton> |
|
13 | #include <QToolButton> | |
13 |
|
14 | |||
14 | Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget") |
|
15 | Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget") | |
15 |
|
16 | |||
16 | VisualizationWidget::VisualizationWidget(QWidget *parent) |
|
17 | VisualizationWidget::VisualizationWidget(QWidget *parent) | |
17 | : QWidget{parent}, ui{new Ui::VisualizationWidget} |
|
18 | : QWidget{parent}, ui{new Ui::VisualizationWidget} | |
18 | { |
|
19 | { | |
19 | ui->setupUi(this); |
|
20 | ui->setupUi(this); | |
20 |
|
21 | |||
21 | auto addTabViewButton = new QToolButton{ui->tabWidget}; |
|
22 | auto addTabViewButton = new QToolButton{ui->tabWidget}; | |
22 | addTabViewButton->setText(tr("Add View")); |
|
23 | addTabViewButton->setText(tr("Add View")); | |
23 | addTabViewButton->setCursor(Qt::ArrowCursor); |
|
24 | addTabViewButton->setCursor(Qt::ArrowCursor); | |
24 | ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner); |
|
25 | ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner); | |
25 |
|
26 | |||
26 | auto enableMinimumCornerWidgetSize = [this](bool enable) { |
|
27 | auto enableMinimumCornerWidgetSize = [this](bool enable) { | |
27 |
|
28 | |||
28 | auto tabViewCornerWidget = ui->tabWidget->cornerWidget(); |
|
29 | auto tabViewCornerWidget = ui->tabWidget->cornerWidget(); | |
29 | auto width = enable ? tabViewCornerWidget->width() : 0; |
|
30 | auto width = enable ? tabViewCornerWidget->width() : 0; | |
30 | auto height = enable ? tabViewCornerWidget->height() : 0; |
|
31 | auto height = enable ? tabViewCornerWidget->height() : 0; | |
31 | tabViewCornerWidget->setMinimumHeight(height); |
|
32 | tabViewCornerWidget->setMinimumHeight(height); | |
32 | tabViewCornerWidget->setMinimumWidth(width); |
|
33 | tabViewCornerWidget->setMinimumWidth(width); | |
33 | ui->tabWidget->setMinimumHeight(height); |
|
34 | ui->tabWidget->setMinimumHeight(height); | |
34 | ui->tabWidget->setMinimumWidth(width); |
|
35 | ui->tabWidget->setMinimumWidth(width); | |
35 | }; |
|
36 | }; | |
36 |
|
37 | |||
37 | auto addTabView = [this, enableMinimumCornerWidgetSize]() { |
|
38 | auto addTabView = [this, enableMinimumCornerWidgetSize]() { | |
38 | auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1), |
|
39 | auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1), | |
39 | ui->tabWidget}; |
|
40 | ui->tabWidget}; | |
40 | auto index = ui->tabWidget->addTab(widget, widget->name()); |
|
41 | auto index = ui->tabWidget->addTab(widget, widget->name()); | |
41 | if (ui->tabWidget->count() > 0) { |
|
42 | if (ui->tabWidget->count() > 0) { | |
42 | enableMinimumCornerWidgetSize(false); |
|
43 | enableMinimumCornerWidgetSize(false); | |
43 | } |
|
44 | } | |
44 | qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index); |
|
45 | qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index); | |
45 | }; |
|
46 | }; | |
46 |
|
47 | |||
47 | auto removeTabView = [this, enableMinimumCornerWidgetSize](int index) { |
|
48 | auto removeTabView = [this, enableMinimumCornerWidgetSize](int index) { | |
48 | if (ui->tabWidget->count() == 1) { |
|
49 | if (ui->tabWidget->count() == 1) { | |
49 | enableMinimumCornerWidgetSize(true); |
|
50 | enableMinimumCornerWidgetSize(true); | |
50 | } |
|
51 | } | |
51 |
|
52 | |||
52 | // Removes widget from tab and closes it |
|
53 | // Removes widget from tab and closes it | |
53 | auto widget = ui->tabWidget->widget(index); |
|
54 | auto widget = ui->tabWidget->widget(index); | |
54 | ui->tabWidget->removeTab(index); |
|
55 | ui->tabWidget->removeTab(index); | |
55 | if (widget) { |
|
56 | if (widget) { | |
56 | widget->close(); |
|
57 | widget->close(); | |
57 | } |
|
58 | } | |
58 |
|
59 | |||
59 | qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index); |
|
60 | qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index); | |
60 |
|
61 | |||
61 | }; |
|
62 | }; | |
62 |
|
63 | |||
63 | ui->tabWidget->setTabsClosable(true); |
|
64 | ui->tabWidget->setTabsClosable(true); | |
64 |
|
65 | |||
65 | connect(addTabViewButton, &QToolButton::clicked, addTabView); |
|
66 | connect(addTabViewButton, &QToolButton::clicked, addTabView); | |
66 | connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView); |
|
67 | connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView); | |
67 |
|
68 | |||
68 | // Adds default tab |
|
69 | // Adds default tab | |
69 | addTabView(); |
|
70 | addTabView(); | |
70 | } |
|
71 | } | |
71 |
|
72 | |||
72 | VisualizationWidget::~VisualizationWidget() |
|
73 | VisualizationWidget::~VisualizationWidget() | |
73 | { |
|
74 | { | |
74 | delete ui; |
|
75 | delete ui; | |
75 | } |
|
76 | } | |
76 |
|
77 | |||
77 | void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor) |
|
78 | void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor) | |
78 | { |
|
79 | { | |
79 | if (visitor) { |
|
80 | if (visitor) { | |
80 | visitor->visitEnter(this); |
|
81 | visitor->visitEnter(this); | |
81 |
|
82 | |||
82 | // Apply visitor for tab children |
|
83 | // Apply visitor for tab children | |
83 | for (auto i = 0; i < ui->tabWidget->count(); ++i) { |
|
84 | for (auto i = 0; i < ui->tabWidget->count(); ++i) { | |
84 | // Widgets different from tabs are not visited (no action) |
|
85 | // Widgets different from tabs are not visited (no action) | |
85 | if (auto visualizationTabWidget |
|
86 | if (auto visualizationTabWidget | |
86 | = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) { |
|
87 | = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) { | |
87 | visualizationTabWidget->accept(visitor); |
|
88 | visualizationTabWidget->accept(visitor); | |
88 | } |
|
89 | } | |
89 | } |
|
90 | } | |
90 |
|
91 | |||
91 | visitor->visitLeave(this); |
|
92 | visitor->visitLeave(this); | |
92 | } |
|
93 | } | |
93 | else { |
|
94 | else { | |
94 | qCCritical(LOG_VisualizationWidget()) << tr("Can't visit widget : the visitor is null"); |
|
95 | qCCritical(LOG_VisualizationWidget()) << tr("Can't visit widget : the visitor is null"); | |
95 | } |
|
96 | } | |
96 | } |
|
97 | } | |
97 |
|
98 | |||
98 | bool VisualizationWidget::canDrop(const Variable &variable) const |
|
99 | bool VisualizationWidget::canDrop(const Variable &variable) const | |
99 | { |
|
100 | { | |
100 | // The main widget can never accomodate a variable |
|
101 | // The main widget can never accomodate a variable | |
101 | Q_UNUSED(variable); |
|
102 | Q_UNUSED(variable); | |
102 | return false; |
|
103 | return false; | |
103 | } |
|
104 | } | |
104 |
|
105 | |||
105 | bool VisualizationWidget::contains(const Variable &variable) const |
|
106 | bool VisualizationWidget::contains(const Variable &variable) const | |
106 | { |
|
107 | { | |
107 | Q_UNUSED(variable); |
|
108 | Q_UNUSED(variable); | |
108 | return false; |
|
109 | return false; | |
109 | } |
|
110 | } | |
110 |
|
111 | |||
111 | QString VisualizationWidget::name() const |
|
112 | QString VisualizationWidget::name() const | |
112 | { |
|
113 | { | |
113 | return QStringLiteral("MainView"); |
|
114 | return QStringLiteral("MainView"); | |
114 | } |
|
115 | } | |
115 |
|
116 | |||
116 | void VisualizationWidget::attachVariableMenu( |
|
117 | void VisualizationWidget::attachVariableMenu( | |
117 | QMenu *menu, const QVector<std::shared_ptr<Variable> > &variables) noexcept |
|
118 | QMenu *menu, const QVector<std::shared_ptr<Variable> > &variables) noexcept | |
118 | { |
|
119 | { | |
119 | // Menu is generated only if there is a single variable |
|
120 | // Menu is generated only if there is a single variable | |
120 | if (variables.size() == 1) { |
|
121 | if (variables.size() == 1) { | |
121 | if (auto variable = variables.first()) { |
|
122 | if (auto variable = variables.first()) { | |
122 | // Generates the actions that make it possible to visualize the variable |
|
123 | // Generates the actions that make it possible to visualize the variable | |
123 | auto generateVariableMenuOperation = GenerateVariableMenuOperation{menu, variable}; |
|
124 | auto generateVariableMenuOperation = GenerateVariableMenuOperation{menu, variable}; | |
124 | accept(&generateVariableMenuOperation); |
|
125 | accept(&generateVariableMenuOperation); | |
125 | } |
|
126 | } | |
126 | else { |
|
127 | else { | |
127 | qCCritical(LOG_VisualizationWidget()) << tr( |
|
128 | qCCritical(LOG_VisualizationWidget()) << tr( | |
128 | "Can't generate the menu relative to the visualization: the variable is null"); |
|
129 | "Can't generate the menu relative to the visualization: the variable is null"); | |
129 | } |
|
130 | } | |
130 | } |
|
131 | } | |
131 | else { |
|
132 | else { | |
132 | qCDebug(LOG_VisualizationWidget()) |
|
133 | qCDebug(LOG_VisualizationWidget()) | |
133 | << tr("No generation of the menu related to the visualization: several variables are " |
|
134 | << tr("No generation of the menu related to the visualization: several variables are " | |
134 | "selected"); |
|
135 | "selected"); | |
135 | } |
|
136 | } | |
136 | } |
|
137 | } | |
137 |
|
138 | |||
138 | void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept |
|
139 | void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept | |
139 | { |
|
140 | { | |
140 | // Calls the operation of removing all references to the variable in the visualization |
|
141 | // Calls the operation of removing all references to the variable in the visualization | |
141 | auto removeVariableOperation = RemoveVariableOperation{variable}; |
|
142 | auto removeVariableOperation = RemoveVariableOperation{variable}; | |
142 | accept(&removeVariableOperation); |
|
143 | accept(&removeVariableOperation); | |
143 | } |
|
144 | } | |
|
145 | ||||
|
146 | void VisualizationWidget::onRangeChanged(std::shared_ptr<Variable> variable, | |||
|
147 | const SqpDateTime &range) noexcept | |||
|
148 | { | |||
|
149 | // Calls the operation of removing all references to the variable in the visualization | |||
|
150 | auto rescaleVariableOperation = RescaleAxeOperation{variable, range}; | |||
|
151 | accept(&rescaleVariableOperation); | |||
|
152 | } |
General Comments 3
Pull request updated. Auto status change to "Under Review"
Changed commits: * 3 added * 0 removed Changed files: * A plugins/amda/tests-resources/TestAmdaResultParser/FileNotFound.txt * M gui/src/Visualization/operations/RescaleAxeOperation.cpp * M app/src/MainWindow.cpp * M core/include/Data/IDataProvider.h * M core/include/DataSource/DataSourceItemAction.h * M core/include/Variable/VariableController.h * M core/include/Variable/VariableModel.h * M core/include/Visualization/VisualizationController.h * M core/src/Network/NetworkController.cpp * M core/src/Variable/Variable.cpp * M core/src/Variable/VariableController.cpp * M core/src/Variable/VariableModel.cpp * M gui/include/Visualization/VisualizationGraphWidget.h * M gui/include/Visualization/VisualizationWidget.h * M gui/src/SqpApplication.cpp * M gui/src/Variable/VariableInspectorWidget.cpp * M gui/src/Visualization/VisualizationGraphHelper.cpp * M gui/src/Visualization/VisualizationGraphWidget.cpp * M gui/src/Visualization/VisualizationWidget.cpp * M gui/src/Visualization/VisualizationZoneWidget.cpp * M plugins/amda/include/AmdaProvider.h * M plugins/amda/src/AmdaProvider.cpp * M plugins/amda/src/AmdaResultParser.cpp * M plugins/amda/tests/TestAmdaResultParser.cpp * M plugins/mockplugin/include/CosinusProvider.h * M plugins/mockplugin/src/CosinusProvider.cpp * R COPYING * R app/ui/MainWindow.ui * R cmake/sciqlop_package_qt.cmake * R core/include/Common/MetaTypes.h * R core/include/Data/ArrayData.h * R core/include/Data/DataProviderParameters.h * R core/include/Data/DataSeries.h * R core/include/Data/IDataSeries.h * R core/include/Data/ScalarSeries.h * R core/include/Data/SqpDateTime.h * R core/include/Network/NetworkController.h * R core/include/Plugin/PluginManager.h * R core/include/Time/TimeController.h * R core/include/Variable/Variable.h * R core/include/Variable/VariableCacheController.h * R core/src/Data/ScalarSeries.cpp * R core/src/DataSource/DataSourceItemAction.cpp * R core/src/Plugin/PluginManager.cpp * R core/src/Time/TimeController.cpp * R core/src/Variable/VariableCacheController.cpp * R core/src/Visualization/VisualizationController.cpp * R core/tests/Variable/TestVariableCacheController.cpp * R gui/include/DataSource/DataSourceTreeWidgetItem.h * R gui/include/DataSource/DataSourceWidget.h * R gui/include/SidePane/SqpSidePane.h * R gui/include/TimeWidget/TimeWidget.h * R gui/include/Variable/VariableInspectorWidget.h * R gui/include/Variable/VariableMenuHeaderWidget.h * R gui/include/Visualization/IVariableContainer.h * R gui/include/Visualization/IVisualizationWidget.h * R gui/include/Visualization/IVisualizationWidgetVisitor.h * R gui/include/Visualization/VisualizationGraphHelper.h * R gui/include/Visualization/VisualizationTabWidget.h * R gui/include/Visualization/VisualizationZoneWidget.h * R gui/include/Visualization/operations/GenerateVariableMenuOperation.h * R gui/include/Visualization/operations/MenuBuilder.h * R gui/include/Visualization/operations/RemoveVariableOperation.h * R gui/include/Visualization/qcustomplot.h * R gui/resources/icones/dataSourceComponent.png * R gui/resources/icones/dataSourceNode.png * R gui/resources/icones/dataSourceProduct.png * R gui/resources/icones/dataSourceRoot.png * R gui/resources/icones/delete.png * R gui/resources/icones/next.png * R gui/resources/icones/openInspector.png * R gui/resources/icones/plot.png * R gui/resources/icones/previous.png * R gui/resources/icones/sciqlop2PNG_1024.png * R gui/resources/icones/unplot.png * R gui/resources/sqpguiresources.qrc * R gui/src/DataSource/DataSourceTreeWidgetItem.cpp * R gui/src/DataSource/DataSourceWidget.cpp * R gui/src/SidePane/SqpSidePane.cpp * R gui/src/TimeWidget/TimeWidget.cpp * R gui/src/Variable/VariableMenuHeaderWidget.cpp * R gui/src/Visualization/VisualizationTabWidget.cpp * R gui/src/Visualization/operations/GenerateVariableMenuOperation.cpp * R gui/src/Visualization/operations/MenuBuilder.cpp * R gui/src/Visualization/operations/RemoveVariableOperation.cpp * R gui/src/Visualization/qcustomplot.cpp * R gui/ui/DataSource/DataSourceWidget.ui * R gui/ui/SidePane/SqpSidePane.ui * R gui/ui/TimeWidget/TimeWidget.ui * R gui/ui/Variable/VariableInspectorWidget.ui * R gui/ui/Variable/VariableMenuHeaderWidget.ui * R gui/ui/Visualization/VisualizationGraphWidget.ui * R gui/ui/Visualization/VisualizationTabWidget.ui * R gui/ui/Visualization/VisualizationWidget.ui * R gui/ui/Visualization/VisualizationZoneWidget.ui * R gui/vera-exclusions/exclusions.txt * R plugin/CMakeLists.txt * R plugin/cmake/Findsciqlop-plugin.cmake * R plugin/include/Plugin/IPlugin.h * R plugins/amda/CMakeLists.txt * R plugins/amda/cmake/Findsciqlop-amda.cmake * R plugins/amda/include/AmdaDefs.h * R plugins/amda/include/AmdaGlobal.h * R plugins/amda/include/AmdaParser.h * R plugins/amda/include/AmdaPlugin.h * R plugins/amda/include/AmdaResultParser.h * R plugins/amda/resources/amda.json * R plugins/amda/resources/amdaresources.qrc * R plugins/amda/resources/samples/AmdaSample.json * R plugins/amda/src/AmdaDefs.cpp * R plugins/amda/src/AmdaParser.cpp * R plugins/amda/src/AmdaPlugin.cpp * R plugins/amda/tests-resources/TestAmdaParser/TwoRootsFile.json * R plugins/amda/tests-resources/TestAmdaParser/ValidFile1.json * R plugins/amda/tests-resources/TestAmdaParser/WrongRootKey.json * R plugins/amda/tests-resources/TestAmdaParser/WrongRootType.json * R plugins/amda/tests-resources/TestAmdaResultParser/NaNValue.txt * R plugins/amda/tests-resources/TestAmdaResultParser/NoUnit.txt * R plugins/amda/tests-resources/TestAmdaResultParser/TooManyValues.txt * R plugins/amda/tests-resources/TestAmdaResultParser/ValidScalar1.txt * R plugins/amda/tests-resources/TestAmdaResultParser/WrongDate.txt * R plugins/amda/tests-resources/TestAmdaResultParser/WrongUnit.txt * R plugins/amda/tests-resources/TestAmdaResultParser/WrongValue.txt * R plugins/amda/tests/TestAmdaParser.cpp * R plugins/mockplugin/CMakeLists.txt * R plugins/mockplugin/cmake/Findsciqlop-mockplugin.cmake * R plugins/mockplugin/include/MockPlugin.h * R plugins/mockplugin/include/MockPluginGlobal.h * R plugins/mockplugin/resources/mockplugin.json * R plugins/mockplugin/src/MockPlugin.cpp * R README.md * R app/CMakeLists.txt * R app/include/MainWindow.h * R app/src/Main.cpp * R app/vera-exclusions/exclusions.txt * R cmake/sciqlop.cmake * R cmake/sciqlop_applications.cmake * R cmake/sciqlop_package.cmake * R cmake/sciqlop_params.cmake * R core/CMakeLists.txt * R core/include/Common/spimpl.h * R core/include/DataSource/DataSourceController.h * R core/include/DataSource/DataSourceItem.h * R core/src/DataSource/DataSourceController.cpp * R core/src/DataSource/DataSourceItem.cpp * R core/tests/DataSource/TestDataSourceController.cpp * R core/vera-exclusions/exclusions.txt * R formatting/cmake/use_clangformat.cmake * R formatting/vera-exclusions/exclusions.txt * R gui/CMakeLists.txt * R gui/include/SqpApplication.h * R LICENSE * R app/src/mainwindow.cpp * R app/src/mainwindow.ui
Status change > Approved
You need to be logged in to leave comments.
Login now