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