##// END OF EJS Templates
Merge branch 'feature/SqpDateTimeToSqpRange' into develop
perrinel -
r513:333dc2b889b2 merge
parent child
Show More
@@ -202,8 +202,8 MainWindow::MainWindow(QWidget *parent)
202 202 // /////////// //
203 203
204 204 // Controllers / controllers connections
205 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)),
206 &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime)));
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(SqpDateTime)), &sqpApp->timeController(),
216 SLOT(onTimeToUpdate(SqpDateTime)));
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 SqpDateTime &)), m_Ui->view,
225 SLOT(onRangeChanged(std::shared_ptr<Variable>, const SqpDateTime &)));
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 "SqpDateTime.h"
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<SqpDateTime> m_Times;
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/SqpDateTime.h>
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 SqpDateTime &dateTime);
52 const SqpRange &dateTime);
53 53
54 54 /**
55 55 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
@@ -1,5 +1,5
1 #ifndef SCIQLOP_SQPDATETIME_H
2 #define SCIQLOP_SQPDATETIME_H
1 #ifndef SCIQLOP_SQPRANGE_H
2 #define SCIQLOP_SQPRANGE_H
3 3
4 4 #include <QObject>
5 5
@@ -9,26 +9,26
9 9 #include <Common/MetaTypes.h>
10 10
11 11 /**
12 * @brief The SqpDateTime struct holds the information of time parameters
12 * @brief The SqpRange struct holds the information of time parameters
13 13 */
14 struct SqpDateTime {
14 struct SqpRange {
15 15 /// Start time (UTC)
16 16 double m_TStart;
17 17 /// End time (UTC)
18 18 double m_TEnd;
19 19
20 bool contains(const SqpDateTime &dateTime) const noexcept
20 bool contains(const SqpRange &dateTime) const noexcept
21 21 {
22 22 return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd);
23 23 }
24 24
25 bool intersect(const SqpDateTime &dateTime) const noexcept
25 bool intersect(const SqpRange &dateTime) const noexcept
26 26 {
27 27 return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd);
28 28 }
29 29 };
30 30
31 inline QDebug operator<<(QDebug d, SqpDateTime obj)
31 inline QDebug operator<<(QDebug d, SqpRange obj)
32 32 {
33 33 auto tendDateTimeStart = DateUtils::dateTime(obj.m_TStart);
34 34 auto tendDateTimeEnd = DateUtils::dateTime(obj.m_TEnd);
@@ -38,6 +38,6 inline QDebug operator<<(QDebug d, SqpDateTime obj)
38 38 }
39 39
40 40 // Required for using shared_ptr in signals/slots
41 SCIQLOP_REGISTER_META_TYPE(SQPDATETIME_REGISTRY, SqpDateTime)
41 SCIQLOP_REGISTER_META_TYPE(SQPRANGE_REGISTRY, SqpRange)
42 42
43 #endif // SCIQLOP_SQPDATETIME_H
43 #endif // SCIQLOP_SQPRANGE_H
@@ -3,7 +3,7
3 3
4 4 #include "CoreGlobal.h"
5 5
6 #include <Data/SqpDateTime.h>
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 SqpDateTime dateTime() const noexcept;
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(SqpDateTime time);
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(SqpDateTime dateTime);
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/SqpDateTime.h>
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 SqpDateTime &dateTime,
27 explicit Variable(const QString &name, const SqpRange &dateTime,
28 28 const QVariantHash &metadata = {});
29 29
30 30 QString name() const noexcept;
31 SqpDateTime dateTime() const noexcept;
32 void setDateTime(const SqpDateTime &dateTime) noexcept;
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 SqpDateTime &dateTime) const noexcept;
40 bool intersect(const SqpDateTime &dateTime) const noexcept;
41 bool isInside(const SqpDateTime &dateTime) const noexcept;
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/SqpDateTime.h>
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 SqpDateTime &dateTime);
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<SqpDateTime> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
33 const SqpDateTime &dateTime);
32 QVector<SqpRange> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
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 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/SqpDateTime.h>
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 SqpDateTime &range);
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 SqpDateTime &dateTime);
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 SqpDateTime &dateTime);
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/SqpDateTime.h>
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 SqpDateTime &dateTime,
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/SqpDateTime.h>
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 SqpDateTime &range);
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 SqpDateTime m_DateTime;
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 SqpDateTime TimeController::dateTime() const noexcept
16 SqpRange TimeController::dateTime() const noexcept
17 17 {
18 18 return impl->m_DateTime;
19 19 }
20 20
21 void TimeController::onTimeToUpdate(SqpDateTime dateTime)
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/SqpDateTime.h>
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 SqpDateTime &dateTime,
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 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 21 QVariantHash m_Metadata;
22 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 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 SqpDateTime Variable::dateTime() const noexcept
35 SqpRange Variable::dateTime() const noexcept
36 36 {
37 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 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 SqpDateTime &dateTime) const noexcept
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 SqpDateTime &dateTime) const noexcept
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 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 9 struct VariableCacheController::VariableCacheControllerPrivate {
10 10
11 std::unordered_map<std::shared_ptr<Variable>, QVector<SqpDateTime> >
12 m_VariableToSqpDateTimeListMap;
11 std::unordered_map<std::shared_ptr<Variable>, QVector<SqpRange> > m_VariableToSqpRangeListMap;
13 12
14 void addInCacheDataByEnd(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
15 QVector<SqpDateTime> &notInCache, int cacheIndex,
16 double currentTStart);
13 void addInCacheDataByEnd(const SqpRange &dateTime, QVector<SqpRange> &dateTimeList,
14 QVector<SqpRange> &notInCache, int cacheIndex, double currentTStart);
17 15
18 void addInCacheDataByStart(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
19 QVector<SqpDateTime> &notInCache, int cacheIndex,
20 double currentTStart);
16 void addInCacheDataByStart(const SqpRange &dateTime, QVector<SqpRange> &dateTimeList,
17 QVector<SqpRange> &notInCache, int cacheIndex, 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 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 SqpDateTime &dateTime)
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_VariableToSqpDateTimeListMap.find(variable);
40 if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) {
41 impl->m_VariableToSqpDateTimeListMap[variable].push_back(dateTime);
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<SqpDateTime> of the variable in a way to ensure
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 SqpDateTime) means ts(b) > te(a)
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 impl->m_VariableToSqpDateTimeListMap.at(variable), 0);
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_VariableToSqpDateTimeListMap.erase(variable);
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<SqpDateTime>
80 QVector<SqpRange>
84 81 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
85 const SqpDateTime &dateTime)
82 const SqpRange &dateTime)
86 83 {
87 84 qCDebug(LOG_VariableCacheController())
88 85 << "VariableCacheController::provideNotInCacheDateTimeList"
89 86 << QThread::currentThread()->objectName();
90 auto notInCache = QVector<SqpDateTime>{};
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 SqpDateTime) means ts(b) > te(a)
96 auto it = impl->m_VariableToSqpDateTimeListMap.find(variable);
97 if (it != impl->m_VariableToSqpDateTimeListMap.end()) {
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<SqpDateTime>
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_VariableToSqpDateTimeListMap.at(variable);
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<SqpDateTime>{};
114 return QVector<SqpRange>{};
118 115 }
119 116 }
120 117
121 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 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 = SqpDateTime{mTStart, mTEnd};
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 SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
156 QVector<SqpDateTime> &notInCache, int cacheIndex, double currentTStart)
152 const SqpRange &dateTime, QVector<SqpRange> &dateTimeList, QVector<SqpRange> &notInCache,
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(SqpDateTime{currentTStart, dateTime.m_TEnd});
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(SqpDateTime{currentTStart, dateTime.m_TEnd});
168 notInCache.push_back(SqpRange{currentTStart, dateTime.m_TEnd});
172 169 }
173 170 else {
174 notInCache.push_back(SqpDateTime{currentTStart, currentDateTimeJ.m_TStart});
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 SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList,
185 QVector<SqpDateTime> &notInCache, int cacheIndex, double currentTStart)
181 const SqpRange &dateTime, QVector<SqpRange> &dateTimeList, QVector<SqpRange> &notInCache,
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(SqpDateTime{currentTStart, dateTime.m_TEnd});
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_VariableToSqpDateTimeListMap.find(variable);
220 if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) {
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 SqpDateTime &dateTime)
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 SqpDateTime &dateTime)
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 SqpDateTime &dateTime,
63 const SqpRange &dateTime,
64 64 const QVariantHash &metadata) noexcept
65 65 {
66 66 auto insertIndex = rowCount();
@@ -22,17 +22,17 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 = SqpDateTime{static_cast<double>(ts0.toMSecsSinceEpoch()),
25 auto sqp0 = SqpRange{static_cast<double>(ts0.toMSecsSinceEpoch()),
26 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 = SqpDateTime{static_cast<double>(ts1.toMSecsSinceEpoch()),
30 auto sqp1 = SqpRange{static_cast<double>(ts1.toMSecsSinceEpoch()),
31 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 = SqpDateTime{static_cast<double>(ts2.toMSecsSinceEpoch()),
35 auto sqp2 = SqpRange{static_cast<double>(ts2.toMSecsSinceEpoch()),
36 36 static_cast<double>(te2.toMSecsSinceEpoch())};
37 37
38 38 auto var0 = std::make_shared<Variable>("", sqp0);
@@ -44,7 +44,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
47 auto sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
48 48 static_cast<double>(te.toMSecsSinceEpoch())};
49 49
50 50
@@ -59,7 +59,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
62 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
63 63 static_cast<double>(te.toMSecsSinceEpoch())};
64 64
65 65
@@ -73,7 +73,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
76 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
77 77 static_cast<double>(te.toMSecsSinceEpoch())};
78 78
79 79
@@ -91,7 +91,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
94 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
95 95 static_cast<double>(te.toMSecsSinceEpoch())};
96 96
97 97
@@ -109,7 +109,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
112 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
113 113 static_cast<double>(te.toMSecsSinceEpoch())};
114 114
115 115
@@ -136,7 +136,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
139 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
140 140 static_cast<double>(te.toMSecsSinceEpoch())};
141 141
142 142
@@ -150,7 +150,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
153 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
154 154 static_cast<double>(te.toMSecsSinceEpoch())};
155 155
156 156
@@ -164,7 +164,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
167 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
168 168 static_cast<double>(te.toMSecsSinceEpoch())};
169 169
170 170
@@ -178,7 +178,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
181 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
182 182 static_cast<double>(te.toMSecsSinceEpoch())};
183 183
184 184
@@ -192,7 +192,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
195 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
196 196 static_cast<double>(te.toMSecsSinceEpoch())};
197 197
198 198
@@ -206,7 +206,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
209 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
210 210 static_cast<double>(te.toMSecsSinceEpoch())};
211 211
212 212
@@ -228,7 +228,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
231 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
232 232 static_cast<double>(te.toMSecsSinceEpoch())};
233 233
234 234 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -246,7 +246,7 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 = SqpDateTime{static_cast<double>(ts.toMSecsSinceEpoch()),
249 sqp = SqpRange{static_cast<double>(ts.toMSecsSinceEpoch()),
250 250 static_cast<double>(te.toMSecsSinceEpoch())};
251 251
252 252 notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp);
@@ -260,32 +260,32 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 = SqpDateTime{static_cast<double>(ts0.toMSecsSinceEpoch()),
263 auto sqp0 = SqpRange{static_cast<double>(ts0.toMSecsSinceEpoch()),
264 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 = SqpDateTime{static_cast<double>(ts1.toMSecsSinceEpoch()),
268 auto sqp1 = SqpRange{static_cast<double>(ts1.toMSecsSinceEpoch()),
269 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 = SqpDateTime{static_cast<double>(ts2.toMSecsSinceEpoch()),
273 auto sqp2 = SqpRange{static_cast<double>(ts2.toMSecsSinceEpoch()),
274 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 = SqpDateTime{static_cast<double>(ts01.toMSecsSinceEpoch()),
278 auto sqp01 = SqpRange{static_cast<double>(ts01.toMSecsSinceEpoch()),
279 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 = SqpDateTime{static_cast<double>(ts3.toMSecsSinceEpoch()),
283 auto sqp3 = SqpRange{static_cast<double>(ts3.toMSecsSinceEpoch()),
284 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 = SqpDateTime{static_cast<double>(ts03.toMSecsSinceEpoch()),
288 auto sqp03 = SqpRange{static_cast<double>(ts03.toMSecsSinceEpoch()),
289 289 static_cast<double>(te03.toMSecsSinceEpoch())};
290 290
291 291
@@ -3,7 +3,7
3 3
4 4 #include <QWidget>
5 5
6 #include <Data/SqpDateTime.h>
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(SqpDateTime time);
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/SqpDateTime.h>
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 SqpDateTime &dateTime);
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 SqpDateTime;
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 SqpDateTime &range);
43 SqpDateTime graphRange() const noexcept;
44 void setGraphRange(const SqpDateTime &range);
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 SqpDateTime &dateTime);
55 void synchronize(const SqpDateTime &dateTime, const SqpDateTime &oldDateTime,
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/SqpDateTime.h>
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 SqpDateTime &range) noexcept;
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/SqpDateTime.h>
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 SqpDateTime &range);
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 SqpDateTime &)),
42 SIGNAL(rangeChanged(std::shared_ptr<Variable>, const SqpRange &)),
43 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 47 m_DataSourceController->moveToThread(&m_DataSourceControllerThread);
@@ -29,7 +29,7 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 = SqpDateTime{DateUtils::secondsSinceEpoch(startDateTime),
32 auto dateTime = SqpRange{DateUtils::secondsSinceEpoch(startDateTime),
33 33 DateUtils::secondsSinceEpoch(endDateTime)};
34 34
35 35 sqpApp->timeController().onTimeToUpdate(dateTime);
@@ -43,7 +43,7 TimeWidget::~TimeWidget()
43 43
44 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 47 DateUtils::secondsSinceEpoch(ui->endDateTimeEdit->dateTime())};
48 48
49 49 emit timeUpdated(std::move(dateTime));
@@ -36,7 +36,7 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis)
36 36 }
37 37
38 38 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSeries,
39 const SqpDateTime &dateTime)
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 SqpDateTime &dateTime)
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 SqpDateTime &dateTime)
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 = SqpDateTime{grapheRange.lower, grapheRange.upper};
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 SqpDateTime VisualizationGraphWidget::graphRange() const noexcept
173 SqpRange VisualizationGraphWidget::graphRange() const noexcept
175 174 {
176 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 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 = SqpDateTime{t1.lower, t1.upper};
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 = SqpDateTime{t2.lower, t2.upper};
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 = SqpDateTime{grapheRange.lower, grapheRange.upper};
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 SqpDateTime &range) noexcept
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/SqpDateTime.h"
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 SqpDateTime &dateTime,
74 const SqpDateTime &oldDateTime,
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 SqpDateTime m_Range;
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 SqpDateTime &dateTime, const QVariantHash &data);
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 sqpDateTime) noexcept
33 QString dateFormat(double sqpRange) noexcept
34 34 {
35 auto dateTime = DateUtils::dateTime(sqpDateTime);
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 SqpDateTime &dateTime, const QVariantHash &data)
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 SqpDateTime &dateTime);
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 SqpDateTime &dateTime)
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