From 333dc2b889b26af0abbc9ab7c7aa9296ef847236 2017-08-07 09:19:35 From: mperrinel Date: 2017-08-07 09:19:35 Subject: [PATCH] Merge branch 'feature/SqpDateTimeToSqpRange' into develop --- diff --git a/app/src/MainWindow.cpp b/app/src/MainWindow.cpp index 80c94f6..09f7870 100644 --- a/app/src/MainWindow.cpp +++ b/app/src/MainWindow.cpp @@ -202,8 +202,8 @@ MainWindow::MainWindow(QWidget *parent) // /////////// // // Controllers / controllers connections - connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)), - &sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime))); + connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpRange)), &sqpApp->variableController(), + SLOT(onDateTimeOnSelection(SqpRange))); // Widgets / controllers connections @@ -212,8 +212,8 @@ MainWindow::MainWindow(QWidget *parent) m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); // Time - connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(), - SLOT(onTimeToUpdate(SqpDateTime))); + connect(timeWidget, SIGNAL(timeUpdated(SqpRange)), &sqpApp->timeController(), + SLOT(onTimeToUpdate(SqpRange))); // Visualization connect(&sqpApp->visualizationController(), @@ -221,8 +221,8 @@ MainWindow::MainWindow(QWidget *parent) SLOT(onVariableAboutToBeDeleted(std::shared_ptr))); connect(&sqpApp->visualizationController(), - SIGNAL(rangeChanged(std::shared_ptr, const SqpDateTime &)), m_Ui->view, - SLOT(onRangeChanged(std::shared_ptr, const SqpDateTime &))); + SIGNAL(rangeChanged(std::shared_ptr, const SqpRange &)), m_Ui->view, + SLOT(onRangeChanged(std::shared_ptr, const SqpRange &))); // Widgets / widgets connections diff --git a/core/include/Data/DataProviderParameters.h b/core/include/Data/DataProviderParameters.h index 1ffc96b..3a6c0de 100644 --- a/core/include/Data/DataProviderParameters.h +++ b/core/include/Data/DataProviderParameters.h @@ -1,7 +1,7 @@ #ifndef SCIQLOP_DATAPROVIDERPARAMETERS_H #define SCIQLOP_DATAPROVIDERPARAMETERS_H -#include "SqpDateTime.h" +#include "SqpRange.h" /** * @brief The DataProviderParameters struct holds the information needed to retrieve data from a @@ -10,7 +10,7 @@ */ struct DataProviderParameters { /// Times for which retrieve data - QVector m_Times; + QVector m_Times; /// Extra data that can be used by the provider to retrieve data QVariantHash m_Data; }; diff --git a/core/include/Data/IDataProvider.h b/core/include/Data/IDataProvider.h index 0648402..a819162 100644 --- a/core/include/Data/IDataProvider.h +++ b/core/include/Data/IDataProvider.h @@ -10,7 +10,7 @@ #include -#include +#include #include @@ -49,7 +49,7 @@ signals: * identified by identifier */ void dataProvided(QUuid identifier, std::shared_ptr dateSerie, - const SqpDateTime &dateTime); + const SqpRange &dateTime); /** * @brief dataProvided send dataSeries under dateTime and that corresponds of the data diff --git a/core/include/Data/SqpDateTime.h b/core/include/Data/SqpRange.h similarity index 72% rename from core/include/Data/SqpDateTime.h rename to core/include/Data/SqpRange.h index b4c51c5..c6d8de8 100644 --- a/core/include/Data/SqpDateTime.h +++ b/core/include/Data/SqpRange.h @@ -1,5 +1,5 @@ -#ifndef SCIQLOP_SQPDATETIME_H -#define SCIQLOP_SQPDATETIME_H +#ifndef SCIQLOP_SQPRANGE_H +#define SCIQLOP_SQPRANGE_H #include @@ -9,26 +9,26 @@ #include /** - * @brief The SqpDateTime struct holds the information of time parameters + * @brief The SqpRange struct holds the information of time parameters */ -struct SqpDateTime { +struct SqpRange { /// Start time (UTC) double m_TStart; /// End time (UTC) double m_TEnd; - bool contains(const SqpDateTime &dateTime) const noexcept + bool contains(const SqpRange &dateTime) const noexcept { return (m_TStart <= dateTime.m_TStart && m_TEnd >= dateTime.m_TEnd); } - bool intersect(const SqpDateTime &dateTime) const noexcept + bool intersect(const SqpRange &dateTime) const noexcept { return (m_TEnd >= dateTime.m_TStart && m_TStart <= dateTime.m_TEnd); } }; -inline QDebug operator<<(QDebug d, SqpDateTime obj) +inline QDebug operator<<(QDebug d, SqpRange obj) { auto tendDateTimeStart = DateUtils::dateTime(obj.m_TStart); auto tendDateTimeEnd = DateUtils::dateTime(obj.m_TEnd); @@ -38,6 +38,6 @@ inline QDebug operator<<(QDebug d, SqpDateTime obj) } // Required for using shared_ptr in signals/slots -SCIQLOP_REGISTER_META_TYPE(SQPDATETIME_REGISTRY, SqpDateTime) +SCIQLOP_REGISTER_META_TYPE(SQPRANGE_REGISTRY, SqpRange) -#endif // SCIQLOP_SQPDATETIME_H +#endif // SCIQLOP_SQPRANGE_H diff --git a/core/include/Time/TimeController.h b/core/include/Time/TimeController.h index 9c6d7b0..6f1f1fb 100644 --- a/core/include/Time/TimeController.h +++ b/core/include/Time/TimeController.h @@ -3,7 +3,7 @@ #include "CoreGlobal.h" -#include +#include #include #include @@ -21,15 +21,15 @@ class SCIQLOP_CORE_EXPORT TimeController : public QObject { public: explicit TimeController(QObject *parent = 0); - SqpDateTime dateTime() const noexcept; + SqpRange dateTime() const noexcept; signals: /// Signal emitted to notify that time parameters has beed updated - void timeUpdated(SqpDateTime time); + void timeUpdated(SqpRange time); public slots: /// Slot called when a new dateTime has been defined. - void onTimeToUpdate(SqpDateTime dateTime); + void onTimeToUpdate(SqpRange dateTime); /// Slot called when the dateTime has to be notified. Call timeUpdated signal void onTimeNotify(); diff --git a/core/include/Variable/Variable.h b/core/include/Variable/Variable.h index cbdb30f..dcea562 100644 --- a/core/include/Variable/Variable.h +++ b/core/include/Variable/Variable.h @@ -3,7 +3,7 @@ #include "CoreGlobal.h" -#include +#include #include #include @@ -24,21 +24,21 @@ class SCIQLOP_CORE_EXPORT Variable : public QObject { Q_OBJECT public: - explicit Variable(const QString &name, const SqpDateTime &dateTime, + explicit Variable(const QString &name, const SqpRange &dateTime, const QVariantHash &metadata = {}); QString name() const noexcept; - SqpDateTime dateTime() const noexcept; - void setDateTime(const SqpDateTime &dateTime) noexcept; + SqpRange dateTime() const noexcept; + void setDateTime(const SqpRange &dateTime) noexcept; /// @return the data of the variable, nullptr if there is no data IDataSeries *dataSeries() const noexcept; QVariantHash metadata() const noexcept; - bool contains(const SqpDateTime &dateTime) const noexcept; - bool intersect(const SqpDateTime &dateTime) const noexcept; - bool isInside(const SqpDateTime &dateTime) const noexcept; + bool contains(const SqpRange &dateTime) const noexcept; + bool intersect(const SqpRange &dateTime) const noexcept; + bool isInside(const SqpRange &dateTime) const noexcept; public slots: void setDataSeries(std::shared_ptr dataSeries) noexcept; diff --git a/core/include/Variable/VariableCacheController.h b/core/include/Variable/VariableCacheController.h index 56da394..061b0f2 100644 --- a/core/include/Variable/VariableCacheController.h +++ b/core/include/Variable/VariableCacheController.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include @@ -23,17 +23,17 @@ public: explicit VariableCacheController(QObject *parent = 0); - void addDateTime(std::shared_ptr variable, const SqpDateTime &dateTime); + void addDateTime(std::shared_ptr variable, const SqpRange &dateTime); /// Clears cache concerning a variable void clear(std::shared_ptr variable) noexcept; /// Return all of the SqpDataTime part of the dateTime whose are not in the cache - QVector provideNotInCacheDateTimeList(std::shared_ptr variable, - const SqpDateTime &dateTime); + QVector provideNotInCacheDateTimeList(std::shared_ptr variable, + const SqpRange &dateTime); - QVector dateCacheList(std::shared_ptr variable) const noexcept; + QVector dateCacheList(std::shared_ptr variable) const noexcept; void displayCache(std::shared_ptr variable) const; diff --git a/core/include/Variable/VariableController.h b/core/include/Variable/VariableController.h index d353ad7..d37a9f7 100644 --- a/core/include/Variable/VariableController.h +++ b/core/include/Variable/VariableController.h @@ -3,7 +3,7 @@ #include "CoreGlobal.h" -#include +#include #include #include @@ -62,11 +62,11 @@ signals: void variableAboutToBeDeleted(std::shared_ptr variable); /// Signal emitted when a data acquisition is requested on a range for a variable - void rangeChanged(std::shared_ptr variable, const SqpDateTime &range); + void rangeChanged(std::shared_ptr variable, const SqpRange &range); public slots: /// Request the data loading of the variable whithin dateTime - void onRequestDataLoading(std::shared_ptr variable, const SqpDateTime &dateTime); + void onRequestDataLoading(std::shared_ptr variable, const SqpRange &dateTime); /** * Creates a new variable and adds it to the model * @param name the name of the new variable @@ -77,7 +77,7 @@ public slots: std::shared_ptr provider) noexcept; /// Update the temporal parameters of every selected variable to dateTime - void onDateTimeOnSelection(const SqpDateTime &dateTime); + void onDateTimeOnSelection(const SqpRange &dateTime); void onVariableRetrieveDataInProgress(QUuid identifier, double progress); diff --git a/core/include/Variable/VariableModel.h b/core/include/Variable/VariableModel.h index 44fa7b7..02c0ca6 100644 --- a/core/include/Variable/VariableModel.h +++ b/core/include/Variable/VariableModel.h @@ -3,7 +3,7 @@ #include "CoreGlobal.h" -#include +#include #include #include @@ -34,7 +34,7 @@ public: * @param metadata the metadata associated to the new variable * @return the pointer to the new variable */ - std::shared_ptr createVariable(const QString &name, const SqpDateTime &dateTime, + std::shared_ptr createVariable(const QString &name, const SqpRange &dateTime, const QVariantHash &metadata) noexcept; /** diff --git a/core/include/Visualization/VisualizationController.h b/core/include/Visualization/VisualizationController.h index 1993e01..3206a78 100644 --- a/core/include/Visualization/VisualizationController.h +++ b/core/include/Visualization/VisualizationController.h @@ -3,7 +3,7 @@ #include "CoreGlobal.h" -#include +#include #include #include @@ -34,7 +34,7 @@ signals: void variableAboutToBeDeleted(std::shared_ptr variable); /// Signal emitted when a data acquisition is requested on a range for a variable - void rangeChanged(std::shared_ptr variable, const SqpDateTime &range); + void rangeChanged(std::shared_ptr variable, const SqpRange &range); public slots: /// Manage init/end of the controller diff --git a/core/src/Time/TimeController.cpp b/core/src/Time/TimeController.cpp index 4e564c6..fee9f73 100644 --- a/core/src/Time/TimeController.cpp +++ b/core/src/Time/TimeController.cpp @@ -4,7 +4,7 @@ Q_LOGGING_CATEGORY(LOG_TimeController, "TimeController") struct TimeController::TimeControllerPrivate { - SqpDateTime m_DateTime; + SqpRange m_DateTime; }; TimeController::TimeController(QObject *parent) @@ -13,12 +13,12 @@ TimeController::TimeController(QObject *parent) qCDebug(LOG_TimeController()) << tr("TimeController construction"); } -SqpDateTime TimeController::dateTime() const noexcept +SqpRange TimeController::dateTime() const noexcept { return impl->m_DateTime; } -void TimeController::onTimeToUpdate(SqpDateTime dateTime) +void TimeController::onTimeToUpdate(SqpRange dateTime) { impl->m_DateTime = dateTime; } diff --git a/core/src/Variable/Variable.cpp b/core/src/Variable/Variable.cpp index c866661..c64269d 100644 --- a/core/src/Variable/Variable.cpp +++ b/core/src/Variable/Variable.cpp @@ -1,7 +1,7 @@ #include "Variable/Variable.h" #include -#include +#include #include #include @@ -9,7 +9,7 @@ Q_LOGGING_CATEGORY(LOG_Variable, "Variable") struct Variable::VariablePrivate { - explicit VariablePrivate(const QString &name, const SqpDateTime &dateTime, + explicit VariablePrivate(const QString &name, const SqpRange &dateTime, const QVariantHash &metadata) : m_Name{name}, m_DateTime{dateTime}, m_Metadata{metadata}, m_DataSeries{nullptr} { @@ -17,12 +17,12 @@ struct Variable::VariablePrivate { QString m_Name; - SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache. + SqpRange m_DateTime; // The dateTime available in the view and loaded. not the cache. QVariantHash m_Metadata; std::unique_ptr m_DataSeries; }; -Variable::Variable(const QString &name, const SqpDateTime &dateTime, const QVariantHash &metadata) +Variable::Variable(const QString &name, const SqpRange &dateTime, const QVariantHash &metadata) : impl{spimpl::make_unique_impl(name, dateTime, metadata)} { } @@ -32,12 +32,12 @@ QString Variable::name() const noexcept return impl->m_Name; } -SqpDateTime Variable::dateTime() const noexcept +SqpRange Variable::dateTime() const noexcept { return impl->m_DateTime; } -void Variable::setDateTime(const SqpDateTime &dateTime) noexcept +void Variable::setDateTime(const SqpRange &dateTime) noexcept { impl->m_DateTime = dateTime; } @@ -70,17 +70,17 @@ QVariantHash Variable::metadata() const noexcept return impl->m_Metadata; } -bool Variable::contains(const SqpDateTime &dateTime) const noexcept +bool Variable::contains(const SqpRange &dateTime) const noexcept { return impl->m_DateTime.contains(dateTime); } -bool Variable::intersect(const SqpDateTime &dateTime) const noexcept +bool Variable::intersect(const SqpRange &dateTime) const noexcept { return impl->m_DateTime.intersect(dateTime); } -bool Variable::isInside(const SqpDateTime &dateTime) const noexcept +bool Variable::isInside(const SqpRange &dateTime) const noexcept { - return dateTime.contains(SqpDateTime{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd}); + return dateTime.contains(SqpRange{impl->m_DateTime.m_TStart, impl->m_DateTime.m_TEnd}); } diff --git a/core/src/Variable/VariableCacheController.cpp b/core/src/Variable/VariableCacheController.cpp index 526fc9e..fd1e836 100644 --- a/core/src/Variable/VariableCacheController.cpp +++ b/core/src/Variable/VariableCacheController.cpp @@ -8,19 +8,16 @@ Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController") struct VariableCacheController::VariableCacheControllerPrivate { - std::unordered_map, QVector > - m_VariableToSqpDateTimeListMap; + std::unordered_map, QVector > m_VariableToSqpRangeListMap; - void addInCacheDataByEnd(const SqpDateTime &dateTime, QVector &dateTimeList, - QVector ¬InCache, int cacheIndex, - double currentTStart); + void addInCacheDataByEnd(const SqpRange &dateTime, QVector &dateTimeList, + QVector ¬InCache, int cacheIndex, double currentTStart); - void addInCacheDataByStart(const SqpDateTime &dateTime, QVector &dateTimeList, - QVector ¬InCache, int cacheIndex, - double currentTStart); + void addInCacheDataByStart(const SqpRange &dateTime, QVector &dateTimeList, + QVector ¬InCache, int cacheIndex, double currentTStart); - void addDateTimeRecurse(const SqpDateTime &dateTime, QVector &dateTimeList, + void addDateTimeRecurse(const SqpRange &dateTime, QVector &dateTimeList, int cacheIndex); }; @@ -31,20 +28,20 @@ VariableCacheController::VariableCacheController(QObject *parent) } void VariableCacheController::addDateTime(std::shared_ptr variable, - const SqpDateTime &dateTime) + const SqpRange &dateTime) { qCDebug(LOG_VariableCacheController()) << "VariableCacheController::addDateTime" << QThread::currentThread()->objectName(); if (variable) { - auto findVariableIte = impl->m_VariableToSqpDateTimeListMap.find(variable); - if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) { - impl->m_VariableToSqpDateTimeListMap[variable].push_back(dateTime); + auto findVariableIte = impl->m_VariableToSqpRangeListMap.find(variable); + if (findVariableIte == impl->m_VariableToSqpRangeListMap.end()) { + impl->m_VariableToSqpRangeListMap[variable].push_back(dateTime); } else { - // addDateTime modify the list of the variable in a way to ensure + // addDateTime modify the list of the variable in a way to ensure // that the list is ordered : l(0) < l(1). We assume also a < b - // (with a & b of type SqpDateTime) means ts(b) > te(a) + // (with a & b of type SqpRange) means ts(b) > te(a) // The algorithm will try the merge of two interval: // - dateTime will be compare with the first interval of the list: @@ -54,8 +51,8 @@ void VariableCacheController::addDateTime(std::shared_ptr variable, // C: if it is superior, we do the same with the next interval of the list try { - impl->addDateTimeRecurse(dateTime, - impl->m_VariableToSqpDateTimeListMap.at(variable), 0); + impl->addDateTimeRecurse(dateTime, impl->m_VariableToSqpRangeListMap.at(variable), + 0); } catch (const std::out_of_range &e) { qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what(); @@ -71,7 +68,7 @@ void VariableCacheController::clear(std::shared_ptr variable) noexcept return; } - auto nbEntries = impl->m_VariableToSqpDateTimeListMap.erase(variable); + auto nbEntries = impl->m_VariableToSqpRangeListMap.erase(variable); auto clearCacheMessage = (nbEntries != 0) @@ -80,21 +77,21 @@ void VariableCacheController::clear(std::shared_ptr variable) noexcept qCDebug(LOG_VariableCacheController()) << clearCacheMessage; } -QVector +QVector VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr variable, - const SqpDateTime &dateTime) + const SqpRange &dateTime) { qCDebug(LOG_VariableCacheController()) << "VariableCacheController::provideNotInCacheDateTimeList" << QThread::currentThread()->objectName(); - auto notInCache = QVector{}; + auto notInCache = QVector{}; // This algorithm is recursif. The idea is to localise the start time then the end time in the // list of date time request associated to the variable // We assume that the list is ordered in a way that l(0) < l(1). We assume also a < b - // (with a & b of type SqpDateTime) means ts(b) > te(a) - auto it = impl->m_VariableToSqpDateTimeListMap.find(variable); - if (it != impl->m_VariableToSqpDateTimeListMap.end()) { + // (with a & b of type SqpRange) means ts(b) > te(a) + auto it = impl->m_VariableToSqpRangeListMap.find(variable); + if (it != impl->m_VariableToSqpRangeListMap.end()) { impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart); } else { @@ -104,22 +101,22 @@ VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr return notInCache; } -QVector +QVector VariableCacheController::dateCacheList(std::shared_ptr variable) const noexcept { qCDebug(LOG_VariableCacheController()) << "VariableCacheController::dateCacheList" << QThread::currentThread()->objectName(); try { - return impl->m_VariableToSqpDateTimeListMap.at(variable); + return impl->m_VariableToSqpRangeListMap.at(variable); } catch (const std::out_of_range &e) { qCWarning(LOG_VariableCacheController()) << e.what(); - return QVector{}; + return QVector{}; } } void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse( - const SqpDateTime &dateTime, QVector &dateTimeList, int cacheIndex) + const SqpRange &dateTime, QVector &dateTimeList, int cacheIndex) { const auto dateTimeListSize = dateTimeList.count(); if (cacheIndex >= dateTimeListSize) { @@ -143,7 +140,7 @@ void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse // rerun the algo from this index with the merged interval auto mTStart = std::min(dateTime.m_TStart, currentDateTime.m_TStart); auto mTEnd = std::max(dateTime.m_TEnd, currentDateTime.m_TEnd); - auto mergeDateTime = SqpDateTime{mTStart, mTEnd}; + auto mergeDateTime = SqpRange{mTStart, mTEnd}; dateTimeList.remove(cacheIndex); addDateTimeRecurse(mergeDateTime, dateTimeList, cacheIndex); @@ -152,15 +149,15 @@ void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEnd( - const SqpDateTime &dateTime, QVector &dateTimeList, - QVector ¬InCache, int cacheIndex, double currentTStart) + const SqpRange &dateTime, QVector &dateTimeList, QVector ¬InCache, + int cacheIndex, double currentTStart) { const auto dateTimeListSize = dateTimeList.count(); if (cacheIndex >= dateTimeListSize) { if (currentTStart < dateTime.m_TEnd) { // te localised after all other interval: The last interval is [currentTsart, te] - notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); + notInCache.push_back(SqpRange{currentTStart, dateTime.m_TEnd}); } return; } @@ -168,10 +165,10 @@ void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEn auto currentDateTimeJ = dateTimeList[cacheIndex]; if (dateTime.m_TEnd <= currentDateTimeJ.m_TStart) { // te localised between to interval: The last interval is [currentTsart, te] - notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); + notInCache.push_back(SqpRange{currentTStart, dateTime.m_TEnd}); } else { - notInCache.push_back(SqpDateTime{currentTStart, currentDateTimeJ.m_TStart}); + notInCache.push_back(SqpRange{currentTStart, currentDateTimeJ.m_TStart}); if (dateTime.m_TEnd > currentDateTimeJ.m_TEnd) { // te not localised before the current interval: we need to look at the next interval addInCacheDataByEnd(dateTime, dateTimeList, notInCache, ++cacheIndex, @@ -181,13 +178,13 @@ void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEn } void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByStart( - const SqpDateTime &dateTime, QVector &dateTimeList, - QVector ¬InCache, int cacheIndex, double currentTStart) + const SqpRange &dateTime, QVector &dateTimeList, QVector ¬InCache, + int cacheIndex, double currentTStart) { const auto dateTimeListSize = dateTimeList.count(); if (cacheIndex >= dateTimeListSize) { // ts localised after all other interval: The last interval is [ts, te] - notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); + notInCache.push_back(SqpRange{currentTStart, dateTime.m_TEnd}); return; } @@ -216,8 +213,8 @@ void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataBySt void VariableCacheController::displayCache(std::shared_ptr variable) const { - auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable); - if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) { + auto variableDateTimeList = impl->m_VariableToSqpRangeListMap.find(variable); + if (variableDateTimeList != impl->m_VariableToSqpRangeListMap.end()) { qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache") << variableDateTimeList->second; } diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index e69b4de..6296525 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -150,7 +150,7 @@ void VariableController::createVariable(const QString &name, const QVariantHash } } -void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) +void VariableController::onDateTimeOnSelection(const SqpRange &dateTime) { qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection" << QThread::currentThread()->objectName(); @@ -196,7 +196,7 @@ void VariableController::onAbortProgressRequested(std::shared_ptr vari void VariableController::onRequestDataLoading(std::shared_ptr variable, - const SqpDateTime &dateTime) + const SqpRange &dateTime) { qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading" << QThread::currentThread()->objectName(); diff --git a/core/src/Variable/VariableModel.cpp b/core/src/Variable/VariableModel.cpp index 6b929c3..971f48a 100644 --- a/core/src/Variable/VariableModel.cpp +++ b/core/src/Variable/VariableModel.cpp @@ -60,7 +60,7 @@ VariableModel::VariableModel(QObject *parent) } std::shared_ptr VariableModel::createVariable(const QString &name, - const SqpDateTime &dateTime, + const SqpRange &dateTime, const QVariantHash &metadata) noexcept { auto insertIndex = rowCount(); diff --git a/core/tests/Variable/TestVariableCacheController.cpp b/core/tests/Variable/TestVariableCacheController.cpp index 92f886b..a46dd04 100644 --- a/core/tests/Variable/TestVariableCacheController.cpp +++ b/core/tests/Variable/TestVariableCacheController.cpp @@ -22,18 +22,18 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() auto ts0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 0, 0}}; auto te0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}}; - auto sqp0 = SqpDateTime{static_cast(ts0.toMSecsSinceEpoch()), - static_cast(te0.toMSecsSinceEpoch())}; + auto sqp0 = SqpRange{static_cast(ts0.toMSecsSinceEpoch()), + static_cast(te0.toMSecsSinceEpoch())}; auto ts1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}}; auto te1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 8, 0, 0}}; - auto sqp1 = SqpDateTime{static_cast(ts1.toMSecsSinceEpoch()), - static_cast(te1.toMSecsSinceEpoch())}; + auto sqp1 = SqpRange{static_cast(ts1.toMSecsSinceEpoch()), + static_cast(te1.toMSecsSinceEpoch())}; auto ts2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 18, 0, 0}}; auto te2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 20, 0, 0}}; - auto sqp2 = SqpDateTime{static_cast(ts2.toMSecsSinceEpoch()), - static_cast(te2.toMSecsSinceEpoch())}; + auto sqp2 = SqpRange{static_cast(ts2.toMSecsSinceEpoch()), + static_cast(te2.toMSecsSinceEpoch())}; auto var0 = std::make_shared("", sqp0); @@ -44,8 +44,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // first case [ts,te] < ts0 auto ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}}; auto te = QDateTime{QDate{2017, 01, 01}, QTime{2, 1, 0, 0}}; - auto sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + auto sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; auto notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -59,8 +59,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // second case ts < ts0 && ts0 < te <= te0 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -73,8 +73,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 3th case ts < ts0 && te0 < te <= ts1 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -91,8 +91,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 4th case ts < ts0 && ts1 < te <= te1 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 7, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -109,8 +109,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 5th case ts < ts0 && te3 < te ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 0, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 22, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -136,8 +136,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 6th case ts2 < ts ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 45, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 47, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -150,8 +150,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 7th case ts = te0 && te < ts1 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -164,8 +164,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 8th case ts0 < ts < te0 && te < ts1 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -178,8 +178,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 9th case ts0 < ts < te0 && ts1 < te < te1 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 30, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 7, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -192,8 +192,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 10th case te1 < ts < te < ts2 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 9, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 10, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -206,8 +206,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 11th case te0 < ts < ts1 && te3 < te ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 47, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -228,8 +228,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 12th case te0 < ts < ts1 && te3 < te ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 5, 0, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 10, 0, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); @@ -246,8 +246,8 @@ void TestVariableCacheController::testProvideNotInCacheDateTimeList() // 12th case ts0 < ts < te0 ts = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 10, 0}}; te = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 50, 0}}; - sqp = SqpDateTime{static_cast(ts.toMSecsSinceEpoch()), - static_cast(te.toMSecsSinceEpoch())}; + sqp = SqpRange{static_cast(ts.toMSecsSinceEpoch()), + static_cast(te.toMSecsSinceEpoch())}; notInCach = variableCacheController.provideNotInCacheDateTimeList(var0, sqp); QCOMPARE(notInCach.size(), 0); @@ -260,33 +260,33 @@ void TestVariableCacheController::testAddDateTime() auto ts0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 3, 0, 0}}; auto te0 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}}; - auto sqp0 = SqpDateTime{static_cast(ts0.toMSecsSinceEpoch()), - static_cast(te0.toMSecsSinceEpoch())}; + auto sqp0 = SqpRange{static_cast(ts0.toMSecsSinceEpoch()), + static_cast(te0.toMSecsSinceEpoch())}; auto ts1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}}; auto te1 = QDateTime{QDate{2017, 01, 01}, QTime{2, 8, 0, 0}}; - auto sqp1 = SqpDateTime{static_cast(ts1.toMSecsSinceEpoch()), - static_cast(te1.toMSecsSinceEpoch())}; + auto sqp1 = SqpRange{static_cast(ts1.toMSecsSinceEpoch()), + static_cast(te1.toMSecsSinceEpoch())}; auto ts2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 18, 0, 0}}; auto te2 = QDateTime{QDate{2017, 01, 01}, QTime{2, 20, 0, 0}}; - auto sqp2 = SqpDateTime{static_cast(ts2.toMSecsSinceEpoch()), - static_cast(te2.toMSecsSinceEpoch())}; + auto sqp2 = SqpRange{static_cast(ts2.toMSecsSinceEpoch()), + static_cast(te2.toMSecsSinceEpoch())}; auto ts01 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}}; auto te01 = QDateTime{QDate{2017, 01, 01}, QTime{2, 6, 0, 0}}; - auto sqp01 = SqpDateTime{static_cast(ts01.toMSecsSinceEpoch()), - static_cast(te01.toMSecsSinceEpoch())}; + auto sqp01 = SqpRange{static_cast(ts01.toMSecsSinceEpoch()), + static_cast(te01.toMSecsSinceEpoch())}; auto ts3 = QDateTime{QDate{2017, 01, 01}, QTime{2, 14, 0, 0}}; auto te3 = QDateTime{QDate{2017, 01, 01}, QTime{2, 16, 0, 0}}; - auto sqp3 = SqpDateTime{static_cast(ts3.toMSecsSinceEpoch()), - static_cast(te3.toMSecsSinceEpoch())}; + auto sqp3 = SqpRange{static_cast(ts3.toMSecsSinceEpoch()), + static_cast(te3.toMSecsSinceEpoch())}; auto ts03 = QDateTime{QDate{2017, 01, 01}, QTime{2, 4, 0, 0}}; auto te03 = QDateTime{QDate{2017, 01, 01}, QTime{2, 22, 0, 0}}; - auto sqp03 = SqpDateTime{static_cast(ts03.toMSecsSinceEpoch()), - static_cast(te03.toMSecsSinceEpoch())}; + auto sqp03 = SqpRange{static_cast(ts03.toMSecsSinceEpoch()), + static_cast(te03.toMSecsSinceEpoch())}; auto var0 = std::make_shared("", sqp0); diff --git a/gui/include/TimeWidget/TimeWidget.h b/gui/include/TimeWidget/TimeWidget.h index de7ee69..575ebd7 100644 --- a/gui/include/TimeWidget/TimeWidget.h +++ b/gui/include/TimeWidget/TimeWidget.h @@ -3,7 +3,7 @@ #include -#include +#include namespace Ui { class TimeWidget; @@ -18,7 +18,7 @@ public: signals: /// Signal emitted when the time parameters has beed updated - void timeUpdated(SqpDateTime time); + void timeUpdated(SqpRange time); public slots: /// slot called when time parameters update has ben requested diff --git a/gui/include/Visualization/VisualizationGraphHelper.h b/gui/include/Visualization/VisualizationGraphHelper.h index f8f5687..efdb6f2 100644 --- a/gui/include/Visualization/VisualizationGraphHelper.h +++ b/gui/include/Visualization/VisualizationGraphHelper.h @@ -1,7 +1,7 @@ #ifndef SCIQLOP_VISUALIZATIONGRAPHHELPER_H #define SCIQLOP_VISUALIZATIONGRAPHHELPER_H -#include +#include #include #include @@ -32,7 +32,7 @@ struct VisualizationGraphHelper { QCustomPlot &plot) noexcept; static void updateData(QVector plotableVect, IDataSeries *dataSeries, - const SqpDateTime &dateTime); + const SqpRange &dateTime); }; #endif // SCIQLOP_VISUALIZATIONGRAPHHELPER_H diff --git a/gui/include/Visualization/VisualizationGraphWidget.h b/gui/include/Visualization/VisualizationGraphWidget.h index a015f24..6ddcc72 100644 --- a/gui/include/Visualization/VisualizationGraphWidget.h +++ b/gui/include/Visualization/VisualizationGraphWidget.h @@ -13,7 +13,7 @@ Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) class QCPRange; -class SqpDateTime; +class SqpRange; class Variable; /** @@ -39,9 +39,9 @@ public: /// Removes a variable from the graph void removeVariable(std::shared_ptr variable) noexcept; - void setRange(std::shared_ptr variable, const SqpDateTime &range); - SqpDateTime graphRange() const noexcept; - void setGraphRange(const SqpDateTime &range); + void setRange(std::shared_ptr variable, const SqpRange &range); + SqpRange graphRange() const noexcept; + void setGraphRange(const SqpRange &range); // IVisualizationWidget interface void accept(IVisualizationWidgetVisitor *visitor) override; @@ -51,8 +51,8 @@ public: signals: - void requestDataLoading(std::shared_ptr variable, const SqpDateTime &dateTime); - void synchronize(const SqpDateTime &dateTime, const SqpDateTime &oldDateTime, + void requestDataLoading(std::shared_ptr variable, const SqpRange &dateTime); + void synchronize(const SqpRange &dateTime, const SqpRange &oldDateTime, VisualizationGraphWidgetZoomType zoomType); diff --git a/gui/include/Visualization/VisualizationWidget.h b/gui/include/Visualization/VisualizationWidget.h index 79e2538..2d89820 100644 --- a/gui/include/Visualization/VisualizationWidget.h +++ b/gui/include/Visualization/VisualizationWidget.h @@ -2,7 +2,7 @@ #define SCIQLOP_VISUALIZATIONWIDGET_H #include "Visualization/IVisualizationWidget.h" -#include +#include #include #include @@ -42,7 +42,7 @@ public slots: /// Slot called when a variable is about to be deleted from SciQlop void onVariableAboutToBeDeleted(std::shared_ptr variable) noexcept; - void onRangeChanged(std::shared_ptr variable, const SqpDateTime &range) noexcept; + void onRangeChanged(std::shared_ptr variable, const SqpRange &range) noexcept; private: Ui::VisualizationWidget *ui; diff --git a/gui/include/Visualization/operations/RescaleAxeOperation.h b/gui/include/Visualization/operations/RescaleAxeOperation.h index 5e348bb..b4900cb 100644 --- a/gui/include/Visualization/operations/RescaleAxeOperation.h +++ b/gui/include/Visualization/operations/RescaleAxeOperation.h @@ -2,7 +2,7 @@ #define SCIQLOP_RESCALEAXEOPERATION_H #include "Visualization/IVisualizationWidgetVisitor.h" -#include +#include #include @@ -24,7 +24,7 @@ public: * Ctor * @param variable the variable to remove from widgets */ - explicit RescaleAxeOperation(std::shared_ptr variable, const SqpDateTime &range); + explicit RescaleAxeOperation(std::shared_ptr variable, const SqpRange &range); void visitEnter(VisualizationWidget *widget) override final; void visitLeave(VisualizationWidget *widget) override final; diff --git a/gui/src/SqpApplication.cpp b/gui/src/SqpApplication.cpp index 89e0249..1bc25b7 100644 --- a/gui/src/SqpApplication.cpp +++ b/gui/src/SqpApplication.cpp @@ -39,9 +39,9 @@ public: SIGNAL(variableAboutToBeDeleted(std::shared_ptr)), Qt::DirectConnection); connect(m_VariableController.get(), - SIGNAL(rangeChanged(std::shared_ptr, const SqpDateTime &)), + SIGNAL(rangeChanged(std::shared_ptr, const SqpRange &)), m_VisualizationController.get(), - SIGNAL(rangeChanged(std::shared_ptr, const SqpDateTime &))); + SIGNAL(rangeChanged(std::shared_ptr, const SqpRange &))); m_DataSourceController->moveToThread(&m_DataSourceControllerThread); diff --git a/gui/src/TimeWidget/TimeWidget.cpp b/gui/src/TimeWidget/TimeWidget.cpp index 01cd71f..08801fe 100644 --- a/gui/src/TimeWidget/TimeWidget.cpp +++ b/gui/src/TimeWidget/TimeWidget.cpp @@ -29,8 +29,8 @@ TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget ui->startDateTimeEdit->setDateTime(startDateTime); ui->endDateTimeEdit->setDateTime(endDateTime); - auto dateTime = SqpDateTime{DateUtils::secondsSinceEpoch(startDateTime), - DateUtils::secondsSinceEpoch(endDateTime)}; + auto dateTime = SqpRange{DateUtils::secondsSinceEpoch(startDateTime), + DateUtils::secondsSinceEpoch(endDateTime)}; sqpApp->timeController().onTimeToUpdate(dateTime); } @@ -43,8 +43,8 @@ TimeWidget::~TimeWidget() void TimeWidget::onTimeUpdateRequested() { - auto dateTime = SqpDateTime{DateUtils::secondsSinceEpoch(ui->startDateTimeEdit->dateTime()), - DateUtils::secondsSinceEpoch(ui->endDateTimeEdit->dateTime())}; + auto dateTime = SqpRange{DateUtils::secondsSinceEpoch(ui->startDateTimeEdit->dateTime()), + DateUtils::secondsSinceEpoch(ui->endDateTimeEdit->dateTime())}; emit timeUpdated(std::move(dateTime)); } diff --git a/gui/src/Visualization/VisualizationGraphHelper.cpp b/gui/src/Visualization/VisualizationGraphHelper.cpp index 0ea7ff6..0e80e3c 100644 --- a/gui/src/Visualization/VisualizationGraphHelper.cpp +++ b/gui/src/Visualization/VisualizationGraphHelper.cpp @@ -36,7 +36,7 @@ QSharedPointer axisTicker(bool isTimeAxis) } void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSeries, - const SqpDateTime &dateTime) + const SqpRange &dateTime) { qCDebug(LOG_VisualizationGraphHelper()) << "TORM: updateScalarData" << QThread::currentThread()->objectName(); @@ -80,7 +80,7 @@ void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSerie } QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QCustomPlot &plot, - const SqpDateTime &dateTime) + const SqpRange &dateTime) { auto component = plot.addGraph(); @@ -144,7 +144,7 @@ QVector VisualizationGraphHelper::create(std::shared_ptr } void VisualizationGraphHelper::updateData(QVector plotableVect, - IDataSeries *dataSeries, const SqpDateTime &dateTime) + IDataSeries *dataSeries, const SqpRange &dateTime) { if (auto scalarSeries = dynamic_cast(dataSeries)) { if (plotableVect.size() == 1) { diff --git a/gui/src/Visualization/VisualizationGraphWidget.cpp b/gui/src/Visualization/VisualizationGraphWidget.cpp index eb70fb8..57c2cec 100644 --- a/gui/src/Visualization/VisualizationGraphWidget.cpp +++ b/gui/src/Visualization/VisualizationGraphWidget.cpp @@ -119,7 +119,7 @@ void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr v // when adding a variable, we need to set its time range to the current graph range auto grapheRange = ui->widget->xAxis->range(); - auto dateTime = SqpDateTime{grapheRange.lower, grapheRange.upper}; + auto dateTime = SqpRange{grapheRange.lower, grapheRange.upper}; variable->setDateTime(dateTime); auto variableDateTimeWithTolerance = dateTime; @@ -159,8 +159,7 @@ void VisualizationGraphWidget::removeVariable(std::shared_ptr variable ui->widget->replot(); } -void VisualizationGraphWidget::setRange(std::shared_ptr variable, - const SqpDateTime &range) +void VisualizationGraphWidget::setRange(std::shared_ptr variable, const SqpRange &range) { // Note: in case of different axes that depends on variable, we could start with a code like // that: @@ -171,13 +170,13 @@ void VisualizationGraphWidget::setRange(std::shared_ptr variable, ui->widget->replot(); } -SqpDateTime VisualizationGraphWidget::graphRange() const noexcept +SqpRange VisualizationGraphWidget::graphRange() const noexcept { auto grapheRange = ui->widget->xAxis->range(); - return SqpDateTime{grapheRange.lower, grapheRange.upper}; + return SqpRange{grapheRange.lower, grapheRange.upper}; } -void VisualizationGraphWidget::setGraphRange(const SqpDateTime &range) +void VisualizationGraphWidget::setGraphRange(const SqpRange &range) { qCDebug(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::setGraphRange START"); ui->widget->xAxis->setRange(range.m_TStart, range.m_TEnd); @@ -243,7 +242,7 @@ void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged") << QThread::currentThread()->objectName(); - auto dateTimeRange = SqpDateTime{t1.lower, t1.upper}; + auto dateTimeRange = SqpRange{t1.lower, t1.upper}; auto zoomType = impl->getZoomType(t1, t2); for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); @@ -331,7 +330,7 @@ void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange } if (impl->m_DoSynchronize && !impl->m_IsCalibration) { - auto oldDateTime = SqpDateTime{t2.lower, t2.upper}; + auto oldDateTime = SqpRange{t2.lower, t2.upper}; qCDebug(LOG_VisualizationGraphWidget()) << tr("TORM: VisualizationGraphWidget::Synchronize notify !!") << QThread::currentThread()->objectName(); @@ -385,7 +384,7 @@ void VisualizationGraphWidget::onDataCacheVariableUpdated() // - use a map (unique keys) and store as values directly the list of components auto grapheRange = ui->widget->xAxis->range(); - auto dateTime = SqpDateTime{grapheRange.lower, grapheRange.upper}; + auto dateTime = SqpRange{grapheRange.lower, grapheRange.upper}; for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); it != impl->m_VariableToPlotMultiMap.cend(); ++it) { diff --git a/gui/src/Visualization/VisualizationWidget.cpp b/gui/src/Visualization/VisualizationWidget.cpp index c5d86c7..7708ca1 100644 --- a/gui/src/Visualization/VisualizationWidget.cpp +++ b/gui/src/Visualization/VisualizationWidget.cpp @@ -144,7 +144,7 @@ void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr v } void VisualizationWidget::onRangeChanged(std::shared_ptr variable, - const SqpDateTime &range) noexcept + const SqpRange &range) noexcept { // Calls the operation of rescaling all graph that contrains variable in the visualization auto rescaleVariableOperation = RescaleAxeOperation{variable, range}; diff --git a/gui/src/Visualization/VisualizationZoneWidget.cpp b/gui/src/Visualization/VisualizationZoneWidget.cpp index 293a585..05651a3 100644 --- a/gui/src/Visualization/VisualizationZoneWidget.cpp +++ b/gui/src/Visualization/VisualizationZoneWidget.cpp @@ -1,6 +1,6 @@ #include "Visualization/VisualizationZoneWidget.h" -#include "Data/SqpDateTime.h" +#include "Data/SqpRange.h" #include "Visualization/IVisualizationWidgetVisitor.h" #include "Visualization/VisualizationGraphWidget.h" @@ -70,8 +70,8 @@ VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptraddVariable(variable); // Lambda to synchronize zone widget - auto synchronizeZoneWidget = [this, graphWidget](const SqpDateTime &dateTime, - const SqpDateTime &oldDateTime, + auto synchronizeZoneWidget = [this, graphWidget](const SqpRange &dateTime, + const SqpRange &oldDateTime, VisualizationGraphWidgetZoomType zoomType) { auto frameLayout = ui->visualizationZoneFrame->layout(); for (auto i = 0; i < frameLayout->count(); ++i) { diff --git a/gui/src/Visualization/operations/RescaleAxeOperation.cpp b/gui/src/Visualization/operations/RescaleAxeOperation.cpp index 7f8fc66..5c5583e 100644 --- a/gui/src/Visualization/operations/RescaleAxeOperation.cpp +++ b/gui/src/Visualization/operations/RescaleAxeOperation.cpp @@ -4,18 +4,16 @@ Q_LOGGING_CATEGORY(LOG_RescaleAxeOperation, "RescaleAxeOperation") struct RescaleAxeOperation::RescaleAxeOperationPrivate { - explicit RescaleAxeOperationPrivate(std::shared_ptr variable, - const SqpDateTime &range) + explicit RescaleAxeOperationPrivate(std::shared_ptr variable, const SqpRange &range) : m_Variable{variable}, m_Range{range} { } std::shared_ptr m_Variable; - SqpDateTime m_Range; + SqpRange m_Range; }; -RescaleAxeOperation::RescaleAxeOperation(std::shared_ptr variable, - const SqpDateTime &range) +RescaleAxeOperation::RescaleAxeOperation(std::shared_ptr variable, const SqpRange &range) : impl{spimpl::make_unique_impl(variable, range)} { } diff --git a/plugins/amda/include/AmdaProvider.h b/plugins/amda/include/AmdaProvider.h index 6188efe..1f0438d 100644 --- a/plugins/amda/include/AmdaProvider.h +++ b/plugins/amda/include/AmdaProvider.h @@ -24,7 +24,7 @@ public: void requestDataAborting(QUuid identifier) override; private: - void retrieveData(QUuid token, const SqpDateTime &dateTime, const QVariantHash &data); + void retrieveData(QUuid token, const SqpRange &dateTime, const QVariantHash &data); }; #endif // SCIQLOP_AMDAPROVIDER_H diff --git a/plugins/amda/src/AmdaProvider.cpp b/plugins/amda/src/AmdaProvider.cpp index ccb5456..48d35ba 100644 --- a/plugins/amda/src/AmdaProvider.cpp +++ b/plugins/amda/src/AmdaProvider.cpp @@ -30,9 +30,9 @@ const auto AMDA_URL_FORMAT = QStringLiteral( const auto AMDA_TIME_FORMAT = QStringLiteral("yyyy-MM-ddThh:mm:ss"); /// Formats a time to a date that can be passed in URL -QString dateFormat(double sqpDateTime) noexcept +QString dateFormat(double sqpRange) noexcept { - auto dateTime = DateUtils::dateTime(sqpDateTime); + auto dateTime = DateUtils::dateTime(sqpRange); return dateTime.toString(AMDA_TIME_FORMAT); } @@ -73,7 +73,7 @@ void AmdaProvider::requestDataAborting(QUuid identifier) } } -void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime, const QVariantHash &data) +void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVariantHash &data) { // Retrieves product ID from data: if the value is invalid, no request is made auto productId = data.value(AMDA_XML_ID_KEY).toString(); diff --git a/plugins/mockplugin/include/CosinusProvider.h b/plugins/mockplugin/include/CosinusProvider.h index 44ae6c6..edcd531 100644 --- a/plugins/mockplugin/include/CosinusProvider.h +++ b/plugins/mockplugin/include/CosinusProvider.h @@ -25,7 +25,7 @@ public: private: - std::shared_ptr retrieveData(QUuid token, const SqpDateTime &dateTime); + std::shared_ptr retrieveData(QUuid token, const SqpRange &dateTime); QHash m_VariableToEnableProvider; }; diff --git a/plugins/mockplugin/src/CosinusProvider.cpp b/plugins/mockplugin/src/CosinusProvider.cpp index bdc4345..d00c3e5 100644 --- a/plugins/mockplugin/src/CosinusProvider.cpp +++ b/plugins/mockplugin/src/CosinusProvider.cpp @@ -11,7 +11,7 @@ Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider") -std::shared_ptr CosinusProvider::retrieveData(QUuid token, const SqpDateTime &dateTime) +std::shared_ptr CosinusProvider::retrieveData(QUuid token, const SqpRange &dateTime) { // TODO: Add Mutex auto dataIndex = 0;