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