@@ -1,101 +1,101 | |||||
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 QString &unit, const QString &mission, |
|
12 | explicit VariablePrivate(const QString &name, const QString &unit, const QString &mission, | |
13 | const SqpDateTime &dateTime) |
|
13 | const SqpDateTime &dateTime) | |
14 | : m_Name{name}, |
|
14 | : m_Name{name}, | |
15 | m_Unit{unit}, |
|
15 | m_Unit{unit}, | |
16 | m_Mission{mission}, |
|
16 | m_Mission{mission}, | |
17 | m_DateTime{dateTime}, |
|
17 | m_DateTime{dateTime}, | |
18 | m_DataSeries{nullptr} |
|
18 | m_DataSeries{nullptr} | |
19 | { |
|
19 | { | |
20 | } |
|
20 | } | |
21 |
|
21 | |||
22 | QString m_Name; |
|
22 | QString m_Name; | |
23 | QString m_Unit; |
|
23 | QString m_Unit; | |
24 | QString m_Mission; |
|
24 | QString m_Mission; | |
25 |
|
25 | |||
26 | SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache. |
|
26 | SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache. | |
27 | std::unique_ptr<IDataSeries> m_DataSeries; |
|
27 | std::unique_ptr<IDataSeries> m_DataSeries; | |
28 | }; |
|
28 | }; | |
29 |
|
29 | |||
30 | Variable::Variable(const QString &name, const QString &unit, const QString &mission, |
|
30 | Variable::Variable(const QString &name, const QString &unit, const QString &mission, | |
31 | const SqpDateTime &dateTime) |
|
31 | const SqpDateTime &dateTime) | |
32 | : impl{spimpl::make_unique_impl<VariablePrivate>(name, unit, mission, dateTime)} |
|
32 | : impl{spimpl::make_unique_impl<VariablePrivate>(name, unit, mission, dateTime)} | |
33 | { |
|
33 | { | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | QString Variable::name() const noexcept |
|
36 | QString Variable::name() const noexcept | |
37 | { |
|
37 | { | |
38 | return impl->m_Name; |
|
38 | return impl->m_Name; | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | QString Variable::mission() const noexcept |
|
41 | QString Variable::mission() const noexcept | |
42 | { |
|
42 | { | |
43 | return impl->m_Mission; |
|
43 | return impl->m_Mission; | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | QString Variable::unit() const noexcept |
|
46 | QString Variable::unit() const noexcept | |
47 | { |
|
47 | { | |
48 | return impl->m_Unit; |
|
48 | return impl->m_Unit; | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | SqpDateTime Variable::dateTime() const noexcept |
|
51 | SqpDateTime Variable::dateTime() const noexcept | |
52 | { |
|
52 | { | |
53 | return impl->m_DateTime; |
|
53 | return impl->m_DateTime; | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | void Variable::setDateTime(const SqpDateTime &dateTime) noexcept |
|
56 | void Variable::setDateTime(const SqpDateTime &dateTime) noexcept | |
57 | { |
|
57 | { | |
58 | impl->m_DateTime = dateTime; |
|
58 | impl->m_DateTime = dateTime; | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept |
|
61 | void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept | |
62 | { |
|
62 | { | |
63 |
qC |
|
63 | qCDebug(LOG_Variable()) << "Variable::setDataSeries" << QThread::currentThread()->objectName(); | |
64 | if (!dataSeries) { |
|
64 | if (!dataSeries) { | |
65 | /// @todo ALX : log |
|
65 | /// @todo ALX : log | |
66 | return; |
|
66 | return; | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | // Inits the data series of the variable |
|
69 | // Inits the data series of the variable | |
70 | if (!impl->m_DataSeries) { |
|
70 | if (!impl->m_DataSeries) { | |
71 | impl->m_DataSeries = dataSeries->clone(); |
|
71 | impl->m_DataSeries = dataSeries->clone(); | |
72 | } |
|
72 | } | |
73 | else { |
|
73 | else { | |
74 | dataSeries->lockWrite(); |
|
74 | dataSeries->lockWrite(); | |
75 | impl->m_DataSeries->lockWrite(); |
|
75 | impl->m_DataSeries->lockWrite(); | |
76 | impl->m_DataSeries->merge(dataSeries.get()); |
|
76 | impl->m_DataSeries->merge(dataSeries.get()); | |
77 | impl->m_DataSeries->unlock(); |
|
77 | impl->m_DataSeries->unlock(); | |
78 | dataSeries->unlock(); |
|
78 | dataSeries->unlock(); | |
79 | emit updated(); |
|
79 | emit updated(); | |
80 | } |
|
80 | } | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | IDataSeries *Variable::dataSeries() const noexcept |
|
83 | IDataSeries *Variable::dataSeries() const noexcept | |
84 | { |
|
84 | { | |
85 | return impl->m_DataSeries.get(); |
|
85 | return impl->m_DataSeries.get(); | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | bool Variable::contains(const SqpDateTime &dateTime) const noexcept |
|
88 | bool Variable::contains(const SqpDateTime &dateTime) const noexcept | |
89 | { |
|
89 | { | |
90 | return impl->m_DateTime.contains(dateTime); |
|
90 | return impl->m_DateTime.contains(dateTime); | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 | bool Variable::intersect(const SqpDateTime &dateTime) const noexcept |
|
93 | bool Variable::intersect(const SqpDateTime &dateTime) const noexcept | |
94 | { |
|
94 | { | |
95 | return impl->m_DateTime.intersect(dateTime); |
|
95 | return impl->m_DateTime.intersect(dateTime); | |
96 | } |
|
96 | } | |
97 |
|
97 | |||
98 | bool Variable::isInside(const SqpDateTime &dateTime) const noexcept |
|
98 | bool Variable::isInside(const SqpDateTime &dateTime) const noexcept | |
99 | { |
|
99 | { | |
100 | return dateTime.contains(SqpDateTime{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd}); |
|
100 | return dateTime.contains(SqpDateTime{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd}); | |
101 | } |
|
101 | } |
@@ -1,228 +1,228 | |||||
1 | #include "Variable/VariableCacheController.h" |
|
1 | #include "Variable/VariableCacheController.h" | |
2 |
|
2 | |||
3 | #include "Variable/Variable.h" |
|
3 | #include "Variable/Variable.h" | |
4 | #include <unordered_map> |
|
4 | #include <unordered_map> | |
5 |
|
5 | |||
6 | #include <QThread> |
|
6 | #include <QThread> | |
7 | Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController") |
|
7 | 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<SqpDateTime> > | |
12 | m_VariableToSqpDateTimeListMap; |
|
12 | m_VariableToSqpDateTimeListMap; | |
13 |
|
13 | |||
14 | void addInCacheDataByEnd(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
14 | void addInCacheDataByEnd(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
15 | QVector<SqpDateTime> ¬InCache, int cacheIndex, |
|
15 | QVector<SqpDateTime> ¬InCache, int cacheIndex, | |
16 | double currentTStart); |
|
16 | double currentTStart); | |
17 |
|
17 | |||
18 | void addInCacheDataByStart(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
18 | void addInCacheDataByStart(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
19 | QVector<SqpDateTime> ¬InCache, int cacheIndex, |
|
19 | QVector<SqpDateTime> ¬InCache, int cacheIndex, | |
20 | double currentTStart); |
|
20 | double currentTStart); | |
21 |
|
21 | |||
22 |
|
22 | |||
23 | void addDateTimeRecurse(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
23 | void addDateTimeRecurse(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
24 | int cacheIndex); |
|
24 | int cacheIndex); | |
25 | }; |
|
25 | }; | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | VariableCacheController::VariableCacheController(QObject *parent) |
|
28 | VariableCacheController::VariableCacheController(QObject *parent) | |
29 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableCacheControllerPrivate>()} |
|
29 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableCacheControllerPrivate>()} | |
30 | { |
|
30 | { | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 | void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, |
|
33 | void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, | |
34 | const SqpDateTime &dateTime) |
|
34 | const SqpDateTime &dateTime) | |
35 | { |
|
35 | { | |
36 |
qC |
|
36 | qCDebug(LOG_VariableCacheController()) << "VariableCacheController::addDateTime" | |
37 | << QThread::currentThread()->objectName(); |
|
37 | << QThread::currentThread()->objectName(); | |
38 | if (variable) { |
|
38 | if (variable) { | |
39 | auto findVariableIte = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
39 | auto findVariableIte = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
40 | if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) { |
|
40 | if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) { | |
41 | impl->m_VariableToSqpDateTimeListMap[variable].push_back(dateTime); |
|
41 | impl->m_VariableToSqpDateTimeListMap[variable].push_back(dateTime); | |
42 | } |
|
42 | } | |
43 | else { |
|
43 | else { | |
44 |
|
44 | |||
45 | // addDateTime modify the list<SqpDateTime> of the variable in a way to ensure |
|
45 | // addDateTime modify the list<SqpDateTime> of the variable in a way to ensure | |
46 | // that the list is ordered : l(0) < l(1). We assume also a < b |
|
46 | // 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) |
|
47 | // (with a & b of type SqpDateTime) means ts(b) > te(a) | |
48 |
|
48 | |||
49 | // The algorithm will try the merge of two interval: |
|
49 | // The algorithm will try the merge of two interval: | |
50 | // - dateTime will be compare with the first interval of the list: |
|
50 | // - dateTime will be compare with the first interval of the list: | |
51 | // A: if it is inferior, it will be inserted and it's finished. |
|
51 | // A: if it is inferior, it will be inserted and it's finished. | |
52 | // B: if it is in intersection, it will be merge then the merged one |
|
52 | // B: if it is in intersection, it will be merge then the merged one | |
53 | // will be compared to the next interval. The old one is remove from the list |
|
53 | // will be compared to the next interval. The old one is remove from the list | |
54 | // C: if it is superior, we do the same with the next interval of the list |
|
54 | // C: if it is superior, we do the same with the next interval of the list | |
55 |
|
55 | |||
56 | try { |
|
56 | try { | |
57 | impl->addDateTimeRecurse(dateTime, |
|
57 | impl->addDateTimeRecurse(dateTime, | |
58 | impl->m_VariableToSqpDateTimeListMap.at(variable), 0); |
|
58 | impl->m_VariableToSqpDateTimeListMap.at(variable), 0); | |
59 | } |
|
59 | } | |
60 | catch (const std::out_of_range &e) { |
|
60 | catch (const std::out_of_range &e) { | |
61 | qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what(); |
|
61 | qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what(); | |
62 | } |
|
62 | } | |
63 | } |
|
63 | } | |
64 | } |
|
64 | } | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | void VariableCacheController::clear(std::shared_ptr<Variable> variable) noexcept |
|
67 | void VariableCacheController::clear(std::shared_ptr<Variable> variable) noexcept | |
68 | { |
|
68 | { | |
69 | if (!variable) { |
|
69 | if (!variable) { | |
70 | qCCritical(LOG_VariableCacheController()) << "Can't clear variable cache: variable is null"; |
|
70 | qCCritical(LOG_VariableCacheController()) << "Can't clear variable cache: variable is null"; | |
71 | return; |
|
71 | return; | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | auto nbEntries = impl->m_VariableToSqpDateTimeListMap.erase(variable); |
|
74 | auto nbEntries = impl->m_VariableToSqpDateTimeListMap.erase(variable); | |
75 |
|
75 | |||
76 | auto clearCacheMessage |
|
76 | auto clearCacheMessage | |
77 | = (nbEntries != 0) |
|
77 | = (nbEntries != 0) | |
78 | ? tr("Variable cache cleared for variable %1").arg(variable->name()) |
|
78 | ? tr("Variable cache cleared for variable %1").arg(variable->name()) | |
79 | : tr("No deletion of variable cache: no cache was associated with the variable"); |
|
79 | : tr("No deletion of variable cache: no cache was associated with the variable"); | |
80 | qCDebug(LOG_VariableCacheController()) << clearCacheMessage; |
|
80 | qCDebug(LOG_VariableCacheController()) << clearCacheMessage; | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 | QVector<SqpDateTime> |
|
83 | QVector<SqpDateTime> | |
84 | VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, |
|
84 | VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, | |
85 | const SqpDateTime &dateTime) |
|
85 | const SqpDateTime &dateTime) | |
86 | { |
|
86 | { | |
87 |
qC |
|
87 | qCDebug(LOG_VariableCacheController()) | |
88 | << "VariableCacheController::provideNotInCacheDateTimeList" |
|
88 | << "VariableCacheController::provideNotInCacheDateTimeList" | |
89 | << QThread::currentThread()->objectName(); |
|
89 | << QThread::currentThread()->objectName(); | |
90 | auto notInCache = QVector<SqpDateTime>{}; |
|
90 | auto notInCache = QVector<SqpDateTime>{}; | |
91 |
|
91 | |||
92 | // This algorithm is recursif. The idea is to localise the start time then the end time in the |
|
92 | // 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 |
|
93 | // 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 |
|
94 | // 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) |
|
95 | // (with a & b of type SqpDateTime) means ts(b) > te(a) | |
96 | auto it = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
96 | auto it = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
97 | if (it != impl->m_VariableToSqpDateTimeListMap.end()) { |
|
97 | if (it != impl->m_VariableToSqpDateTimeListMap.end()) { | |
98 | impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart); |
|
98 | impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart); | |
99 | } |
|
99 | } | |
100 | else { |
|
100 | else { | |
101 | notInCache << dateTime; |
|
101 | notInCache << dateTime; | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | return notInCache; |
|
104 | return notInCache; | |
105 | } |
|
105 | } | |
106 |
|
106 | |||
107 | QVector<SqpDateTime> |
|
107 | QVector<SqpDateTime> | |
108 | VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept |
|
108 | VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept | |
109 | { |
|
109 | { | |
110 |
qC |
|
110 | qCDebug(LOG_VariableCacheController()) << "VariableCacheController::dateCacheList" | |
111 | << QThread::currentThread()->objectName(); |
|
111 | << QThread::currentThread()->objectName(); | |
112 | try { |
|
112 | try { | |
113 | return impl->m_VariableToSqpDateTimeListMap.at(variable); |
|
113 | return impl->m_VariableToSqpDateTimeListMap.at(variable); | |
114 | } |
|
114 | } | |
115 | catch (const std::out_of_range &e) { |
|
115 | catch (const std::out_of_range &e) { | |
116 | qCWarning(LOG_VariableCacheController()) << e.what(); |
|
116 | qCWarning(LOG_VariableCacheController()) << e.what(); | |
117 | return QVector<SqpDateTime>{}; |
|
117 | return QVector<SqpDateTime>{}; | |
118 | } |
|
118 | } | |
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 | void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse( |
|
121 | void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse( | |
122 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, int cacheIndex) |
|
122 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, int cacheIndex) | |
123 | { |
|
123 | { | |
124 | const auto dateTimeListSize = dateTimeList.count(); |
|
124 | const auto dateTimeListSize = dateTimeList.count(); | |
125 | if (cacheIndex >= dateTimeListSize) { |
|
125 | if (cacheIndex >= dateTimeListSize) { | |
126 | dateTimeList.push_back(dateTime); |
|
126 | dateTimeList.push_back(dateTime); | |
127 | // there is no anymore interval to compore, we can just push_back it |
|
127 | // there is no anymore interval to compore, we can just push_back it | |
128 | return; |
|
128 | return; | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | auto currentDateTime = dateTimeList[cacheIndex]; |
|
131 | auto currentDateTime = dateTimeList[cacheIndex]; | |
132 |
|
132 | |||
133 | if (dateTime.m_TEnd < currentDateTime.m_TStart) { |
|
133 | if (dateTime.m_TEnd < currentDateTime.m_TStart) { | |
134 | // The compared one is < to current one compared, we can insert it |
|
134 | // The compared one is < to current one compared, we can insert it | |
135 | dateTimeList.insert(cacheIndex, dateTime); |
|
135 | dateTimeList.insert(cacheIndex, dateTime); | |
136 | } |
|
136 | } | |
137 | else if (dateTime.m_TStart > currentDateTime.m_TEnd) { |
|
137 | else if (dateTime.m_TStart > currentDateTime.m_TEnd) { | |
138 | // The compared one is > to current one compared we can comparet if to the next one |
|
138 | // The compared one is > to current one compared we can comparet if to the next one | |
139 | addDateTimeRecurse(dateTime, dateTimeList, ++cacheIndex); |
|
139 | addDateTimeRecurse(dateTime, dateTimeList, ++cacheIndex); | |
140 | } |
|
140 | } | |
141 | else { |
|
141 | else { | |
142 | // Merge cases: we need to merge the two interval, remove the old one from the list then |
|
142 | // Merge cases: we need to merge the two interval, remove the old one from the list then | |
143 | // rerun the algo from this index with the merged interval |
|
143 | // rerun the algo from this index with the merged interval | |
144 | auto mTStart = std::min(dateTime.m_TStart, currentDateTime.m_TStart); |
|
144 | auto mTStart = std::min(dateTime.m_TStart, currentDateTime.m_TStart); | |
145 | auto mTEnd = std::max(dateTime.m_TEnd, currentDateTime.m_TEnd); |
|
145 | auto mTEnd = std::max(dateTime.m_TEnd, currentDateTime.m_TEnd); | |
146 | auto mergeDateTime = SqpDateTime{mTStart, mTEnd}; |
|
146 | auto mergeDateTime = SqpDateTime{mTStart, mTEnd}; | |
147 |
|
147 | |||
148 | dateTimeList.remove(cacheIndex); |
|
148 | dateTimeList.remove(cacheIndex); | |
149 | addDateTimeRecurse(mergeDateTime, dateTimeList, cacheIndex); |
|
149 | addDateTimeRecurse(mergeDateTime, dateTimeList, cacheIndex); | |
150 | } |
|
150 | } | |
151 | } |
|
151 | } | |
152 |
|
152 | |||
153 |
|
153 | |||
154 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEnd( |
|
154 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEnd( | |
155 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
155 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
156 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) |
|
156 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) | |
157 | { |
|
157 | { | |
158 | const auto dateTimeListSize = dateTimeList.count(); |
|
158 | const auto dateTimeListSize = dateTimeList.count(); | |
159 | if (cacheIndex >= dateTimeListSize) { |
|
159 | if (cacheIndex >= dateTimeListSize) { | |
160 | if (currentTStart < dateTime.m_TEnd) { |
|
160 | if (currentTStart < dateTime.m_TEnd) { | |
161 |
|
161 | |||
162 | // te localised after all other interval: The last interval is [currentTsart, te] |
|
162 | // te localised after all other interval: The last interval is [currentTsart, te] | |
163 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); |
|
163 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); | |
164 | } |
|
164 | } | |
165 | return; |
|
165 | return; | |
166 | } |
|
166 | } | |
167 |
|
167 | |||
168 | auto currentDateTimeJ = dateTimeList[cacheIndex]; |
|
168 | auto currentDateTimeJ = dateTimeList[cacheIndex]; | |
169 | if (dateTime.m_TEnd <= currentDateTimeJ.m_TStart) { |
|
169 | if (dateTime.m_TEnd <= currentDateTimeJ.m_TStart) { | |
170 | // te localised between to interval: The last interval is [currentTsart, te] |
|
170 | // te localised between to interval: The last interval is [currentTsart, te] | |
171 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); |
|
171 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); | |
172 | } |
|
172 | } | |
173 | else { |
|
173 | else { | |
174 | notInCache.push_back(SqpDateTime{currentTStart, currentDateTimeJ.m_TStart}); |
|
174 | notInCache.push_back(SqpDateTime{currentTStart, currentDateTimeJ.m_TStart}); | |
175 | if (dateTime.m_TEnd > currentDateTimeJ.m_TEnd) { |
|
175 | if (dateTime.m_TEnd > currentDateTimeJ.m_TEnd) { | |
176 | // te not localised before the current interval: we need to look at the next interval |
|
176 | // te not localised before the current interval: we need to look at the next interval | |
177 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, ++cacheIndex, |
|
177 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, ++cacheIndex, | |
178 | currentDateTimeJ.m_TEnd); |
|
178 | currentDateTimeJ.m_TEnd); | |
179 | } |
|
179 | } | |
180 | } |
|
180 | } | |
181 | } |
|
181 | } | |
182 |
|
182 | |||
183 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByStart( |
|
183 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByStart( | |
184 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
184 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
185 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) |
|
185 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) | |
186 | { |
|
186 | { | |
187 | const auto dateTimeListSize = dateTimeList.count(); |
|
187 | const auto dateTimeListSize = dateTimeList.count(); | |
188 | if (cacheIndex >= dateTimeListSize) { |
|
188 | if (cacheIndex >= dateTimeListSize) { | |
189 | // ts localised after all other interval: The last interval is [ts, te] |
|
189 | // ts localised after all other interval: The last interval is [ts, te] | |
190 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); |
|
190 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); | |
191 | return; |
|
191 | return; | |
192 | } |
|
192 | } | |
193 |
|
193 | |||
194 | auto currentDateTimeI = dateTimeList[cacheIndex]; |
|
194 | auto currentDateTimeI = dateTimeList[cacheIndex]; | |
195 | if (currentTStart < currentDateTimeI.m_TStart) { |
|
195 | if (currentTStart < currentDateTimeI.m_TStart) { | |
196 |
|
196 | |||
197 | // ts localised between to interval: let's localized te |
|
197 | // ts localised between to interval: let's localized te | |
198 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, cacheIndex, currentTStart); |
|
198 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, cacheIndex, currentTStart); | |
199 | } |
|
199 | } | |
200 | else if (currentTStart < currentDateTimeI.m_TEnd) { |
|
200 | else if (currentTStart < currentDateTimeI.m_TEnd) { | |
201 | if (dateTime.m_TEnd > currentDateTimeI.m_TEnd) { |
|
201 | if (dateTime.m_TEnd > currentDateTimeI.m_TEnd) { | |
202 | // ts not localised before the current interval: we need to look at the next interval |
|
202 | // ts not localised before the current interval: we need to look at the next interval | |
203 | // We can assume now current tstart is the last interval tend, because data between them |
|
203 | // We can assume now current tstart is the last interval tend, because data between them | |
204 | // are |
|
204 | // are | |
205 | // in the cache |
|
205 | // in the cache | |
206 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, |
|
206 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, | |
207 | currentDateTimeI.m_TEnd); |
|
207 | currentDateTimeI.m_TEnd); | |
208 | } |
|
208 | } | |
209 | } |
|
209 | } | |
210 | else { |
|
210 | else { | |
211 | // ts not localised before the current interval: we need to look at the next interval |
|
211 | // ts not localised before the current interval: we need to look at the next interval | |
212 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, currentTStart); |
|
212 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, currentTStart); | |
213 | } |
|
213 | } | |
214 | } |
|
214 | } | |
215 |
|
215 | |||
216 |
|
216 | |||
217 | void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) const |
|
217 | void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) const | |
218 | { |
|
218 | { | |
219 | auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
219 | auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
220 | if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) { |
|
220 | if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) { | |
221 | qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache") |
|
221 | qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache") | |
222 | << variableDateTimeList->second; |
|
222 | << variableDateTimeList->second; | |
223 | } |
|
223 | } | |
224 | else { |
|
224 | else { | |
225 | qCWarning(LOG_VariableCacheController()) |
|
225 | qCWarning(LOG_VariableCacheController()) | |
226 | << tr("Cannot display a variable that is not in the cache"); |
|
226 | << tr("Cannot display a variable that is not in the cache"); | |
227 | } |
|
227 | } | |
228 | } |
|
228 | } |
@@ -1,160 +1,160 | |||||
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 |
|
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 |
qC |
|
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-> |
|
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(); |
|
72 | component->rescaleAxes(); | |
73 | component->parentPlot()->replot(); |
|
73 | component->parentPlot()->replot(); | |
74 | } |
|
74 | } | |
75 | else { |
|
75 | else { | |
76 | /// @todo DEBUG |
|
76 | /// @todo DEBUG | |
77 | } |
|
77 | } | |
78 | } |
|
78 | } | |
79 |
|
79 | |||
80 | QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QCustomPlot &plot, |
|
80 | QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QCustomPlot &plot, | |
81 | const SqpDateTime &dateTime) |
|
81 | const SqpDateTime &dateTime) | |
82 | { |
|
82 | { | |
83 | auto component = plot.addGraph(); |
|
83 | auto component = plot.addGraph(); | |
84 |
|
84 | |||
85 | if (component) { |
|
85 | if (component) { | |
86 | // // Graph data |
|
86 | // // Graph data | |
87 | component->setData(scalarSeries.xAxisData()->data(), scalarSeries.valuesData()->data(), |
|
87 | component->setData(scalarSeries.xAxisData()->data(), scalarSeries.valuesData()->data(), | |
88 | true); |
|
88 | true); | |
89 |
|
89 | |||
90 | updateScalarData(component, scalarSeries, dateTime); |
|
90 | updateScalarData(component, scalarSeries, dateTime); | |
91 |
|
91 | |||
92 | // Axes properties |
|
92 | // Axes properties | |
93 | /// @todo : for the moment, no control is performed on the axes: the units and the tickers |
|
93 | /// @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 |
|
94 | /// are fixed for the default x-axis and y-axis of the plot, and according to the new graph | |
95 |
|
95 | |||
96 | auto setAxisProperties = [](auto axis, const auto &unit) { |
|
96 | auto setAxisProperties = [](auto axis, const auto &unit) { | |
97 | // label (unit name) |
|
97 | // label (unit name) | |
98 | axis->setLabel(unit.m_Name); |
|
98 | axis->setLabel(unit.m_Name); | |
99 |
|
99 | |||
100 | // ticker (depending on the type of unit) |
|
100 | // ticker (depending on the type of unit) | |
101 | axis->setTicker(axisTicker(unit.m_TimeUnit)); |
|
101 | axis->setTicker(axisTicker(unit.m_TimeUnit)); | |
102 | }; |
|
102 | }; | |
103 | setAxisProperties(plot.xAxis, scalarSeries.xAxisUnit()); |
|
103 | setAxisProperties(plot.xAxis, scalarSeries.xAxisUnit()); | |
104 | setAxisProperties(plot.yAxis, scalarSeries.valuesUnit()); |
|
104 | setAxisProperties(plot.yAxis, scalarSeries.valuesUnit()); | |
105 |
|
105 | |||
106 | // Display all data |
|
106 | // Display all data | |
107 | component->rescaleAxes(); |
|
107 | component->rescaleAxes(); | |
108 | plot.replot(); |
|
108 | plot.replot(); | |
109 | } |
|
109 | } | |
110 | else { |
|
110 | else { | |
111 | qCDebug(LOG_VisualizationGraphHelper()) |
|
111 | qCDebug(LOG_VisualizationGraphHelper()) | |
112 | << QObject::tr("Can't create graph for the scalar series"); |
|
112 | << QObject::tr("Can't create graph for the scalar series"); | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | return component; |
|
115 | return component; | |
116 | } |
|
116 | } | |
117 |
|
117 | |||
118 | } // namespace |
|
118 | } // namespace | |
119 |
|
119 | |||
120 | QVector<QCPAbstractPlottable *> VisualizationGraphHelper::create(std::shared_ptr<Variable> variable, |
|
120 | QVector<QCPAbstractPlottable *> VisualizationGraphHelper::create(std::shared_ptr<Variable> variable, | |
121 | QCustomPlot &plot) noexcept |
|
121 | QCustomPlot &plot) noexcept | |
122 | { |
|
122 | { | |
123 | auto result = QVector<QCPAbstractPlottable *>{}; |
|
123 | auto result = QVector<QCPAbstractPlottable *>{}; | |
124 |
|
124 | |||
125 | if (variable) { |
|
125 | if (variable) { | |
126 | // Gets the data series of the variable to call the creation of the right components |
|
126 | // Gets the data series of the variable to call the creation of the right components | |
127 | // according to its type |
|
127 | // according to its type | |
128 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(variable->dataSeries())) { |
|
128 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(variable->dataSeries())) { | |
129 | result.append(createScalarSeriesComponent(*scalarSeries, plot, variable->dateTime())); |
|
129 | result.append(createScalarSeriesComponent(*scalarSeries, plot, variable->dateTime())); | |
130 | } |
|
130 | } | |
131 | else { |
|
131 | else { | |
132 | qCDebug(LOG_VisualizationGraphHelper()) |
|
132 | qCDebug(LOG_VisualizationGraphHelper()) | |
133 | << QObject::tr("Can't create graph plottables : unmanaged data series type"); |
|
133 | << QObject::tr("Can't create graph plottables : unmanaged data series type"); | |
134 | } |
|
134 | } | |
135 | } |
|
135 | } | |
136 | else { |
|
136 | else { | |
137 | qCDebug(LOG_VisualizationGraphHelper()) |
|
137 | qCDebug(LOG_VisualizationGraphHelper()) | |
138 | << QObject::tr("Can't create graph plottables : the variable is null"); |
|
138 | << QObject::tr("Can't create graph plottables : the variable is null"); | |
139 | } |
|
139 | } | |
140 |
|
140 | |||
141 | return result; |
|
141 | return result; | |
142 | } |
|
142 | } | |
143 |
|
143 | |||
144 | void VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *> plotableVect, |
|
144 | void VisualizationGraphHelper::updateData(QVector<QCPAbstractPlottable *> plotableVect, | |
145 | IDataSeries *dataSeries, const SqpDateTime &dateTime) |
|
145 | IDataSeries *dataSeries, const SqpDateTime &dateTime) | |
146 | { |
|
146 | { | |
147 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(dataSeries)) { |
|
147 | if (auto scalarSeries = dynamic_cast<ScalarSeries *>(dataSeries)) { | |
148 | if (plotableVect.size() == 1) { |
|
148 | if (plotableVect.size() == 1) { | |
149 | updateScalarData(plotableVect.at(0), *scalarSeries, dateTime); |
|
149 | updateScalarData(plotableVect.at(0), *scalarSeries, dateTime); | |
150 | } |
|
150 | } | |
151 | else { |
|
151 | else { | |
152 | qCCritical(LOG_VisualizationGraphHelper()) << QObject::tr( |
|
152 | qCCritical(LOG_VisualizationGraphHelper()) << QObject::tr( | |
153 | "Can't update Data of a scalarSeries because there is not only one component " |
|
153 | "Can't update Data of a scalarSeries because there is not only one component " | |
154 | "associated"); |
|
154 | "associated"); | |
155 | } |
|
155 | } | |
156 | } |
|
156 | } | |
157 | else { |
|
157 | else { | |
158 | /// @todo DEBUG |
|
158 | /// @todo DEBUG | |
159 | } |
|
159 | } | |
160 | } |
|
160 | } |
@@ -1,50 +1,50 | |||||
1 | #include "CosinusProvider.h" |
|
1 | #include "CosinusProvider.h" | |
2 |
|
2 | |||
3 | #include <Data/DataProviderParameters.h> |
|
3 | #include <Data/DataProviderParameters.h> | |
4 | #include <Data/ScalarSeries.h> |
|
4 | #include <Data/ScalarSeries.h> | |
5 |
|
5 | |||
6 | #include <cmath> |
|
6 | #include <cmath> | |
7 |
|
7 | |||
8 | #include <QDateTime> |
|
8 | #include <QDateTime> | |
9 | #include <QThread> |
|
9 | #include <QThread> | |
10 |
|
10 | |||
11 | Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider") |
|
11 | Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider") | |
12 |
|
12 | |||
13 | std::shared_ptr<IDataSeries> |
|
13 | std::shared_ptr<IDataSeries> | |
14 | CosinusProvider::retrieveData(const DataProviderParameters ¶meters) const |
|
14 | CosinusProvider::retrieveData(const DataProviderParameters ¶meters) const | |
15 | { |
|
15 | { | |
16 | auto dateTime = parameters.m_Time; |
|
16 | auto dateTime = parameters.m_Time; | |
17 |
|
17 | |||
18 | auto dataIndex = 0; |
|
18 | auto dataIndex = 0; | |
19 |
|
19 | |||
20 | // Gets the timerange from the parameters |
|
20 | // Gets the timerange from the parameters | |
21 | double freq = 100.0; |
|
21 | double freq = 100.0; | |
22 | double start = dateTime.m_TStart * freq; // 100 htz |
|
22 | double start = dateTime.m_TStart * freq; // 100 htz | |
23 | double end = dateTime.m_TEnd * freq; // 100 htz |
|
23 | double end = dateTime.m_TEnd * freq; // 100 htz | |
24 |
|
24 | |||
25 | // We assure that timerange is valid |
|
25 | // We assure that timerange is valid | |
26 | if (end < start) { |
|
26 | if (end < start) { | |
27 | std::swap(start, end); |
|
27 | std::swap(start, end); | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | // Generates scalar series containing cosinus values (one value per second) |
|
30 | // Generates scalar series containing cosinus values (one value per second) | |
31 | auto scalarSeries |
|
31 | auto scalarSeries | |
32 | = std::make_shared<ScalarSeries>(end - start, Unit{QStringLiteral("t"), true}, Unit{}); |
|
32 | = std::make_shared<ScalarSeries>(end - start, Unit{QStringLiteral("t"), true}, Unit{}); | |
33 |
|
33 | |||
34 | for (auto time = start; time < end; ++time, ++dataIndex) { |
|
34 | for (auto time = start; time < end; ++time, ++dataIndex) { | |
35 | const auto timeOnFreq = time / freq; |
|
35 | const auto timeOnFreq = time / freq; | |
36 | scalarSeries->setData(dataIndex, timeOnFreq, std::cos(timeOnFreq)); |
|
36 | scalarSeries->setData(dataIndex, timeOnFreq, std::cos(timeOnFreq)); | |
37 | } |
|
37 | } | |
38 | return scalarSeries; |
|
38 | return scalarSeries; | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | void CosinusProvider::requestDataLoading(const QVector<SqpDateTime> &dateTimeList) |
|
41 | void CosinusProvider::requestDataLoading(const QVector<SqpDateTime> &dateTimeList) | |
42 | { |
|
42 | { | |
43 |
qC |
|
43 | qCDebug(LOG_CosinusProvider()) << "CosinusProvider::requestDataLoading" | |
44 | << QThread::currentThread()->objectName(); |
|
44 | << QThread::currentThread()->objectName(); | |
45 | // NOTE: Try to use multithread if possible |
|
45 | // NOTE: Try to use multithread if possible | |
46 | for (const auto &dateTime : dateTimeList) { |
|
46 | for (const auto &dateTime : dateTimeList) { | |
47 | auto scalarSeries = this->retrieveData(DataProviderParameters{dateTime}); |
|
47 | auto scalarSeries = this->retrieveData(DataProviderParameters{dateTime}); | |
48 | emit dataProvided(scalarSeries, dateTime); |
|
48 | emit dataProvided(scalarSeries, dateTime); | |
49 | } |
|
49 | } | |
50 | } |
|
50 | } |
General Comments 0
You need to be logged in to leave comments.
Login now