##// END OF EJS Templates
Merge pull request 220 from SCIQLOP-Initialisation develop...
perrinel -
r523:c61dc4e21f67 merge
parent child
Show More
@@ -0,0 +1,199
1 #include "Data/ArrayData.h"
2 #include <QObject>
3 #include <QtTest>
4
5 class TestOneDimArrayData : public QObject {
6 Q_OBJECT
7 private slots:
8 /// Tests @sa ArrayData::data()
9 void testData_data();
10 void testData();
11
12 /// Tests @sa ArrayData::data(int componentIndex)
13 void testDataByComponentIndex_data();
14 void testDataByComponentIndex();
15
16 /// Tests @sa ArrayData::add()
17 void testAdd_data();
18 void testAdd();
19
20 /// Tests @sa ArrayData::at(int index)
21 void testAt_data();
22 void testAt();
23
24 /// Tests @sa ArrayData::clear()
25 void testClear_data();
26 void testClear();
27
28 /// Tests @sa ArrayData::size()
29 void testSize_data();
30 void testSize();
31
32 /// Tests @sa ArrayData::sort()
33 void testSort_data();
34 void testSort();
35 };
36
37 void TestOneDimArrayData::testData_data()
38 {
39 // Test structure
40 QTest::addColumn<QVector<double> >("inputData"); // array's data input
41 QTest::addColumn<QVector<double> >("expectedData"); // expected data
42
43 // Test cases
44 QTest::newRow("data1") << QVector<double>{1., 2., 3., 4., 5.}
45 << QVector<double>{1., 2., 3., 4., 5.};
46 }
47
48 void TestOneDimArrayData::testData()
49 {
50 QFETCH(QVector<double>, inputData);
51 QFETCH(QVector<double>, expectedData);
52
53 ArrayData<1> arrayData{inputData};
54 QVERIFY(arrayData.data() == expectedData);
55 }
56
57 void TestOneDimArrayData::testDataByComponentIndex_data()
58 {
59 // Test structure
60 QTest::addColumn<QVector<double> >("inputData"); // array data's input
61 QTest::addColumn<int>("componentIndex"); // component index to test
62 QTest::addColumn<QVector<double> >("expectedData"); // expected data
63
64 // Test cases
65 QTest::newRow("validIndex") << QVector<double>{1., 2., 3., 4., 5.} << 0
66 << QVector<double>{1., 2., 3., 4., 5.};
67 QTest::newRow("invalidIndex1")
68 << QVector<double>{1., 2., 3., 4., 5.} << -1 << QVector<double>{};
69 QTest::newRow("invalidIndex2") << QVector<double>{1., 2., 3., 4., 5.} << 1 << QVector<double>{};
70 }
71
72 void TestOneDimArrayData::testDataByComponentIndex()
73 {
74 QFETCH(QVector<double>, inputData);
75 QFETCH(int, componentIndex);
76 QFETCH(QVector<double>, expectedData);
77
78 ArrayData<1> arrayData{inputData};
79 QVERIFY(arrayData.data(componentIndex) == expectedData);
80 }
81
82 void TestOneDimArrayData::testAdd_data()
83 {
84 // Test structure
85 QTest::addColumn<QVector<double> >("inputData"); // array's data input
86 QTest::addColumn<QVector<double> >("otherData"); // array data's input to merge with
87 QTest::addColumn<bool>("prepend"); // prepend or append merge
88 QTest::addColumn<QVector<double> >("expectedData"); // expected data after merge
89
90 // Test cases
91 QTest::newRow("appendMerge") << QVector<double>{1., 2., 3., 4., 5.}
92 << QVector<double>{6., 7., 8.} << false
93 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8.};
94 QTest::newRow("prependMerge") << QVector<double>{1., 2., 3., 4., 5.}
95 << QVector<double>{6., 7., 8.} << true
96 << QVector<double>{6., 7., 8., 1., 2., 3., 4., 5.};
97 }
98
99 void TestOneDimArrayData::testAdd()
100 {
101 QFETCH(QVector<double>, inputData);
102 QFETCH(QVector<double>, otherData);
103 QFETCH(bool, prepend);
104 QFETCH(QVector<double>, expectedData);
105
106 ArrayData<1> arrayData{inputData};
107 ArrayData<1> other{otherData};
108
109 arrayData.add(other, prepend);
110 QVERIFY(arrayData.data() == expectedData);
111 }
112
113 void TestOneDimArrayData::testAt_data()
114 {
115 // Test structure
116 QTest::addColumn<QVector<double> >("inputData"); // array data's input
117 QTest::addColumn<int>("index"); // index to retrieve data
118 QTest::addColumn<double>("expectedData"); // expected data at index
119
120 // Test cases
121 QTest::newRow("data1") << QVector<double>{1., 2., 3., 4., 5.} << 0 << 1.;
122 QTest::newRow("data2") << QVector<double>{1., 2., 3., 4., 5.} << 3 << 4.;
123 }
124
125 void TestOneDimArrayData::testAt()
126 {
127 QFETCH(QVector<double>, inputData);
128 QFETCH(int, index);
129 QFETCH(double, expectedData);
130
131 ArrayData<1> arrayData{inputData};
132 QVERIFY(arrayData.at(index) == expectedData);
133 }
134
135 void TestOneDimArrayData::testClear_data()
136 {
137 // Test structure
138 QTest::addColumn<QVector<double> >("inputData"); // array data's input
139
140 // Test cases
141 QTest::newRow("data1") << QVector<double>{1., 2., 3., 4., 5.};
142 }
143
144 void TestOneDimArrayData::testClear()
145 {
146 QFETCH(QVector<double>, inputData);
147
148 ArrayData<1> arrayData{inputData};
149 arrayData.clear();
150 QVERIFY(arrayData.data() == QVector<double>{});
151 }
152
153 void TestOneDimArrayData::testSize_data()
154 {
155 // Test structure
156 QTest::addColumn<QVector<double> >("inputData"); // array data's input
157 QTest::addColumn<int>("expectedSize"); // expected array data size
158
159 // Test cases
160 QTest::newRow("data1") << QVector<double>{1., 2., 3., 4., 5.} << 5;
161 }
162
163 void TestOneDimArrayData::testSize()
164 {
165 QFETCH(QVector<double>, inputData);
166 QFETCH(int, expectedSize);
167
168 ArrayData<1> arrayData{inputData};
169 QVERIFY(arrayData.size() == expectedSize);
170 }
171
172 void TestOneDimArrayData::testSort_data()
173 {
174 // Test structure
175 QTest::addColumn<QVector<double> >("inputData"); // array data's input
176 QTest::addColumn<std::vector<int> >("sortPermutation"); // permutation used to sort data
177 QTest::addColumn<QVector<double> >("expectedData"); // expected data after sorting
178
179 // Test cases
180 QTest::newRow("data1") << QVector<double>{1., 2., 3., 4., 5.} << std::vector<int>{0, 2, 3, 1, 4}
181 << QVector<double>{1., 3., 4., 2., 5.};
182 QTest::newRow("data2") << QVector<double>{1., 2., 3., 4., 5.} << std::vector<int>{4, 1, 2, 3, 0}
183 << QVector<double>{5., 2., 3., 4., 1.};
184 }
185
186 void TestOneDimArrayData::testSort()
187 {
188 QFETCH(QVector<double>, inputData);
189 QFETCH(std::vector<int>, sortPermutation);
190 QFETCH(QVector<double>, expectedData);
191
192 ArrayData<1> arrayData{inputData};
193 auto sortedArrayData = arrayData.sort(sortPermutation);
194 QVERIFY(sortedArrayData);
195 QVERIFY(sortedArrayData->data() == expectedData);
196 }
197
198 QTEST_MAIN(TestOneDimArrayData)
199 #include "TestOneDimArrayData.moc"
@@ -0,0 +1,224
1 #include "Data/ArrayData.h"
2 #include <QObject>
3 #include <QtTest>
4
5 using DataContainer = QVector<QVector<double> >;
6
7 class TestTwoDimArrayData : public QObject {
8 Q_OBJECT
9 private slots:
10 /// Tests @sa ArrayData::data(int componentIndex)
11 void testDataByComponentIndex_data();
12 void testDataByComponentIndex();
13
14 /// Tests @sa ArrayData ctor
15 void testCtor_data();
16 void testCtor();
17
18 /// Tests @sa ArrayData::add()
19 void testAdd_data();
20 void testAdd();
21
22 /// Tests @sa ArrayData::clear()
23 void testClear_data();
24 void testClear();
25
26 /// Tests @sa ArrayData::size()
27 void testSize_data();
28 void testSize();
29
30 /// Tests @sa ArrayData::sort()
31 void testSort_data();
32 void testSort();
33 };
34
35 void TestTwoDimArrayData::testDataByComponentIndex_data()
36 {
37 // Test structure
38 QTest::addColumn<DataContainer>("inputData"); // array data's input
39 QTest::addColumn<int>("componentIndex"); // component index to test
40 QTest::addColumn<QVector<double> >("expectedData"); // expected data
41
42 // Test cases
43 auto inputData
44 = DataContainer{{1., 2., 3., 4., 5.}, {6., 7., 8., 9., 10.}, {11., 12., 13., 14., 15.}};
45
46 QTest::newRow("validIndex1") << inputData << 0 << QVector<double>{1., 2., 3., 4., 5.};
47 QTest::newRow("validIndex2") << inputData << 1 << QVector<double>{6., 7., 8., 9., 10.};
48 QTest::newRow("validIndex3") << inputData << 2 << QVector<double>{11., 12., 13., 14., 15.};
49 QTest::newRow("invalidIndex1") << inputData << -1 << QVector<double>{};
50 QTest::newRow("invalidIndex2") << inputData << 3 << QVector<double>{};
51 }
52
53 void TestTwoDimArrayData::testDataByComponentIndex()
54 {
55 QFETCH(DataContainer, inputData);
56 QFETCH(int, componentIndex);
57 QFETCH(QVector<double>, expectedData);
58
59 ArrayData<2> arrayData{inputData};
60 QVERIFY(arrayData.data(componentIndex) == expectedData);
61 }
62
63 void TestTwoDimArrayData::testCtor_data()
64 {
65 // Test structure
66 QTest::addColumn<DataContainer>("inputData"); // array data's input
67 QTest::addColumn<bool>("success"); // array data has been successfully constructed
68 QTest::addColumn<DataContainer>("expectedData"); // expected array data (when success)
69
70 // Test cases
71 QTest::newRow("validInput")
72 << DataContainer{{1., 2., 3., 4., 5.}, {6., 7., 8., 9., 10.}, {11., 12., 13., 14., 15.}}
73 << true
74 << DataContainer{{1., 2., 3., 4., 5.}, {6., 7., 8., 9., 10.}, {11., 12., 13., 14., 15.}};
75 QTest::newRow("malformedInput (components of the array data haven't the same size")
76 << DataContainer{{1., 2., 3., 4., 5.}, {6., 7., 8.}, {11., 12.}} << true
77 << DataContainer{{}, {}, {}};
78 QTest::newRow("invalidInput (less than tow components")
79 << DataContainer{{1., 2., 3., 4., 5.}} << false << DataContainer{{}, {}, {}};
80 }
81
82 void TestTwoDimArrayData::testCtor()
83 {
84 QFETCH(DataContainer, inputData);
85 QFETCH(bool, success);
86
87 if (success) {
88 QFETCH(DataContainer, expectedData);
89
90 ArrayData<2> arrayData{inputData};
91
92 for (auto i = 0; i < expectedData.size(); ++i) {
93 QVERIFY(arrayData.data(i) == expectedData.at(i));
94 }
95 }
96 else {
97 QVERIFY_EXCEPTION_THROWN(ArrayData<2> arrayData{inputData}, std::invalid_argument);
98 }
99 }
100
101 void TestTwoDimArrayData::testAdd_data()
102 {
103 // Test structure
104 QTest::addColumn<DataContainer>("inputData"); // array's data input
105 QTest::addColumn<DataContainer>("otherData"); // array data's input to merge with
106 QTest::addColumn<bool>("prepend"); // prepend or append merge
107 QTest::addColumn<DataContainer>("expectedData"); // expected data after merge
108
109 // Test cases
110 auto inputData
111 = DataContainer{{1., 2., 3., 4., 5.}, {11., 12., 13., 14., 15.}, {21., 22., 23., 24., 25.}};
112
113 auto vectorContainer = DataContainer{{6., 7., 8.}, {16., 17., 18.}, {26., 27., 28}};
114 auto tensorContainer = DataContainer{{6., 7., 8.}, {16., 17., 18.}, {26., 27., 28},
115 {36., 37., 38.}, {46., 47., 48.}, {56., 57., 58}};
116
117 QTest::newRow("appendMerge") << inputData << vectorContainer << false
118 << DataContainer{{1., 2., 3., 4., 5., 6., 7., 8.},
119 {11., 12., 13., 14., 15., 16., 17., 18.},
120 {21., 22., 23., 24., 25., 26., 27., 28}};
121 QTest::newRow("prependMerge") << inputData << vectorContainer << true
122 << DataContainer{{6., 7., 8., 1., 2., 3., 4., 5.},
123 {16., 17., 18., 11., 12., 13., 14., 15.},
124 {26., 27., 28, 21., 22., 23., 24., 25.}};
125 QTest::newRow("invalidMerge") << inputData << tensorContainer << false << inputData;
126 }
127
128 void TestTwoDimArrayData::testAdd()
129 {
130 QFETCH(DataContainer, inputData);
131 QFETCH(DataContainer, otherData);
132 QFETCH(bool, prepend);
133 QFETCH(DataContainer, expectedData);
134
135 ArrayData<2> arrayData{inputData};
136 ArrayData<2> other{otherData};
137
138 arrayData.add(other, prepend);
139
140 for (auto i = 0; i < expectedData.size(); ++i) {
141 QVERIFY(arrayData.data(i) == expectedData.at(i));
142 }
143 }
144
145 void TestTwoDimArrayData::testClear_data()
146 {
147 // Test structure
148 QTest::addColumn<DataContainer>("inputData"); // array data's input
149
150 // Test cases
151 QTest::newRow("data1") << DataContainer{
152 {1., 2., 3., 4., 5.}, {6., 7., 8., 9., 10.}, {11., 12., 13., 14., 15.}};
153 }
154
155 void TestTwoDimArrayData::testClear()
156 {
157 QFETCH(DataContainer, inputData);
158
159 ArrayData<2> arrayData{inputData};
160 arrayData.clear();
161
162 for (auto i = 0; i < inputData.size(); ++i) {
163 QVERIFY(arrayData.data(i) == QVector<double>{});
164 }
165 }
166
167 void TestTwoDimArrayData::testSize_data()
168 {
169 // Test structure
170 QTest::addColumn<QVector<QVector<double> > >("inputData"); // array data's input
171 QTest::addColumn<int>("expectedSize"); // expected array data size
172
173 // Test cases
174 QTest::newRow("data1") << DataContainer{{1., 2., 3., 4., 5.}, {6., 7., 8., 9., 10.}} << 5;
175 QTest::newRow("data2") << DataContainer{{1., 2., 3., 4., 5.},
176 {6., 7., 8., 9., 10.},
177 {11., 12., 13., 14., 15.}}
178 << 5;
179 }
180
181 void TestTwoDimArrayData::testSize()
182 {
183 QFETCH(DataContainer, inputData);
184 QFETCH(int, expectedSize);
185
186 ArrayData<2> arrayData{inputData};
187 QVERIFY(arrayData.size() == expectedSize);
188 }
189
190 void TestTwoDimArrayData::testSort_data()
191 {
192 // Test structure
193 QTest::addColumn<DataContainer>("inputData"); // array data's input
194 QTest::addColumn<std::vector<int> >("sortPermutation"); // permutation used to sort data
195 QTest::addColumn<DataContainer>("expectedData"); // expected data after sorting
196
197 // Test cases
198 QTest::newRow("data1")
199 << DataContainer{{1., 2., 3., 4., 5.}, {6., 7., 8., 9., 10.}, {11., 12., 13., 14., 15.}}
200 << std::vector<int>{0, 2, 3, 1, 4}
201 << DataContainer{{1., 3., 4., 2., 5.}, {6., 8., 9., 7., 10.}, {11., 13., 14., 12., 15.}};
202 QTest::newRow("data2")
203 << DataContainer{{1., 2., 3., 4., 5.}, {6., 7., 8., 9., 10.}, {11., 12., 13., 14., 15.}}
204 << std::vector<int>{2, 4, 3, 0, 1}
205 << DataContainer{{3., 5., 4., 1., 2.}, {8., 10., 9., 6., 7.}, {13., 15., 14., 11., 12.}};
206 }
207
208 void TestTwoDimArrayData::testSort()
209 {
210 QFETCH(DataContainer, inputData);
211 QFETCH(std::vector<int>, sortPermutation);
212 QFETCH(DataContainer, expectedData);
213
214 ArrayData<2> arrayData{inputData};
215 auto sortedArrayData = arrayData.sort(sortPermutation);
216 QVERIFY(sortedArrayData);
217
218 for (auto i = 0; i < expectedData.size(); ++i) {
219 QVERIFY(sortedArrayData->data(i) == expectedData.at(i));
220 }
221 }
222
223 QTEST_MAIN(TestTwoDimArrayData)
224 #include "TestTwoDimArrayData.moc"
@@ -202,8 +202,8 MainWindow::MainWindow(QWidget *parent)
202 // /////////// //
202 // /////////// //
203
203
204 // Controllers / controllers connections
204 // Controllers / controllers connections
205 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)),
205 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpRange)), &sqpApp->variableController(),
206 &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime)));
206 SLOT(onDateTimeOnSelection(SqpRange)));
207
207
208 // Widgets / controllers connections
208 // Widgets / controllers connections
209
209
@@ -212,8 +212,8 MainWindow::MainWindow(QWidget *parent)
212 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
212 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
213
213
214 // Time
214 // Time
215 connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(),
215 connect(timeWidget, SIGNAL(timeUpdated(SqpRange)), &sqpApp->timeController(),
216 SLOT(onTimeToUpdate(SqpDateTime)));
216 SLOT(onTimeToUpdate(SqpRange)));
217
217
218 // Visualization
218 // Visualization
219 connect(&sqpApp->visualizationController(),
219 connect(&sqpApp->visualizationController(),
@@ -221,8 +221,8 MainWindow::MainWindow(QWidget *parent)
221 SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>)));
221 SLOT(onVariableAboutToBeDeleted(std::shared_ptr<Variable>)));
222
222
223 connect(&sqpApp->visualizationController(),
223 connect(&sqpApp->visualizationController(),
224 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)), m_Ui->view,
224 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)), m_Ui->view,
225 SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)));
225 SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpRange &)));
226
226
227 // Widgets / widgets connections
227 // Widgets / widgets connections
228
228
@@ -1,7 +1,7
1 #ifndef SCIQLOP_DATAPROVIDERPARAMETERS_H
1 #ifndef SCIQLOP_DATAPROVIDERPARAMETERS_H
2 #define SCIQLOP_DATAPROVIDERPARAMETERS_H
2 #define SCIQLOP_DATAPROVIDERPARAMETERS_H
3
3
4 #include "SqpDateTime.h"
4 #include "SqpRange.h"
5
5
6 /**
6 /**
7 * @brief The DataProviderParameters struct holds the information needed to retrieve data from a
7 * @brief The DataProviderParameters struct holds the information needed to retrieve data from a
@@ -10,7 +10,7
10 */
10 */
11 struct DataProviderParameters {
11 struct DataProviderParameters {
12 /// Times for which retrieve data
12 /// Times for which retrieve data
13 QVector<SqpDateTime> m_Times;
13 QVector<SqpRange> m_Times;
14 /// Extra data that can be used by the provider to retrieve data
14 /// Extra data that can be used by the provider to retrieve data
15 QVariantHash m_Data;
15 QVariantHash m_Data;
16 };
16 };
@@ -10,7 +10,7
10
10
11 #include <Common/MetaTypes.h>
11 #include <Common/MetaTypes.h>
12
12
13 #include <Data/SqpDateTime.h>
13 #include <Data/SqpRange.h>
14
14
15 #include <functional>
15 #include <functional>
16
16
@@ -49,7 +49,7 signals:
49 * identified by identifier
49 * identified by identifier
50 */
50 */
51 void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie,
51 void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie,
52 const SqpDateTime &dateTime);
52 const SqpRange &dateTime);
53
53
54 /**
54 /**
55 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
55 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
@@ -1,5 +1,5
1 #ifndef SCIQLOP_SQPDATETIME_H
1 #ifndef SCIQLOP_SQPRANGE_H
2 #define SCIQLOP_SQPDATETIME_H
2 #define SCIQLOP_SQPRANGE_H
3
3
4 #include <QObject>
4 #include <QObject>
5
5
@@ -9,26 +9,26
9 #include <Common/MetaTypes.h>
9 #include <Common/MetaTypes.h>
10
10
11 /**
11 /**
12 * @brief The SqpDateTime struct holds the information of time parameters
12 * @brief The SqpRange struct holds the information of time parameters
13 */
13 */
14 struct SqpDateTime {
14 struct SqpRange {
15 /// Start time (UTC)
15 /// Start time (UTC)
16 double m_TStart;
16 double m_TStart;
17 /// End time (UTC)
17 /// End time (UTC)
18 double m_TEnd;
18 double m_TEnd;
19
19
20 bool contains(const SqpDateTime &dateTime) const noexcept
20 bool contains(const SqpRange &dateTime) const noexcept
21 {
21 {
22 return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd);
22 return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd);
23 }
23 }
24
24
25 bool intersect(const SqpDateTime &dateTime) const noexcept
25 bool intersect(const SqpRange &dateTime) const noexcept
26 {
26 {
27 return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd);
27 return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd);
28 }
28 }
29 };
29 };
30
30
31 inline QDebug operator<<(QDebug d, SqpDateTime obj)
31 inline QDebug operator<<(QDebug d, SqpRange obj)
32 {
32 {
33 auto tendDateTimeStart = DateUtils::dateTime(obj.m_TStart);
33 auto tendDateTimeStart = DateUtils::dateTime(obj.m_TStart);
34 auto tendDateTimeEnd = DateUtils::dateTime(obj.m_TEnd);
34 auto tendDateTimeEnd = DateUtils::dateTime(obj.m_TEnd);
@@ -38,6 +38,6 inline QDebug operator<<(QDebug d, SqpDateTime obj)
38 }
38 }
39
39
40 // Required for using shared_ptr in signals/slots
40 // Required for using shared_ptr in signals/slots
41 SCIQLOP_REGISTER_META_TYPE(SQPDATETIME_REGISTRY, SqpDateTime)
41 SCIQLOP_REGISTER_META_TYPE(SQPRANGE_REGISTRY, SqpRange)
42
42
43 #endif // SCIQLOP_SQPDATETIME_H
43 #endif // SCIQLOP_SQPRANGE_H
@@ -3,7 +3,7
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Data/SqpDateTime.h>
6 #include <Data/SqpRange.h>
7
7
8 #include <QLoggingCategory>
8 #include <QLoggingCategory>
9 #include <QObject>
9 #include <QObject>
@@ -21,15 +21,15 class SCIQLOP_CORE_EXPORT TimeController : public QObject {
21 public:
21 public:
22 explicit TimeController(QObject *parent = 0);
22 explicit TimeController(QObject *parent = 0);
23
23
24 SqpDateTime dateTime() const noexcept;
24 SqpRange dateTime() const noexcept;
25
25
26 signals:
26 signals:
27 /// Signal emitted to notify that time parameters has beed updated
27 /// Signal emitted to notify that time parameters has beed updated
28 void timeUpdated(SqpDateTime time);
28 void timeUpdated(SqpRange time);
29
29
30 public slots:
30 public slots:
31 /// Slot called when a new dateTime has been defined.
31 /// Slot called when a new dateTime has been defined.
32 void onTimeToUpdate(SqpDateTime dateTime);
32 void onTimeToUpdate(SqpRange dateTime);
33
33
34 /// Slot called when the dateTime has to be notified. Call timeUpdated signal
34 /// Slot called when the dateTime has to be notified. Call timeUpdated signal
35 void onTimeNotify();
35 void onTimeNotify();
@@ -3,7 +3,7
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Data/SqpDateTime.h>
6 #include <Data/SqpRange.h>
7
7
8 #include <QLoggingCategory>
8 #include <QLoggingCategory>
9 #include <QObject>
9 #include <QObject>
@@ -24,21 +24,21 class SCIQLOP_CORE_EXPORT Variable : public QObject {
24 Q_OBJECT
24 Q_OBJECT
25
25
26 public:
26 public:
27 explicit Variable(const QString &name, const SqpDateTime &dateTime,
27 explicit Variable(const QString &name, const SqpRange &dateTime,
28 const QVariantHash &metadata = {});
28 const QVariantHash &metadata = {});
29
29
30 QString name() const noexcept;
30 QString name() const noexcept;
31 SqpDateTime dateTime() const noexcept;
31 SqpRange dateTime() const noexcept;
32 void setDateTime(const SqpDateTime &dateTime) noexcept;
32 void setDateTime(const SqpRange &dateTime) noexcept;
33
33
34 /// @return the data of the variable, nullptr if there is no data
34 /// @return the data of the variable, nullptr if there is no data
35 IDataSeries *dataSeries() const noexcept;
35 IDataSeries *dataSeries() const noexcept;
36
36
37 QVariantHash metadata() const noexcept;
37 QVariantHash metadata() const noexcept;
38
38
39 bool contains(const SqpDateTime &dateTime) const noexcept;
39 bool contains(const SqpRange &dateTime) const noexcept;
40 bool intersect(const SqpDateTime &dateTime) const noexcept;
40 bool intersect(const SqpRange &dateTime) const noexcept;
41 bool isInside(const SqpDateTime &dateTime) const noexcept;
41 bool isInside(const SqpRange &dateTime) const noexcept;
42
42
43 public slots:
43 public slots:
44 void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
44 void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
@@ -6,7 +6,7
6 #include <QLoggingCategory>
6 #include <QLoggingCategory>
7 #include <QObject>
7 #include <QObject>
8
8
9 #include <Data/SqpDateTime.h>
9 #include <Data/SqpRange.h>
10
10
11 #include <QLoggingCategory>
11 #include <QLoggingCategory>
12
12
@@ -23,17 +23,17 public:
23 explicit VariableCacheController(QObject *parent = 0);
23 explicit VariableCacheController(QObject *parent = 0);
24
24
25
25
26 void addDateTime(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime);
26 void addDateTime(std::shared_ptr<Variable> variable, const SqpRange &dateTime);
27
27
28 /// Clears cache concerning a variable
28 /// Clears cache concerning a variable
29 void clear(std::shared_ptr<Variable> variable) noexcept;
29 void clear(std::shared_ptr<Variable> variable) noexcept;
30
30
31 /// Return all of the SqpDataTime part of the dateTime whose are not in the cache
31 /// Return all of the SqpDataTime part of the dateTime whose are not in the cache
32 QVector<SqpDateTime> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
32 QVector<SqpRange> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
33 const SqpDateTime &dateTime);
33 const SqpRange &dateTime);
34
34
35
35
36 QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept;
36 QVector<SqpRange> dateCacheList(std::shared_ptr<Variable> variable) const noexcept;
37
37
38 void displayCache(std::shared_ptr<Variable> variable) const;
38 void displayCache(std::shared_ptr<Variable> variable) const;
39
39
@@ -3,7 +3,7
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Data/SqpDateTime.h>
6 #include <Data/SqpRange.h>
7
7
8 #include <QLoggingCategory>
8 #include <QLoggingCategory>
9 #include <QObject>
9 #include <QObject>
@@ -62,11 +62,11 signals:
62 void variableAboutToBeDeleted(std::shared_ptr<Variable> variable);
62 void variableAboutToBeDeleted(std::shared_ptr<Variable> variable);
63
63
64 /// Signal emitted when a data acquisition is requested on a range for a variable
64 /// Signal emitted when a data acquisition is requested on a range for a variable
65 void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range);
65 void rangeChanged(std::shared_ptr<Variable> variable, const SqpRange &range);
66
66
67 public slots:
67 public slots:
68 /// Request the data loading of the variable whithin dateTime
68 /// Request the data loading of the variable whithin dateTime
69 void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime);
69 void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpRange &dateTime);
70 /**
70 /**
71 * Creates a new variable and adds it to the model
71 * Creates a new variable and adds it to the model
72 * @param name the name of the new variable
72 * @param name the name of the new variable
@@ -77,7 +77,7 public slots:
77 std::shared_ptr<IDataProvider> provider) noexcept;
77 std::shared_ptr<IDataProvider> provider) noexcept;
78
78
79 /// Update the temporal parameters of every selected variable to dateTime
79 /// Update the temporal parameters of every selected variable to dateTime
80 void onDateTimeOnSelection(const SqpDateTime &dateTime);
80 void onDateTimeOnSelection(const SqpRange &dateTime);
81
81
82
82
83 void onVariableRetrieveDataInProgress(QUuid identifier, double progress);
83 void onVariableRetrieveDataInProgress(QUuid identifier, double progress);
@@ -3,7 +3,7
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Data/SqpDateTime.h>
6 #include <Data/SqpRange.h>
7
7
8 #include <QAbstractTableModel>
8 #include <QAbstractTableModel>
9 #include <QLoggingCategory>
9 #include <QLoggingCategory>
@@ -34,7 +34,7 public:
34 * @param metadata the metadata associated to the new variable
34 * @param metadata the metadata associated to the new variable
35 * @return the pointer to the new variable
35 * @return the pointer to the new variable
36 */
36 */
37 std::shared_ptr<Variable> createVariable(const QString &name, const SqpDateTime &dateTime,
37 std::shared_ptr<Variable> createVariable(const QString &name, const SqpRange &dateTime,
38 const QVariantHash &metadata) noexcept;
38 const QVariantHash &metadata) noexcept;
39
39
40 /**
40 /**
@@ -3,7 +3,7
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Data/SqpDateTime.h>
6 #include <Data/SqpRange.h>
7
7
8 #include <QLoggingCategory>
8 #include <QLoggingCategory>
9 #include <QObject>
9 #include <QObject>
@@ -34,7 +34,7 signals:
34 void variableAboutToBeDeleted(std::shared_ptr<Variable> variable);
34 void variableAboutToBeDeleted(std::shared_ptr<Variable> variable);
35
35
36 /// Signal emitted when a data acquisition is requested on a range for a variable
36 /// Signal emitted when a data acquisition is requested on a range for a variable
37 void rangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range);
37 void rangeChanged(std::shared_ptr<Variable> variable, const SqpRange &range);
38
38
39 public slots:
39 public slots:
40 /// Manage init/end of the controller
40 /// Manage init/end of the controller
@@ -4,7 +4,7 Q_LOGGING_CATEGORY(LOG_TimeController, "TimeController")
4
4
5 struct TimeController::TimeControllerPrivate {
5 struct TimeController::TimeControllerPrivate {
6
6
7 SqpDateTime m_DateTime;
7 SqpRange m_DateTime;
8 };
8 };
9
9
10 TimeController::TimeController(QObject *parent)
10 TimeController::TimeController(QObject *parent)
@@ -13,12 +13,12 TimeController::TimeController(QObject *parent)
13 qCDebug(LOG_TimeController()) << tr("TimeController construction");
13 qCDebug(LOG_TimeController()) << tr("TimeController construction");
14 }
14 }
15
15
16 SqpDateTime TimeController::dateTime() const noexcept
16 SqpRange TimeController::dateTime() const noexcept
17 {
17 {
18 return impl->m_DateTime;
18 return impl->m_DateTime;
19 }
19 }
20
20
21 void TimeController::onTimeToUpdate(SqpDateTime dateTime)
21 void TimeController::onTimeToUpdate(SqpRange dateTime)
22 {
22 {
23 impl->m_DateTime = dateTime;
23 impl->m_DateTime = dateTime;
24 }
24 }
@@ -1,7 +1,7
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/SqpRange.h>
5
5
6 #include <QReadWriteLock>
6 #include <QReadWriteLock>
7 #include <QThread>
7 #include <QThread>
@@ -9,7 +9,7
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 SqpRange &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 {
@@ -17,12 +17,12 struct Variable::VariablePrivate {
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 SqpRange 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 SqpRange &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 }
@@ -32,12 +32,12 QString Variable::name() const noexcept
32 return impl->m_Name;
32 return impl->m_Name;
33 }
33 }
34
34
35 SqpDateTime Variable::dateTime() const noexcept
35 SqpRange 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 SqpRange &dateTime) noexcept
41 {
41 {
42 impl->m_DateTime = dateTime;
42 impl->m_DateTime = dateTime;
43 }
43 }
@@ -70,17 +70,17 QVariantHash Variable::metadata() const noexcept
70 return impl->m_Metadata;
70 return impl->m_Metadata;
71 }
71 }
72
72
73 bool Variable::contains(const SqpDateTime &dateTime) const noexcept
73 bool Variable::contains(const SqpRange &dateTime) const noexcept
74 {
74 {
75 return impl->m_DateTime.contains(dateTime);
75 return impl->m_DateTime.contains(dateTime);
76 }
76 }
77
77
78 bool Variable::intersect(const SqpDateTime &dateTime) const noexcept
78 bool Variable::intersect(const SqpRange &dateTime) const noexcept
79 {
79 {
80 return impl->m_DateTime.intersect(dateTime);
80 return impl->m_DateTime.intersect(dateTime);
81 }
81 }
82
82
83 bool Variable::isInside(const SqpDateTime &dateTime) const noexcept
83 bool Variable::isInside(const SqpRange &dateTime) const noexcept
84 {
84 {
85 return dateTime.contains(SqpDateTime{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd});
85 return dateTime.contains(SqpRange{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd});
86 }
86 }
@@ -8,19 +8,16 Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController")
8
8
9 struct VariableCacheController::VariableCacheControllerPrivate {
9 struct VariableCacheController::VariableCacheControllerPrivate {
10
10
11 std::unordered_map<std::shared_ptr<Variable>, QVector<SqpDateTime> >
11 std::unordered_map<std::shared_ptr<Variable>, QVector<SqpRange> > m_VariableToSqpRangeListMap;
12 m_VariableToSqpDateTimeListMap;
13
12
14 void addInCacheDataByEnd(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
13 void addInCacheDataByEnd(const SqpRange &dateTime, QVector<SqpRange> &dateTimeList,
15 QVector<SqpDateTime> &notInCache, int cacheIndex,
14 QVector<SqpRange> &notInCache, int cacheIndex, double currentTStart);
16 double currentTStart);
17
15
18 void addInCacheDataByStart(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
16 void addInCacheDataByStart(const SqpRange &dateTime, QVector<SqpRange> &dateTimeList,
19 QVector<SqpDateTime> &notInCache, int cacheIndex,
17 QVector<SqpRange> &notInCache, int cacheIndex, double currentTStart);
20 double currentTStart);
21
18
22
19
23 void addDateTimeRecurse(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
20 void addDateTimeRecurse(const SqpRange &dateTime, QVector<SqpRange> &dateTimeList,
24 int cacheIndex);
21 int cacheIndex);
25 };
22 };
26
23
@@ -31,20 +28,20 VariableCacheController::VariableCacheController(QObject *parent)
31 }
28 }
32
29
33 void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable,
30 void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable,
34 const SqpDateTime &dateTime)
31 const SqpRange &dateTime)
35 {
32 {
36 qCDebug(LOG_VariableCacheController()) << "VariableCacheController::addDateTime"
33 qCDebug(LOG_VariableCacheController()) << "VariableCacheController::addDateTime"
37 << QThread::currentThread()->objectName();
34 << QThread::currentThread()->objectName();
38 if (variable) {
35 if (variable) {
39 auto findVariableIte = impl->m_VariableToSqpDateTimeListMap.find(variable);
36 auto findVariableIte = impl->m_VariableToSqpRangeListMap.find(variable);
40 if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) {
37 if (findVariableIte == impl->m_VariableToSqpRangeListMap.end()) {
41 impl->m_VariableToSqpDateTimeListMap[variable].push_back(dateTime);
38 impl->m_VariableToSqpRangeListMap[variable].push_back(dateTime);
42 }
39 }
43 else {
40 else {
44
41
45 // addDateTime modify the list<SqpDateTime> of the variable in a way to ensure
42 // addDateTime modify the list<SqpRange> of the variable in a way to ensure
46 // that the list is ordered : l(0) < l(1). We assume also a < b
43 // that the list is ordered : l(0) < l(1). We assume also a < b
47 // (with a & b of type SqpDateTime) means ts(b) > te(a)
44 // (with a & b of type SqpRange) means ts(b) > te(a)
48
45
49 // The algorithm will try the merge of two interval:
46 // The algorithm will try the merge of two interval:
50 // - dateTime will be compare with the first interval of the list:
47 // - dateTime will be compare with the first interval of the list:
@@ -54,8 +51,8 void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable,
54 // C: if it is superior, we do the same with the next interval of the list
51 // C: if it is superior, we do the same with the next interval of the list
55
52
56 try {
53 try {
57 impl->addDateTimeRecurse(dateTime,
54 impl->addDateTimeRecurse(dateTime, impl->m_VariableToSqpRangeListMap.at(variable),
58 impl->m_VariableToSqpDateTimeListMap.at(variable), 0);
55 0);
59 }
56 }
60 catch (const std::out_of_range &e) {
57 catch (const std::out_of_range &e) {
61 qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what();
58 qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what();
@@ -71,7 +68,7 void VariableCacheController::clear(std::shared_ptr<Variable> variable) noexcept
71 return;
68 return;
72 }
69 }
73
70
74 auto nbEntries = impl->m_VariableToSqpDateTimeListMap.erase(variable);
71 auto nbEntries = impl->m_VariableToSqpRangeListMap.erase(variable);
75
72
76 auto clearCacheMessage
73 auto clearCacheMessage
77 = (nbEntries != 0)
74 = (nbEntries != 0)
@@ -80,21 +77,21 void VariableCacheController::clear(std::shared_ptr<Variable> variable) noexcept
80 qCDebug(LOG_VariableCacheController()) << clearCacheMessage;
77 qCDebug(LOG_VariableCacheController()) << clearCacheMessage;
81 }
78 }
82
79
83 QVector<SqpDateTime>
80 QVector<SqpRange>
84 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
81 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
85 const SqpDateTime &dateTime)
82 const SqpRange &dateTime)
86 {
83 {
87 qCDebug(LOG_VariableCacheController())
84 qCDebug(LOG_VariableCacheController())
88 << "VariableCacheController::provideNotInCacheDateTimeList"
85 << "VariableCacheController::provideNotInCacheDateTimeList"
89 << QThread::currentThread()->objectName();
86 << QThread::currentThread()->objectName();
90 auto notInCache = QVector<SqpDateTime>{};
87 auto notInCache = QVector<SqpRange>{};
91
88
92 // This algorithm is recursif. The idea is to localise the start time then the end time in the
89 // This algorithm is recursif. The idea is to localise the start time then the end time in the
93 // list of date time request associated to the variable
90 // list of date time request associated to the variable
94 // We assume that the list is ordered in a way that l(0) < l(1). We assume also a < b
91 // We assume that the list is ordered in a way that l(0) < l(1). We assume also a < b
95 // (with a & b of type SqpDateTime) means ts(b) > te(a)
92 // (with a & b of type SqpRange) means ts(b) > te(a)
96 auto it = impl->m_VariableToSqpDateTimeListMap.find(variable);
93 auto it = impl->m_VariableToSqpRangeListMap.find(variable);
97 if (it != impl->m_VariableToSqpDateTimeListMap.end()) {
94 if (it != impl->m_VariableToSqpRangeListMap.end()) {
98 impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart);
95 impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart);
99 }
96 }
100 else {
97 else {
@@ -104,22 +101,22 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable>
104 return notInCache;
101 return notInCache;
105 }
102 }
106
103
107 QVector<SqpDateTime>
104 QVector<SqpRange>
108 VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept
105 VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept
109 {
106 {
110 qCDebug(LOG_VariableCacheController()) << "VariableCacheController::dateCacheList"
107 qCDebug(LOG_VariableCacheController()) << "VariableCacheController::dateCacheList"
111 << QThread::currentThread()->objectName();
108 << QThread::currentThread()->objectName();
112 try {
109 try {
113 return impl->m_VariableToSqpDateTimeListMap.at(variable);
110 return impl->m_VariableToSqpRangeListMap.at(variable);
114 }
111 }
115 catch (const std::out_of_range &e) {
112 catch (const std::out_of_range &e) {
116 qCWarning(LOG_VariableCacheController()) << e.what();
113 qCWarning(LOG_VariableCacheController()) << e.what();
117 return QVector<SqpDateTime>{};
114 return QVector<SqpRange>{};
118 }
115 }
119 }
116 }
120
117
121 void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse(
118 void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse(
122 const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, int cacheIndex)
119 const SqpRange &dateTime, QVector<SqpRange> &dateTimeList, int cacheIndex)
123 {
120 {
124 const auto dateTimeListSize = dateTimeList.count();
121 const auto dateTimeListSize = dateTimeList.count();
125 if (cacheIndex >= dateTimeListSize) {
122 if (cacheIndex >= dateTimeListSize) {
@@ -143,7 +140,7 void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse
143 // rerun the algo from this index with the merged interval
140 // rerun the algo from this index with the merged interval
144 auto mTStart = std::min(dateTime.m_TStart, currentDateTime.m_TStart);
141 auto mTStart = std::min(dateTime.m_TStart, currentDateTime.m_TStart);
145 auto mTEnd = std::max(dateTime.m_TEnd, currentDateTime.m_TEnd);
142 auto mTEnd = std::max(dateTime.m_TEnd, currentDateTime.m_TEnd);
146 auto mergeDateTime = SqpDateTime{mTStart, mTEnd};
143 auto mergeDateTime = SqpRange{mTStart, mTEnd};
147
144
148 dateTimeList.remove(cacheIndex);
145 dateTimeList.remove(cacheIndex);
149 addDateTimeRecurse(mergeDateTime, dateTimeList, cacheIndex);
146 addDateTimeRecurse(mergeDateTime, dateTimeList, cacheIndex);
@@ -152,15 +149,15 void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse
152
149
153
150
154 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEnd(
151 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEnd(
155 const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
152 const SqpRange &dateTime, QVector<SqpRange> &dateTimeList, QVector<SqpRange> &notInCache,
156 QVector<SqpDateTime> &notInCache, int cacheIndex, double currentTStart)
153 int cacheIndex, double currentTStart)
157 {
154 {
158 const auto dateTimeListSize = dateTimeList.count();
155 const auto dateTimeListSize = dateTimeList.count();
159 if (cacheIndex >= dateTimeListSize) {
156 if (cacheIndex >= dateTimeListSize) {
160 if (currentTStart < dateTime.m_TEnd) {
157 if (currentTStart < dateTime.m_TEnd) {
161
158
162 // te localised after all other interval: The last interval is [currentTsart, te]
159 // te localised after all other interval: The last interval is [currentTsart, te]
163 notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd});
160 notInCache.push_back(SqpRange{currentTStart, dateTime.m_TEnd});
164 }
161 }
165 return;
162 return;
166 }
163 }
@@ -168,10 +165,10 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEn
168 auto currentDateTimeJ = dateTimeList[cacheIndex];
165 auto currentDateTimeJ = dateTimeList[cacheIndex];
169 if (dateTime.m_TEnd <= currentDateTimeJ.m_TStart) {
166 if (dateTime.m_TEnd <= currentDateTimeJ.m_TStart) {
170 // te localised between to interval: The last interval is [currentTsart, te]
167 // te localised between to interval: The last interval is [currentTsart, te]
171 notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd});
168 notInCache.push_back(SqpRange{currentTStart, dateTime.m_TEnd});
172 }
169 }
173 else {
170 else {
174 notInCache.push_back(SqpDateTime{currentTStart, currentDateTimeJ.m_TStart});
171 notInCache.push_back(SqpRange{currentTStart, currentDateTimeJ.m_TStart});
175 if (dateTime.m_TEnd > currentDateTimeJ.m_TEnd) {
172 if (dateTime.m_TEnd > currentDateTimeJ.m_TEnd) {
176 // te not localised before the current interval: we need to look at the next interval
173 // te not localised before the current interval: we need to look at the next interval
177 addInCacheDataByEnd(dateTime, dateTimeList, notInCache, ++cacheIndex,
174 addInCacheDataByEnd(dateTime, dateTimeList, notInCache, ++cacheIndex,
@@ -181,13 +178,13 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEn
181 }
178 }
182
179
183 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByStart(
180 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByStart(
184 const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
181 const SqpRange &dateTime, QVector<SqpRange> &dateTimeList, QVector<SqpRange> &notInCache,
185 QVector<SqpDateTime> &notInCache, int cacheIndex, double currentTStart)
182 int cacheIndex, double currentTStart)
186 {
183 {
187 const auto dateTimeListSize = dateTimeList.count();
184 const auto dateTimeListSize = dateTimeList.count();
188 if (cacheIndex >= dateTimeListSize) {
185 if (cacheIndex >= dateTimeListSize) {
189 // ts localised after all other interval: The last interval is [ts, te]
186 // ts localised after all other interval: The last interval is [ts, te]
190 notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd});
187 notInCache.push_back(SqpRange{currentTStart, dateTime.m_TEnd});
191 return;
188 return;
192 }
189 }
193
190
@@ -216,8 +213,8 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataBySt
216
213
217 void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) const
214 void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) const
218 {
215 {
219 auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable);
216 auto variableDateTimeList = impl->m_VariableToSqpRangeListMap.find(variable);
220 if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) {
217 if (variableDateTimeList != impl->m_VariableToSqpRangeListMap.end()) {
221 qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache")
218 qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache")
222 << variableDateTimeList->second;
219 << variableDateTimeList->second;
223 }
220 }
@@ -150,7 +150,7 void VariableController::createVariable(const QString &name, const QVariantHash
150 }
150 }
151 }
151 }
152
152
153 void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime)
153 void VariableController::onDateTimeOnSelection(const SqpRange &dateTime)
154 {
154 {
155 qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
155 qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
156 << QThread::currentThread()->objectName();
156 << QThread::currentThread()->objectName();
@@ -196,7 +196,7 void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> vari
196
196
197
197
198 void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable,
198 void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable,
199 const SqpDateTime &dateTime)
199 const SqpRange &dateTime)
200 {
200 {
201 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
201 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
202 << QThread::currentThread()->objectName();
202 << QThread::currentThread()->objectName();
@@ -60,7 +60,7 VariableModel::VariableModel(QObject *parent)
60 }
60 }
61
61
62 std::shared_ptr<Variable> VariableModel::createVariable(const QString &name,
62 std::shared_ptr<Variable> VariableModel::createVariable(const QString &name,
63 const SqpDateTime &dateTime,
63 const SqpRange &dateTime,
64 const QVariantHash &metadata) noexcept
64 const QVariantHash &metadata) noexcept
65 {
65 {
66 auto insertIndex = rowCount();
66 auto insertIndex = rowCount();
@@ -22,18 +22,18 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
22
22
23 auto ts0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 0, 0}};
23 auto ts0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 0, 0}};
24 auto te0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
24 auto te0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
25 auto sqp0 = SqpDateTime{static_cast<double>(ts0.toMSecsSinceEpoch()),
25 auto sqp0 = SqpRange{static_cast<double>(ts0.toMSecsSinceEpoch()),
26 static_cast<double>(te0.toMSecsSinceEpoch())};
26 static_cast<double>(te0.toMSecsSinceEpoch())};
27
27
28 auto ts1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}};
28 auto ts1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}};
29 auto te1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 8, 0, 0}};
29 auto te1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 8, 0, 0}};
30 auto sqp1 = SqpDateTime{static_cast<double>(ts1.toMSecsSinceEpoch()),
30 auto sqp1 = SqpRange{static_cast<double>(ts1.toMSecsSinceEpoch()),
31 static_cast<double>(te1.toMSecsSinceEpoch())};
31 static_cast<double>(te1.toMSecsSinceEpoch())};
32
32
33 auto ts2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 18, 0, 0}};
33 auto ts2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 18, 0, 0}};
34 auto te2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 20, 0, 0}};
34 auto te2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 20, 0, 0}};
35 auto sqp2 = SqpDateTime{static_cast<double>(ts2.toMSecsSinceEpoch()),
35 auto sqp2 = SqpRange{static_cast<double>(ts2.toMSecsSinceEpoch()),
36 static_cast<double>(te2.toMSecsSinceEpoch())};
36 static_cast<double>(te2.toMSecsSinceEpoch())};
37
37
38 auto var0 = std::make_shared<Variable>("", sqp0);
38 auto var0 = std::make_shared<Variable>("", sqp0);
39
39
@@ -44,8 +44,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
44 // first case [ts,te] < ts0
44 // first case [ts,te] < ts0
45 auto ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
45 auto ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
46 auto te = QDateTime{QDate{2017, 01, 01}, QTime{2, 1, 0, 0}};
46 auto te = QDateTime{QDate{2017, 01, 01}, QTime{2, 1, 0, 0}};
47 auto sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
47 auto sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
48 static_cast<double>(te.toMSecsSinceEpoch())};
48 static_cast<double>(te.toMSecsSinceEpoch())};
49
49
50
50
51 auto notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
51 auto notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -59,8 +59,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
59 // second case ts < ts0 && ts0 < te <= te0
59 // second case ts < ts0 && ts0 < te <= te0
60 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
60 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
61 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}};
61 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}};
62 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
62 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
63 static_cast<double>(te.toMSecsSinceEpoch())};
63 static_cast<double>(te.toMSecsSinceEpoch())};
64
64
65
65
66 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
66 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -73,8 +73,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
73 // 3th case ts < ts0 && te0 < te <= ts1
73 // 3th case ts < ts0 && te0 < te <= ts1
74 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
74 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
75 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
75 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
76 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
76 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
77 static_cast<double>(te.toMSecsSinceEpoch())};
77 static_cast<double>(te.toMSecsSinceEpoch())};
78
78
79
79
80 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
80 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -91,8 +91,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
91 // 4th case ts < ts0 && ts1 < te <= te1
91 // 4th case ts < ts0 && ts1 < te <= te1
92 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
92 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
93 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 7, 0, 0}};
93 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 7, 0, 0}};
94 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
94 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
95 static_cast<double>(te.toMSecsSinceEpoch())};
95 static_cast<double>(te.toMSecsSinceEpoch())};
96
96
97
97
98 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
98 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -109,8 +109,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
109 // 5th case ts < ts0 && te3 < te
109 // 5th case ts < ts0 && te3 < te
110 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
110 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}};
111 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 22, 0, 0}};
111 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 22, 0, 0}};
112 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
112 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
113 static_cast<double>(te.toMSecsSinceEpoch())};
113 static_cast<double>(te.toMSecsSinceEpoch())};
114
114
115
115
116 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
116 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -136,8 +136,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
136 // 6th case ts2 < ts
136 // 6th case ts2 < ts
137 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 45, 0, 0}};
137 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 45, 0, 0}};
138 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 47, 0, 0}};
138 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 47, 0, 0}};
139 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
139 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
140 static_cast<double>(te.toMSecsSinceEpoch())};
140 static_cast<double>(te.toMSecsSinceEpoch())};
141
141
142
142
143 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
143 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -150,8 +150,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
150 // 7th case ts = te0 && te < ts1
150 // 7th case ts = te0 && te < ts1
151 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
151 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
152 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
152 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
153 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
153 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
154 static_cast<double>(te.toMSecsSinceEpoch())};
154 static_cast<double>(te.toMSecsSinceEpoch())};
155
155
156
156
157 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
157 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -164,8 +164,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
164 // 8th case ts0 < ts < te0 && te < ts1
164 // 8th case ts0 < ts < te0 && te < ts1
165 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}};
165 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}};
166 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
166 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
167 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
167 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
168 static_cast<double>(te.toMSecsSinceEpoch())};
168 static_cast<double>(te.toMSecsSinceEpoch())};
169
169
170
170
171 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
171 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -178,8 +178,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
178 // 9th case ts0 < ts < te0 && ts1 < te < te1
178 // 9th case ts0 < ts < te0 && ts1 < te < te1
179 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}};
179 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}};
180 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 7, 0, 0}};
180 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 7, 0, 0}};
181 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
181 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
182 static_cast<double>(te.toMSecsSinceEpoch())};
182 static_cast<double>(te.toMSecsSinceEpoch())};
183
183
184
184
185 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
185 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -192,8 +192,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
192 // 10th case te1 < ts < te < ts2
192 // 10th case te1 < ts < te < ts2
193 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 9, 0, 0}};
193 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 9, 0, 0}};
194 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 10, 0, 0}};
194 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 10, 0, 0}};
195 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
195 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
196 static_cast<double>(te.toMSecsSinceEpoch())};
196 static_cast<double>(te.toMSecsSinceEpoch())};
197
197
198
198
199 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
199 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -206,8 +206,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
206 // 11th case te0 < ts < ts1 && te3 < te
206 // 11th case te0 < ts < ts1 && te3 < te
207 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
207 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
208 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 47, 0, 0}};
208 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 47, 0, 0}};
209 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
209 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
210 static_cast<double>(te.toMSecsSinceEpoch())};
210 static_cast<double>(te.toMSecsSinceEpoch())};
211
211
212
212
213 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
213 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -228,8 +228,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
228 // 12th case te0 < ts < ts1 && te3 < te
228 // 12th case te0 < ts < ts1 && te3 < te
229 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
229 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}};
230 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 10, 0, 0}};
230 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 10, 0, 0}};
231 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
231 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
232 static_cast<double>(te.toMSecsSinceEpoch())};
232 static_cast<double>(te.toMSecsSinceEpoch())};
233
233
234 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
234 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
235
235
@@ -246,8 +246,8 void TestVariableCacheController::testProvideNotInCacheDateTimeList()
246 // 12th case ts0 < ts < te0
246 // 12th case ts0 < ts < te0
247 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 10, 0}};
247 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 10, 0}};
248 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 50, 0}};
248 te = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 50, 0}};
249 sqp = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
249 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
250 static_cast<double>(te.toMSecsSinceEpoch())};
250 static_cast<double>(te.toMSecsSinceEpoch())};
251
251
252 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
252 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
253 QCOMPARE(notInCach.size(), 0);
253 QCOMPARE(notInCach.size(), 0);
@@ -260,33 +260,33 void TestVariableCacheController::testAddDateTime()
260
260
261 auto ts0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 0, 0}};
261 auto ts0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 0, 0}};
262 auto te0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
262 auto te0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
263 auto sqp0 = SqpDateTime{static_cast<double>(ts0.toMSecsSinceEpoch()),
263 auto sqp0 = SqpRange{static_cast<double>(ts0.toMSecsSinceEpoch()),
264 static_cast<double>(te0.toMSecsSinceEpoch())};
264 static_cast<double>(te0.toMSecsSinceEpoch())};
265
265
266 auto ts1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}};
266 auto ts1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}};
267 auto te1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 8, 0, 0}};
267 auto te1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 8, 0, 0}};
268 auto sqp1 = SqpDateTime{static_cast<double>(ts1.toMSecsSinceEpoch()),
268 auto sqp1 = SqpRange{static_cast<double>(ts1.toMSecsSinceEpoch()),
269 static_cast<double>(te1.toMSecsSinceEpoch())};
269 static_cast<double>(te1.toMSecsSinceEpoch())};
270
270
271 auto ts2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 18, 0, 0}};
271 auto ts2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 18, 0, 0}};
272 auto te2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 20, 0, 0}};
272 auto te2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 20, 0, 0}};
273 auto sqp2 = SqpDateTime{static_cast<double>(ts2.toMSecsSinceEpoch()),
273 auto sqp2 = SqpRange{static_cast<double>(ts2.toMSecsSinceEpoch()),
274 static_cast<double>(te2.toMSecsSinceEpoch())};
274 static_cast<double>(te2.toMSecsSinceEpoch())};
275
275
276 auto ts01 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
276 auto ts01 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
277 auto te01 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}};
277 auto te01 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}};
278 auto sqp01 = SqpDateTime{static_cast<double>(ts01.toMSecsSinceEpoch()),
278 auto sqp01 = SqpRange{static_cast<double>(ts01.toMSecsSinceEpoch()),
279 static_cast<double>(te01.toMSecsSinceEpoch())};
279 static_cast<double>(te01.toMSecsSinceEpoch())};
280
280
281 auto ts3 = QDateTime{QDate{2017, 01, 01}, QTime{2, 14, 0, 0}};
281 auto ts3 = QDateTime{QDate{2017, 01, 01}, QTime{2, 14, 0, 0}};
282 auto te3 = QDateTime{QDate{2017, 01, 01}, QTime{2, 16, 0, 0}};
282 auto te3 = QDateTime{QDate{2017, 01, 01}, QTime{2, 16, 0, 0}};
283 auto sqp3 = SqpDateTime{static_cast<double>(ts3.toMSecsSinceEpoch()),
283 auto sqp3 = SqpRange{static_cast<double>(ts3.toMSecsSinceEpoch()),
284 static_cast<double>(te3.toMSecsSinceEpoch())};
284 static_cast<double>(te3.toMSecsSinceEpoch())};
285
285
286 auto ts03 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
286 auto ts03 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}};
287 auto te03 = QDateTime{QDate{2017, 01, 01}, QTime{2, 22, 0, 0}};
287 auto te03 = QDateTime{QDate{2017, 01, 01}, QTime{2, 22, 0, 0}};
288 auto sqp03 = SqpDateTime{static_cast<double>(ts03.toMSecsSinceEpoch()),
288 auto sqp03 = SqpRange{static_cast<double>(ts03.toMSecsSinceEpoch()),
289 static_cast<double>(te03.toMSecsSinceEpoch())};
289 static_cast<double>(te03.toMSecsSinceEpoch())};
290
290
291
291
292 auto var0 = std::make_shared<Variable>("", sqp0);
292 auto var0 = std::make_shared<Variable>("", sqp0);
@@ -3,7 +3,7
3
3
4 #include <QWidget>
4 #include <QWidget>
5
5
6 #include <Data/SqpDateTime.h>
6 #include <Data/SqpRange.h>
7
7
8 namespace Ui {
8 namespace Ui {
9 class TimeWidget;
9 class TimeWidget;
@@ -18,7 +18,7 public:
18
18
19 signals:
19 signals:
20 /// Signal emitted when the time parameters has beed updated
20 /// Signal emitted when the time parameters has beed updated
21 void timeUpdated(SqpDateTime time);
21 void timeUpdated(SqpRange time);
22
22
23 public slots:
23 public slots:
24 /// slot called when time parameters update has ben requested
24 /// slot called when time parameters update has ben requested
@@ -1,7 +1,7
1 #ifndef SCIQLOP_VISUALIZATIONGRAPHHELPER_H
1 #ifndef SCIQLOP_VISUALIZATIONGRAPHHELPER_H
2 #define SCIQLOP_VISUALIZATIONGRAPHHELPER_H
2 #define SCIQLOP_VISUALIZATIONGRAPHHELPER_H
3
3
4 #include <Data/SqpDateTime.h>
4 #include <Data/SqpRange.h>
5
5
6 #include <QLoggingCategory>
6 #include <QLoggingCategory>
7 #include <QVector>
7 #include <QVector>
@@ -32,7 +32,7 struct VisualizationGraphHelper {
32 QCustomPlot &plot) noexcept;
32 QCustomPlot &plot) noexcept;
33
33
34 static void updateData(QVector<QCPAbstractPlottable *> plotableVect, IDataSeries *dataSeries,
34 static void updateData(QVector<QCPAbstractPlottable *> plotableVect, IDataSeries *dataSeries,
35 const SqpDateTime &dateTime);
35 const SqpRange &dateTime);
36 };
36 };
37
37
38 #endif // SCIQLOP_VISUALIZATIONGRAPHHELPER_H
38 #endif // SCIQLOP_VISUALIZATIONGRAPHHELPER_H
@@ -13,7 +13,7
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 SqpRange;
17 class Variable;
17 class Variable;
18
18
19 /**
19 /**
@@ -39,9 +39,9 public:
39 /// Removes a variable from the graph
39 /// Removes a variable from the graph
40 void removeVariable(std::shared_ptr<Variable> variable) noexcept;
40 void removeVariable(std::shared_ptr<Variable> variable) noexcept;
41
41
42 void setRange(std::shared_ptr<Variable> variable, const SqpDateTime &range);
42 void setRange(std::shared_ptr<Variable> variable, const SqpRange &range);
43 SqpDateTime graphRange() const noexcept;
43 SqpRange graphRange() const noexcept;
44 void setGraphRange(const SqpDateTime &range);
44 void setGraphRange(const SqpRange &range);
45
45
46 // IVisualizationWidget interface
46 // IVisualizationWidget interface
47 void accept(IVisualizationWidgetVisitor *visitor) override;
47 void accept(IVisualizationWidgetVisitor *visitor) override;
@@ -51,8 +51,8 public:
51
51
52
52
53 signals:
53 signals:
54 void requestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime);
54 void requestDataLoading(std::shared_ptr<Variable> variable, const SqpRange &dateTime);
55 void synchronize(const SqpDateTime &dateTime, const SqpDateTime &oldDateTime,
55 void synchronize(const SqpRange &dateTime, const SqpRange &oldDateTime,
56 VisualizationGraphWidgetZoomType zoomType);
56 VisualizationGraphWidgetZoomType zoomType);
57
57
58
58
@@ -2,7 +2,7
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 #include <Data/SqpRange.h>
6
6
7 #include <QLoggingCategory>
7 #include <QLoggingCategory>
8 #include <QWidget>
8 #include <QWidget>
@@ -42,7 +42,7 public slots:
42 /// 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
43 void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept;
43 void onVariableAboutToBeDeleted(std::shared_ptr<Variable> variable) noexcept;
44
44
45 void onRangeChanged(std::shared_ptr<Variable> variable, const SqpDateTime &range) noexcept;
45 void onRangeChanged(std::shared_ptr<Variable> variable, const SqpRange &range) noexcept;
46
46
47 private:
47 private:
48 Ui::VisualizationWidget *ui;
48 Ui::VisualizationWidget *ui;
@@ -2,7 +2,7
2 #define SCIQLOP_RESCALEAXEOPERATION_H
2 #define SCIQLOP_RESCALEAXEOPERATION_H
3
3
4 #include "Visualization/IVisualizationWidgetVisitor.h"
4 #include "Visualization/IVisualizationWidgetVisitor.h"
5 #include <Data/SqpDateTime.h>
5 #include <Data/SqpRange.h>
6
6
7 #include <Common/spimpl.h>
7 #include <Common/spimpl.h>
8
8
@@ -24,7 +24,7 public:
24 * Ctor
24 * Ctor
25 * @param variable the variable to remove from widgets
25 * @param variable the variable to remove from widgets
26 */
26 */
27 explicit RescaleAxeOperation(std::shared_ptr<Variable> variable, const SqpDateTime &range);
27 explicit RescaleAxeOperation(std::shared_ptr<Variable> variable, const SqpRange &range);
28
28
29 void visitEnter(VisualizationWidget *widget) override final;
29 void visitEnter(VisualizationWidget *widget) override final;
30 void visitLeave(VisualizationWidget *widget) override final;
30 void visitLeave(VisualizationWidget *widget) override final;
@@ -39,9 +39,9 public:
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(),
41 connect(m_VariableController.get(),
42 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)),
42 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)),
43 m_VisualizationController.get(),
43 m_VisualizationController.get(),
44 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)));
44 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)));
45
45
46
46
47 m_DataSourceController->moveToThread(&m_DataSourceControllerThread);
47 m_DataSourceController->moveToThread(&m_DataSourceControllerThread);
@@ -29,8 +29,8 TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget
29 ui->startDateTimeEdit->setDateTime(startDateTime);
29 ui->startDateTimeEdit->setDateTime(startDateTime);
30 ui->endDateTimeEdit->setDateTime(endDateTime);
30 ui->endDateTimeEdit->setDateTime(endDateTime);
31
31
32 auto dateTime = SqpDateTime{DateUtils::secondsSinceEpoch(startDateTime),
32 auto dateTime = SqpRange{DateUtils::secondsSinceEpoch(startDateTime),
33 DateUtils::secondsSinceEpoch(endDateTime)};
33 DateUtils::secondsSinceEpoch(endDateTime)};
34
34
35 sqpApp->timeController().onTimeToUpdate(dateTime);
35 sqpApp->timeController().onTimeToUpdate(dateTime);
36 }
36 }
@@ -43,8 +43,8 TimeWidget::~TimeWidget()
43
43
44 void TimeWidget::onTimeUpdateRequested()
44 void TimeWidget::onTimeUpdateRequested()
45 {
45 {
46 auto dateTime = SqpDateTime{DateUtils::secondsSinceEpoch(ui->startDateTimeEdit->dateTime()),
46 auto dateTime = SqpRange{DateUtils::secondsSinceEpoch(ui->startDateTimeEdit->dateTime()),
47 DateUtils::secondsSinceEpoch(ui->endDateTimeEdit->dateTime())};
47 DateUtils::secondsSinceEpoch(ui->endDateTimeEdit->dateTime())};
48
48
49 emit timeUpdated(std::move(dateTime));
49 emit timeUpdated(std::move(dateTime));
50 }
50 }
@@ -36,7 +36,7 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis)
36 }
36 }
37
37
38 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSeries,
38 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSeries,
39 const SqpDateTime &dateTime)
39 const SqpRange &dateTime)
40 {
40 {
41 qCDebug(LOG_VisualizationGraphHelper()) << "TORM: updateScalarData"
41 qCDebug(LOG_VisualizationGraphHelper()) << "TORM: updateScalarData"
42 << QThread::currentThread()->objectName();
42 << QThread::currentThread()->objectName();
@@ -80,7 +80,7 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSerie
80 }
80 }
81
81
82 QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QCustomPlot &plot,
82 QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QCustomPlot &plot,
83 const SqpDateTime &dateTime)
83 const SqpRange &dateTime)
84 {
84 {
85 auto component = plot.addGraph();
85 auto component = plot.addGraph();
86
86
@@ -144,7 +144,7 QVector<QCPAbstractPlottable *> VisualizationGraphHelper::create(std::shared_ptr
144 }
144 }
145
145
146 void VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *> plotableVect,
146 void VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *> plotableVect,
147 IDataSeries *dataSeries, const SqpDateTime &dateTime)
147 IDataSeries *dataSeries, const SqpRange &dateTime)
148 {
148 {
149 if (auto scalarSeries = dynamic_cast<ScalarSeries *>(dataSeries)) {
149 if (auto scalarSeries = dynamic_cast<ScalarSeries *>(dataSeries)) {
150 if (plotableVect.size() == 1) {
150 if (plotableVect.size() == 1) {
@@ -119,7 +119,7 void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> v
119
119
120 // when adding a variable, we need to set its time range to the current graph range
120 // when adding a variable, we need to set its time range to the current graph range
121 auto grapheRange = ui->widget->xAxis->range();
121 auto grapheRange = ui->widget->xAxis->range();
122 auto dateTime = SqpDateTime{grapheRange.lower, grapheRange.upper};
122 auto dateTime = SqpRange{grapheRange.lower, grapheRange.upper};
123 variable->setDateTime(dateTime);
123 variable->setDateTime(dateTime);
124
124
125 auto variableDateTimeWithTolerance = dateTime;
125 auto variableDateTimeWithTolerance = dateTime;
@@ -159,8 +159,7 void VisualizationGraphWidget::removeVariable(std::shared_ptr<Variable> variable
159 ui->widget->replot();
159 ui->widget->replot();
160 }
160 }
161
161
162 void VisualizationGraphWidget::setRange(std::shared_ptr<Variable> variable,
162 void VisualizationGraphWidget::setRange(std::shared_ptr<Variable> variable, const SqpRange &range)
163 const SqpDateTime &range)
164 {
163 {
165 // Note: in case of different axes that depends on variable, we could start with a code like
164 // Note: in case of different axes that depends on variable, we could start with a code like
166 // that:
165 // that:
@@ -171,13 +170,13 void VisualizationGraphWidget::setRange(std::shared_ptr<Variable> variable,
171 ui->widget->replot();
170 ui->widget->replot();
172 }
171 }
173
172
174 SqpDateTime VisualizationGraphWidget::graphRange() const noexcept
173 SqpRange VisualizationGraphWidget::graphRange() const noexcept
175 {
174 {
176 auto grapheRange = ui->widget->xAxis->range();
175 auto grapheRange = ui->widget->xAxis->range();
177 return SqpDateTime{grapheRange.lower, grapheRange.upper};
176 return SqpRange{grapheRange.lower, grapheRange.upper};
178 }
177 }
179
178
180 void VisualizationGraphWidget::setGraphRange(const SqpDateTime &range)
179 void VisualizationGraphWidget::setGraphRange(const SqpRange &range)
181 {
180 {
182 qCDebug(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::setGraphRange START");
181 qCDebug(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::setGraphRange START");
183 ui->widget->xAxis->setRange(range.m_TStart, range.m_TEnd);
182 ui->widget->xAxis->setRange(range.m_TStart, range.m_TEnd);
@@ -243,7 +242,7 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange
243 qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged")
242 qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged")
244 << QThread::currentThread()->objectName();
243 << QThread::currentThread()->objectName();
245
244
246 auto dateTimeRange = SqpDateTime{t1.lower, t1.upper};
245 auto dateTimeRange = SqpRange{t1.lower, t1.upper};
247
246
248 auto zoomType = impl->getZoomType(t1, t2);
247 auto zoomType = impl->getZoomType(t1, t2);
249 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
248 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
@@ -331,7 +330,7 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange
331 }
330 }
332
331
333 if (impl->m_DoSynchronize && !impl->m_IsCalibration) {
332 if (impl->m_DoSynchronize && !impl->m_IsCalibration) {
334 auto oldDateTime = SqpDateTime{t2.lower, t2.upper};
333 auto oldDateTime = SqpRange{t2.lower, t2.upper};
335 qCDebug(LOG_VisualizationGraphWidget())
334 qCDebug(LOG_VisualizationGraphWidget())
336 << tr("TORM: VisualizationGraphWidget::Synchronize notify !!")
335 << tr("TORM: VisualizationGraphWidget::Synchronize notify !!")
337 << QThread::currentThread()->objectName();
336 << QThread::currentThread()->objectName();
@@ -385,7 +384,7 void VisualizationGraphWidget::onDataCacheVariableUpdated()
385 // - use a map (unique keys) and store as values directly the list of components
384 // - use a map (unique keys) and store as values directly the list of components
386
385
387 auto grapheRange = ui->widget->xAxis->range();
386 auto grapheRange = ui->widget->xAxis->range();
388 auto dateTime = SqpDateTime{grapheRange.lower, grapheRange.upper};
387 auto dateTime = SqpRange{grapheRange.lower, grapheRange.upper};
389
388
390 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
389 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
391 it != impl->m_VariableToPlotMultiMap.cend(); ++it) {
390 it != impl->m_VariableToPlotMultiMap.cend(); ++it) {
@@ -144,7 +144,7 void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr<Variable> v
144 }
144 }
145
145
146 void VisualizationWidget::onRangeChanged(std::shared_ptr<Variable> variable,
146 void VisualizationWidget::onRangeChanged(std::shared_ptr<Variable> variable,
147 const SqpDateTime &range) noexcept
147 const SqpRange &range) noexcept
148 {
148 {
149 // Calls the operation of rescaling all graph that contrains variable in the visualization
149 // Calls the operation of rescaling all graph that contrains variable in the visualization
150 auto rescaleVariableOperation = RescaleAxeOperation{variable, range};
150 auto rescaleVariableOperation = RescaleAxeOperation{variable, range};
@@ -1,6 +1,6
1 #include "Visualization/VisualizationZoneWidget.h"
1 #include "Visualization/VisualizationZoneWidget.h"
2
2
3 #include "Data/SqpDateTime.h"
3 #include "Data/SqpRange.h"
4
4
5 #include "Visualization/IVisualizationWidgetVisitor.h"
5 #include "Visualization/IVisualizationWidgetVisitor.h"
6 #include "Visualization/VisualizationGraphWidget.h"
6 #include "Visualization/VisualizationGraphWidget.h"
@@ -70,8 +70,8 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V
70 graphWidget->addVariable(variable);
70 graphWidget->addVariable(variable);
71
71
72 // Lambda to synchronize zone widget
72 // Lambda to synchronize zone widget
73 auto synchronizeZoneWidget = [this, graphWidget](const SqpDateTime &dateTime,
73 auto synchronizeZoneWidget = [this, graphWidget](const SqpRange &dateTime,
74 const SqpDateTime &oldDateTime,
74 const SqpRange &oldDateTime,
75 VisualizationGraphWidgetZoomType zoomType) {
75 VisualizationGraphWidgetZoomType zoomType) {
76 auto frameLayout = ui->visualizationZoneFrame->layout();
76 auto frameLayout = ui->visualizationZoneFrame->layout();
77 for (auto i = 0; i < frameLayout->count(); ++i) {
77 for (auto i = 0; i < frameLayout->count(); ++i) {
@@ -4,18 +4,16
4 Q_LOGGING_CATEGORY(LOG_RescaleAxeOperation, "RescaleAxeOperation")
4 Q_LOGGING_CATEGORY(LOG_RescaleAxeOperation, "RescaleAxeOperation")
5
5
6 struct RescaleAxeOperation::RescaleAxeOperationPrivate {
6 struct RescaleAxeOperation::RescaleAxeOperationPrivate {
7 explicit RescaleAxeOperationPrivate(std::shared_ptr<Variable> variable,
7 explicit RescaleAxeOperationPrivate(std::shared_ptr<Variable> variable, const SqpRange &range)
8 const SqpDateTime &range)
9 : m_Variable{variable}, m_Range{range}
8 : m_Variable{variable}, m_Range{range}
10 {
9 {
11 }
10 }
12
11
13 std::shared_ptr<Variable> m_Variable;
12 std::shared_ptr<Variable> m_Variable;
14 SqpDateTime m_Range;
13 SqpRange m_Range;
15 };
14 };
16
15
17 RescaleAxeOperation::RescaleAxeOperation(std::shared_ptr<Variable> variable,
16 RescaleAxeOperation::RescaleAxeOperation(std::shared_ptr<Variable> variable, const SqpRange &range)
18 const SqpDateTime &range)
19 : impl{spimpl::make_unique_impl<RescaleAxeOperationPrivate>(variable, range)}
17 : impl{spimpl::make_unique_impl<RescaleAxeOperationPrivate>(variable, range)}
20 {
18 {
21 }
19 }
@@ -24,7 +24,7 public:
24 void requestDataAborting(QUuid identifier) override;
24 void requestDataAborting(QUuid identifier) override;
25
25
26 private:
26 private:
27 void retrieveData(QUuid token, const SqpDateTime &dateTime, const QVariantHash &data);
27 void retrieveData(QUuid token, const SqpRange &dateTime, const QVariantHash &data);
28 };
28 };
29
29
30 #endif // SCIQLOP_AMDAPROVIDER_H
30 #endif // SCIQLOP_AMDAPROVIDER_H
@@ -30,9 +30,9 const auto AMDA_URL_FORMAT = QStringLiteral(
30 const auto AMDA_TIME_FORMAT = QStringLiteral("yyyy-MM-ddThh:mm:ss");
30 const auto AMDA_TIME_FORMAT = QStringLiteral("yyyy-MM-ddThh:mm:ss");
31
31
32 /// Formats a time to a date that can be passed in URL
32 /// Formats a time to a date that can be passed in URL
33 QString dateFormat(double sqpDateTime) noexcept
33 QString dateFormat(double sqpRange) noexcept
34 {
34 {
35 auto dateTime = DateUtils::dateTime(sqpDateTime);
35 auto dateTime = DateUtils::dateTime(sqpRange);
36 return dateTime.toString(AMDA_TIME_FORMAT);
36 return dateTime.toString(AMDA_TIME_FORMAT);
37 }
37 }
38
38
@@ -73,7 +73,7 void AmdaProvider::requestDataAborting(QUuid identifier)
73 }
73 }
74 }
74 }
75
75
76 void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime, const QVariantHash &data)
76 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVariantHash &data)
77 {
77 {
78 // Retrieves product ID from data: if the value is invalid, no request is made
78 // Retrieves product ID from data: if the value is invalid, no request is made
79 auto productId = data.value(AMDA_XML_ID_KEY).toString();
79 auto productId = data.value(AMDA_XML_ID_KEY).toString();
@@ -25,7 +25,7 public:
25
25
26
26
27 private:
27 private:
28 std::shared_ptr<IDataSeries> retrieveData(QUuid token, const SqpDateTime &dateTime);
28 std::shared_ptr<IDataSeries> retrieveData(QUuid token, const SqpRange &dateTime);
29
29
30 QHash<QUuid, bool> m_VariableToEnableProvider;
30 QHash<QUuid, bool> m_VariableToEnableProvider;
31 };
31 };
@@ -11,7 +11,7
11
11
12 Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider")
12 Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider")
13
13
14 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid token, const SqpDateTime &dateTime)
14 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid token, const SqpRange &dateTime)
15 {
15 {
16 // TODO: Add Mutex
16 // TODO: Add Mutex
17 auto dataIndex = 0;
17 auto dataIndex = 0;
General Comments 0
You need to be logged in to leave comments. Login now