@@ -1,8 +1,9 | |||
|
1 | 1 | #ifndef SCIQLOP_ARRAYDATA_H |
|
2 | 2 | #define SCIQLOP_ARRAYDATA_H |
|
3 | 3 | |
|
4 | #include <QReadLocker> | |
|
5 | #include <QReadWriteLock> | |
|
4 | 6 | #include <QVector> |
|
5 | ||
|
6 | 7 | /** |
|
7 | 8 | * @brief The ArrayData class represents a dataset for a data series. |
|
8 | 9 | * |
@@ -22,10 +23,22 public: | |||
|
22 | 23 | template <int D = Dim, typename = std::enable_if_t<D == 1> > |
|
23 | 24 | explicit ArrayData(int nbColumns) : m_Data{1, QVector<double>{}} |
|
24 | 25 | { |
|
26 | QWriteLocker locker(&m_Lock); | |
|
25 | 27 | m_Data[0].resize(nbColumns); |
|
26 | 28 | } |
|
27 | 29 | |
|
28 | 30 | /** |
|
31 | * Ctor for a unidimensional ArrayData | |
|
32 | * @param nbColumns the number of values the ArrayData will hold | |
|
33 | */ | |
|
34 | explicit ArrayData(const ArrayData &other) | |
|
35 | { | |
|
36 | QReadLocker otherLocker(&other.m_Lock); | |
|
37 | QWriteLocker locker(&m_Lock); | |
|
38 | m_Data = other.m_Data; | |
|
39 | } | |
|
40 | ||
|
41 | /** | |
|
29 | 42 | * Sets a data at a specified index. The index has to be valid to be effective |
|
30 | 43 | * @param index the index to which the data will be set |
|
31 | 44 | * @param data the data to set |
@@ -34,6 +47,7 public: | |||
|
34 | 47 | template <int D = Dim, typename = std::enable_if_t<D == 1> > |
|
35 | 48 | void setData(int index, double data) noexcept |
|
36 | 49 | { |
|
50 | QWriteLocker locker(&m_Lock); | |
|
37 | 51 | if (index >= 0 && index < m_Data.at(0).size()) { |
|
38 | 52 | m_Data[0].replace(index, data); |
|
39 | 53 | } |
@@ -44,8 +58,9 public: | |||
|
44 | 58 | * @remarks this method is only available for a unidimensional ArrayData |
|
45 | 59 | */ |
|
46 | 60 | template <int D = Dim, typename = std::enable_if_t<D == 1> > |
|
47 |
|
|
|
61 | QVector<double> data() const noexcept | |
|
48 | 62 | { |
|
63 | QReadLocker locker(&m_Lock); | |
|
49 | 64 | return m_Data[0]; |
|
50 | 65 | } |
|
51 | 66 | |
@@ -54,8 +69,9 public: | |||
|
54 | 69 | * @remarks this method is only available for a unidimensional ArrayData |
|
55 | 70 | */ |
|
56 | 71 | template <int D = Dim, typename = std::enable_if_t<D == 1> > |
|
57 |
|
|
|
72 | QVector<double> data(double tStart, double tEnd) const noexcept | |
|
58 | 73 | { |
|
74 | QReadLocker locker(&m_Lock); | |
|
59 | 75 | return m_Data.at(tStart); |
|
60 | 76 | } |
|
61 | 77 | |
@@ -63,20 +79,30 public: | |||
|
63 | 79 | template <int D = Dim, typename = std::enable_if_t<D == 1> > |
|
64 | 80 | void merge(const ArrayData<1> &arrayData) |
|
65 | 81 | { |
|
82 | QWriteLocker locker(&m_Lock); | |
|
66 | 83 | if (!m_Data.empty()) { |
|
84 | QReadLocker otherLocker(&arrayData.m_Lock); | |
|
67 | 85 | m_Data[0] += arrayData.data(); |
|
68 | 86 | } |
|
69 | 87 | } |
|
70 | 88 | |
|
71 | 89 | template <int D = Dim, typename = std::enable_if_t<D == 1> > |
|
72 | int size() | |
|
90 | int size() const | |
|
73 | 91 | { |
|
92 | QReadLocker locker(&m_Lock); | |
|
74 | 93 | return m_Data[0].size(); |
|
75 | 94 | } |
|
76 | 95 | |
|
96 | void clear() | |
|
97 | { | |
|
98 | QWriteLocker locker(&m_Lock); | |
|
99 | m_Data.clear(); | |
|
100 | } | |
|
101 | ||
|
77 | 102 | |
|
78 | 103 | private: |
|
79 | 104 | QVector<QVector<double> > m_Data; |
|
105 | mutable QReadWriteLock m_Lock; | |
|
80 | 106 | }; |
|
81 | 107 | |
|
82 | 108 | #endif // SCIQLOP_ARRAYDATA_H |
@@ -6,9 +6,10 | |||
|
6 | 6 | |
|
7 | 7 | #include <QLoggingCategory> |
|
8 | 8 | |
|
9 | #include <QReadLocker> | |
|
10 | #include <QReadWriteLock> | |
|
9 | 11 | #include <memory> |
|
10 | 12 | |
|
11 | ||
|
12 | 13 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSeries) |
|
13 | 14 | Q_LOGGING_CATEGORY(LOG_DataSeries, "DataSeries") |
|
14 | 15 | |
@@ -38,12 +39,19 public: | |||
|
38 | 39 | /// @sa IDataSeries::valuesUnit() |
|
39 | 40 | Unit valuesUnit() const override { return m_ValuesUnit; } |
|
40 | 41 | |
|
42 | void clear() | |
|
43 | { | |
|
44 | m_XAxisData->clear(); | |
|
45 | m_ValuesData->clear(); | |
|
46 | } | |
|
47 | ||
|
41 | 48 | /// @sa IDataSeries::merge() |
|
42 | 49 | void merge(IDataSeries *dataSeries) override |
|
43 | 50 | { |
|
44 | 51 | if (auto dimDataSeries = dynamic_cast<DataSeries<Dim> *>(dataSeries)) { |
|
45 | 52 | m_XAxisData->merge(*dimDataSeries->xAxisData()); |
|
46 | 53 | m_ValuesData->merge(*dimDataSeries->valuesData()); |
|
54 | dimDataSeries->clear(); | |
|
47 | 55 | } |
|
48 | 56 | else { |
|
49 | 57 | qCWarning(LOG_DataSeries()) |
@@ -51,6 +59,10 public: | |||
|
51 | 59 | } |
|
52 | 60 | } |
|
53 | 61 | |
|
62 | virtual void lockRead() { m_Lock.lockForRead(); } | |
|
63 | virtual void lockWrite() { m_Lock.lockForWrite(); } | |
|
64 | virtual void unlock() { m_Lock.unlock(); } | |
|
65 | ||
|
54 | 66 | protected: |
|
55 | 67 | /// Protected ctor (DataSeries is abstract) |
|
56 | 68 | explicit DataSeries(std::shared_ptr<ArrayData<1> > xAxisData, const Unit &xAxisUnit, |
@@ -88,6 +100,8 private: | |||
|
88 | 100 | Unit m_XAxisUnit; |
|
89 | 101 | std::shared_ptr<ArrayData<Dim> > m_ValuesData; |
|
90 | 102 | Unit m_ValuesUnit; |
|
103 | ||
|
104 | QReadWriteLock m_Lock; | |
|
91 | 105 | }; |
|
92 | 106 | |
|
93 | 107 | #endif // SCIQLOP_DATASERIES_H |
@@ -51,6 +51,10 public: | |||
|
51 | 51 | virtual void merge(IDataSeries *dataSeries) = 0; |
|
52 | 52 | |
|
53 | 53 | virtual std::unique_ptr<IDataSeries> clone() const = 0; |
|
54 | ||
|
55 | virtual void lockRead() = 0; | |
|
56 | virtual void lockWrite() = 0; | |
|
57 | virtual void unlock() = 0; | |
|
54 | 58 | }; |
|
55 | 59 | |
|
56 | 60 | // Required for using shared_ptr in signals/slots |
@@ -27,14 +27,14 public: | |||
|
27 | 27 | DataSourceController::DataSourceController(QObject *parent) |
|
28 | 28 | : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()} |
|
29 | 29 | { |
|
30 |
qCDebug(LOG_DataSourceController()) |
|
|
31 | << QThread::currentThread(); | |
|
30 | qCDebug(LOG_DataSourceController()) | |
|
31 | << tr("DataSourceController construction") << QThread::currentThread(); | |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | DataSourceController::~DataSourceController() |
|
35 | 35 | { |
|
36 |
qCDebug(LOG_DataSourceController()) |
|
|
37 | << QThread::currentThread(); | |
|
36 | qCDebug(LOG_DataSourceController()) | |
|
37 | << tr("DataSourceController destruction") << QThread::currentThread(); | |
|
38 | 38 | this->waitForFinish(); |
|
39 | 39 | } |
|
40 | 40 | |
@@ -97,8 +97,8 void DataSourceController::loadProductItem(const QUuid &dataSourceUid, | |||
|
97 | 97 | |
|
98 | 98 | void DataSourceController::initialize() |
|
99 | 99 | { |
|
100 |
qCDebug(LOG_DataSourceController()) |
|
|
101 | << QThread::currentThread(); | |
|
100 | qCDebug(LOG_DataSourceController()) | |
|
101 | << tr("DataSourceController init") << QThread::currentThread(); | |
|
102 | 102 | impl->m_WorkingMutex.lock(); |
|
103 | 103 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController init END"); |
|
104 | 104 | } |
@@ -3,6 +3,9 | |||
|
3 | 3 | #include <Data/IDataSeries.h> |
|
4 | 4 | #include <Data/SqpDateTime.h> |
|
5 | 5 | |
|
6 | #include <QReadWriteLock> | |
|
7 | #include <QThread> | |
|
8 | ||
|
6 | 9 | Q_LOGGING_CATEGORY(LOG_Variable, "Variable") |
|
7 | 10 | |
|
8 | 11 | struct Variable::VariablePrivate { |
@@ -57,6 +60,7 void Variable::setDateTime(const SqpDateTime &dateTime) noexcept | |||
|
57 | 60 | |
|
58 | 61 | void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept |
|
59 | 62 | { |
|
63 | qCInfo(LOG_Variable()) << "Variable::setDataSeries" << QThread::currentThread()->objectName(); | |
|
60 | 64 | if (!dataSeries) { |
|
61 | 65 | /// @todo ALX : log |
|
62 | 66 | return; |
@@ -67,8 +71,11 void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept | |||
|
67 | 71 | impl->m_DataSeries = dataSeries->clone(); |
|
68 | 72 | } |
|
69 | 73 | else { |
|
74 | dataSeries->lockWrite(); | |
|
75 | impl->m_DataSeries->lockWrite(); | |
|
70 | 76 | impl->m_DataSeries->merge(dataSeries.get()); |
|
71 | ||
|
77 | impl->m_DataSeries->unlock(); | |
|
78 | dataSeries->unlock(); | |
|
72 | 79 | emit updated(); |
|
73 | 80 | } |
|
74 | 81 | } |
@@ -3,6 +3,7 | |||
|
3 | 3 | #include "Variable/Variable.h" |
|
4 | 4 | #include <unordered_map> |
|
5 | 5 | |
|
6 | #include <QThread> | |
|
6 | 7 | Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController") |
|
7 | 8 | |
|
8 | 9 | struct VariableCacheController::VariableCacheControllerPrivate { |
@@ -32,6 +33,8 VariableCacheController::VariableCacheController(QObject *parent) | |||
|
32 | 33 | void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, |
|
33 | 34 | const SqpDateTime &dateTime) |
|
34 | 35 | { |
|
36 | qCInfo(LOG_VariableCacheController()) | |
|
37 | << "VariableCacheController::addDateTime" << QThread::currentThread()->objectName(); | |
|
35 | 38 | if (variable) { |
|
36 | 39 | auto findVariableIte = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
37 | 40 | if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) { |
@@ -81,6 +84,9 QVector<SqpDateTime> | |||
|
81 | 84 | VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, |
|
82 | 85 | const SqpDateTime &dateTime) |
|
83 | 86 | { |
|
87 | qCInfo(LOG_VariableCacheController()) | |
|
88 | << "VariableCacheController::provideNotInCacheDateTimeList" | |
|
89 | << QThread::currentThread()->objectName(); | |
|
84 | 90 | auto notInCache = QVector<SqpDateTime>{}; |
|
85 | 91 | |
|
86 | 92 | // This algorithm is recursif. The idea is to localise the start time then the end time in the |
@@ -101,6 +107,8 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> | |||
|
101 | 107 | QVector<SqpDateTime> |
|
102 | 108 | VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept |
|
103 | 109 | { |
|
110 | qCInfo(LOG_VariableCacheController()) | |
|
111 | << "VariableCacheController::dateCacheList" << QThread::currentThread()->objectName(); | |
|
104 | 112 | try { |
|
105 | 113 | return impl->m_VariableToSqpDateTimeListMap.at(variable); |
|
106 | 114 | } |
@@ -210,8 +218,8 void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) c | |||
|
210 | 218 | { |
|
211 | 219 | auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
212 | 220 | if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) { |
|
213 |
qCInfo(LOG_VariableCacheController()) |
|
|
214 | << variableDateTimeList->second; | |
|
221 | qCInfo(LOG_VariableCacheController()) | |
|
222 | << tr("VariableCacheController::displayCache") << variableDateTimeList->second; | |
|
215 | 223 | } |
|
216 | 224 | else { |
|
217 | 225 | qCWarning(LOG_VariableCacheController()) |
@@ -56,14 +56,14 struct VariableController::VariableControllerPrivate { | |||
|
56 | 56 | VariableController::VariableController(QObject *parent) |
|
57 | 57 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} |
|
58 | 58 | { |
|
59 |
qCDebug(LOG_VariableController()) |
|
|
60 | << QThread::currentThread(); | |
|
59 | qCDebug(LOG_VariableController()) | |
|
60 | << tr("VariableController construction") << QThread::currentThread(); | |
|
61 | 61 | } |
|
62 | 62 | |
|
63 | 63 | VariableController::~VariableController() |
|
64 | 64 | { |
|
65 |
qCDebug(LOG_VariableController()) |
|
|
66 | << QThread::currentThread(); | |
|
65 | qCDebug(LOG_VariableController()) | |
|
66 | << tr("VariableController destruction") << QThread::currentThread(); | |
|
67 | 67 | this->waitForFinish(); |
|
68 | 68 | } |
|
69 | 69 | |
@@ -118,6 +118,8 void VariableController::createVariable(const QString &name, | |||
|
118 | 118 | std::shared_ptr<IDataProvider> provider) noexcept |
|
119 | 119 | { |
|
120 | 120 | |
|
121 | qCDebug(LOG_VariableController()) | |
|
122 | << "VariableController::createVariable" << QThread::currentThread()->objectName(); | |
|
121 | 123 | if (!impl->m_TimeController) { |
|
122 | 124 | qCCritical(LOG_VariableController()) |
|
123 | 125 | << tr("Impossible to create variable: The time controller is null"); |
@@ -139,6 +141,8 void VariableController::createVariable(const QString &name, | |||
|
139 | 141 | auto addDateTimeAcquired |
|
140 | 142 | = [this, newVariable](auto dataSeriesAcquired, auto dateTimeToPutInCache) { |
|
141 | 143 | |
|
144 | qCInfo(LOG_VariableController()) << "VariableController::createVariable" | |
|
145 | << QThread::currentThread()->objectName(); | |
|
142 | 146 | impl->m_VariableCacheController->addDateTime(newVariable, dateTimeToPutInCache); |
|
143 | 147 | newVariable->setDataSeries(dataSeriesAcquired); |
|
144 | 148 | |
@@ -154,6 +158,8 void VariableController::createVariable(const QString &name, | |||
|
154 | 158 | |
|
155 | 159 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) |
|
156 | 160 | { |
|
161 | qCDebug(LOG_VariableController()) | |
|
162 | << "VariableController::onDateTimeOnSelection" << QThread::currentThread()->objectName(); | |
|
157 | 163 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); |
|
158 | 164 | |
|
159 | 165 | for (const auto &selectedRow : qAsConst(selectedRows)) { |
@@ -168,6 +174,8 void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) | |||
|
168 | 174 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, |
|
169 | 175 | const SqpDateTime &dateTime) |
|
170 | 176 | { |
|
177 | qCDebug(LOG_VariableController()) | |
|
178 | << "VariableController::onRequestDataLoading" << QThread::currentThread()->objectName(); | |
|
171 | 179 | // we want to load data of the variable for the dateTime. |
|
172 | 180 | // First we check if the cache contains some of them. |
|
173 | 181 | // For the other, we ask the provider to give them. |
@@ -18,6 +18,14 public: | |||
|
18 | 18 | m_VariableController{std::make_unique<VariableController>()}, |
|
19 | 19 | m_VisualizationController{std::make_unique<VisualizationController>()} |
|
20 | 20 | { |
|
21 | QThread::currentThread()->setObjectName("MainThread"); | |
|
22 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
|
23 | m_DataSourceControllerThread.setObjectName("DataSourceControllerThread"); | |
|
24 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
|
25 | m_VariableControllerThread.setObjectName("VariableControllerThread"); | |
|
26 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
|
27 | m_VisualizationControllerThread.setObjectName("VisualizationControllerThread"); | |
|
28 | ||
|
21 | 29 | // /////////////////////////////// // |
|
22 | 30 | // Connections between controllers // |
|
23 | 31 | // /////////////////////////////// // |
@@ -37,9 +45,6 public: | |||
|
37 | 45 | m_VisualizationController.get(), |
|
38 | 46 | SIGNAL(variableAboutToBeDeleted(std::shared_ptr<Variable>)), Qt::DirectConnection); |
|
39 | 47 | |
|
40 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
|
41 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
|
42 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
|
43 | 48 | |
|
44 | 49 | // Additionnal init |
|
45 | 50 | m_VariableController->setTimeController(m_TimeController.get()); |
@@ -5,12 +5,16 | |||
|
5 | 5 | |
|
6 | 6 | #include <Variable/Variable.h> |
|
7 | 7 | |
|
8 | #include <QElapsedTimer> | |
|
9 | ||
|
10 | 8 | Q_LOGGING_CATEGORY(LOG_VisualizationGraphHelper, "VisualizationGraphHelper") |
|
11 | 9 | |
|
12 | 10 | namespace { |
|
13 | 11 | |
|
12 | class SqpDataContainer : public QCPGraphDataContainer { | |
|
13 | public: | |
|
14 | void sqpAdd(const QCPGraphData &data) { mData.append(data); } | |
|
15 | }; | |
|
16 | ||
|
17 | ||
|
14 | 18 | /// Format for datetimes on a axis |
|
15 | 19 | const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss"); |
|
16 | 20 | |
@@ -33,35 +37,36 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis) | |||
|
33 | 37 | void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSeries, |
|
34 | 38 | const SqpDateTime &dateTime) |
|
35 | 39 | { |
|
36 | QElapsedTimer timer; | |
|
37 | timer.start(); | |
|
40 | qCInfo(LOG_VisualizationGraphHelper()) | |
|
41 | << "TORM: updateScalarData" << QThread::currentThread()->objectName(); | |
|
38 | 42 | if (auto qcpGraph = dynamic_cast<QCPGraph *>(component)) { |
|
39 | 43 | // Clean the graph |
|
40 | 44 | // NAIVE approch |
|
41 | const auto &xData = scalarSeries.xAxisData()->data(); | |
|
42 | const auto &valuesData = scalarSeries.valuesData()->data(); | |
|
43 | const auto count = xData.count(); | |
|
44 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points in cache" << xData.count(); | |
|
45 | auto xValue = QVector<double>(count); | |
|
46 | auto vValue = QVector<double>(count); | |
|
47 | ||
|
48 | int n = 0; | |
|
49 | for (auto i = 0; i < count; ++i) { | |
|
50 | const auto x = xData[i]; | |
|
51 | if (x >= dateTime.m_TStart && x <= dateTime.m_TEnd) { | |
|
52 | xValue[n] = x; | |
|
53 | vValue[n] = valuesData[i]; | |
|
54 | ++n; | |
|
45 | scalarSeries.lockRead(); | |
|
46 | { | |
|
47 | const auto xData = scalarSeries.xAxisData()->data(); | |
|
48 | const auto valuesData = scalarSeries.valuesData()->data(); | |
|
49 | const auto count = xData.count(); | |
|
50 | qCInfo(LOG_VisualizationGraphHelper()) | |
|
51 | << "TORM: Current points in cache" << xData.count(); | |
|
52 | ||
|
53 | auto dataContainer = qcpGraph->data(); | |
|
54 | dataContainer->clear(); | |
|
55 | auto sqpDataContainer = QSharedPointer<SqpDataContainer>::create(); | |
|
56 | qcpGraph->setData(sqpDataContainer); | |
|
57 | ||
|
58 | for (auto i = 0; i < count; ++i) { | |
|
59 | const auto x = xData[i]; | |
|
60 | if (x >= dateTime.m_TStart && x <= dateTime.m_TEnd) { | |
|
61 | sqpDataContainer->sqpAdd(QCPGraphData(x, valuesData[i])); | |
|
62 | } | |
|
55 | 63 | } |
|
64 | sqpDataContainer->sort(); | |
|
65 | qCInfo(LOG_VisualizationGraphHelper()) | |
|
66 | << "TORM: Current points displayed" << sqpDataContainer->size(); | |
|
56 | 67 | } |
|
68 | scalarSeries.unlock(); | |
|
57 | 69 | |
|
58 | xValue.resize(n); | |
|
59 | vValue.resize(n); | |
|
60 | ||
|
61 | qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points displayed" | |
|
62 | << xValue.count(); | |
|
63 | ||
|
64 | qcpGraph->setData(xValue, vValue); | |
|
65 | 70 | |
|
66 | 71 | // Display all data |
|
67 | 72 | component->rescaleAxes(); |
@@ -79,7 +79,6 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable) | |||
|
79 | 79 | |
|
80 | 80 | connect(variable.get(), SIGNAL(updated()), this, SLOT(onDataCacheVariableUpdated())); |
|
81 | 81 | } |
|
82 | ||
|
83 | 82 | void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> variable) |
|
84 | 83 | { |
|
85 | 84 | |
@@ -178,7 +177,8 void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept | |||
|
178 | 177 | |
|
179 | 178 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1) |
|
180 | 179 | { |
|
181 |
qCDebug(LOG_VisualizationGraphWidget()) |
|
|
180 | qCDebug(LOG_VisualizationGraphWidget()) | |
|
181 | << tr("VisualizationGraphWidget::onRangeChanged") << QThread::currentThread()->objectName(); | |
|
182 | 182 | |
|
183 | 183 | for (auto it = impl->m_VariableToPlotMultiMap.cbegin(); |
|
184 | 184 | it != impl->m_VariableToPlotMultiMap.cend(); ++it) { |
@@ -1049,8 +1049,9 QCPLayer::~QCPLayer() | |||
|
1049 | 1049 | mChildren.last()->setLayer(0); // removes itself from mChildren via removeChild() |
|
1050 | 1050 | |
|
1051 | 1051 | if (mParentPlot->currentLayer() == this) |
|
1052 | qDebug() << Q_FUNC_INFO << "The parent plot's mCurrentLayer will be a dangling pointer. " | |
|
1053 | "Should have been set to a valid layer or 0 beforehand."; | |
|
1052 | qDebug() << Q_FUNC_INFO | |
|
1053 | << "The parent plot's mCurrentLayer will be a dangling pointer. " | |
|
1054 | "Should have been set to a valid layer or 0 beforehand."; | |
|
1054 | 1055 | } |
|
1055 | 1056 | |
|
1056 | 1057 | /*! |
@@ -1574,10 +1575,7 void QCPLayerable::applyAntialiasingHint(QCPPainter *painter, bool localAntialia | |||
|
1574 | 1575 | |
|
1575 | 1576 | \see initializeParentPlot |
|
1576 | 1577 | */ |
|
1577 | void QCPLayerable::parentPlotInitialized(QCustomPlot *parentPlot) | |
|
1578 | { | |
|
1579 | Q_UNUSED(parentPlot) | |
|
1580 | } | |
|
1578 | void QCPLayerable::parentPlotInitialized(QCustomPlot *parentPlot){Q_UNUSED(parentPlot)} | |
|
1581 | 1579 | |
|
1582 | 1580 | /*! \internal |
|
1583 | 1581 | |
@@ -8485,8 +8483,9 void QCPAxis::scaleRange(double factor, double center) | |||
|
8485 | 8483 | mRange = newRange.sanitizedForLogScale(); |
|
8486 | 8484 | } |
|
8487 | 8485 | else |
|
8488 | qDebug() << Q_FUNC_INFO << "Center of scaling operation doesn't lie in same " | |
|
8489 | "logarithmic sign domain as range:" | |
|
8486 | qDebug() << Q_FUNC_INFO | |
|
8487 | << "Center of scaling operation doesn't lie in same " | |
|
8488 | "logarithmic sign domain as range:" | |
|
8490 | 8489 | << center; |
|
8491 | 8490 | } |
|
8492 | 8491 | emit rangeChanged(mRange); |
@@ -9257,14 +9256,16 void QCPAxisPainterPrivate::draw(QCPPainter *painter) | |||
|
9257 | 9256 | painter->setBrush(QBrush(basePen.color())); |
|
9258 | 9257 | QCPVector2D baseLineVector(baseLine.dx(), baseLine.dy()); |
|
9259 | 9258 | if (lowerEnding.style() != QCPLineEnding::esNone) |
|
9260 |
lowerEnding.draw(painter, |
|
|
9261 | - baseLineVector.normalized() * lowerEnding.realLength() | |
|
9262 | * (lowerEnding.inverted() ? -1 : 1), | |
|
9259 | lowerEnding.draw(painter, | |
|
9260 | QCPVector2D(baseLine.p1()) | |
|
9261 | - baseLineVector.normalized() * lowerEnding.realLength() | |
|
9262 | * (lowerEnding.inverted() ? -1 : 1), | |
|
9263 | 9263 | -baseLineVector); |
|
9264 | 9264 | if (upperEnding.style() != QCPLineEnding::esNone) |
|
9265 |
upperEnding.draw(painter, |
|
|
9266 | + baseLineVector.normalized() * upperEnding.realLength() | |
|
9267 | * (upperEnding.inverted() ? -1 : 1), | |
|
9265 | upperEnding.draw(painter, | |
|
9266 | QCPVector2D(baseLine.p2()) | |
|
9267 | + baseLineVector.normalized() * upperEnding.realLength() | |
|
9268 | * (upperEnding.inverted() ? -1 : 1), | |
|
9268 | 9269 | baseLineVector); |
|
9269 | 9270 | painter->setAntialiasing(antialiasingBackup); |
|
9270 | 9271 | |
@@ -9570,14 +9571,16 void QCPAxisPainterPrivate::placeTickLabel(QCPPainter *painter, double position, | |||
|
9570 | 9571 | bool labelClippedByBorder = false; |
|
9571 | 9572 | if (tickLabelSide == QCPAxis::lsOutside) { |
|
9572 | 9573 | if (QCPAxis::orientation(type) == Qt::Horizontal) |
|
9573 |
labelClippedByBorder = finalPosition.x() |
|
|
9574 |
|
|
|
9574 | labelClippedByBorder = finalPosition.x() | |
|
9575 | + (labelData.rotatedTotalBounds.width() | |
|
9576 | + labelData.rotatedTotalBounds.left()) | |
|
9575 | 9577 | > viewportRect.right() |
|
9576 | 9578 | || finalPosition.x() + labelData.rotatedTotalBounds.left() |
|
9577 | 9579 | < viewportRect.left(); |
|
9578 | 9580 | else |
|
9579 |
labelClippedByBorder = finalPosition.y() |
|
|
9580 |
|
|
|
9581 | labelClippedByBorder = finalPosition.y() | |
|
9582 | + (labelData.rotatedTotalBounds.height() | |
|
9583 | + labelData.rotatedTotalBounds.top()) | |
|
9581 | 9584 | > viewportRect.bottom() |
|
9582 | 9585 | || finalPosition.y() + labelData.rotatedTotalBounds.top() |
|
9583 | 9586 | < viewportRect.top(); |
@@ -12528,8 +12531,9 double QCPAbstractItem::rectDistance(const QRectF &rect, const QPointF &pos, boo | |||
|
12528 | 12531 | */ |
|
12529 | 12532 | QPointF QCPAbstractItem::anchorPixelPosition(int anchorId) const |
|
12530 | 12533 | { |
|
12531 | qDebug() << Q_FUNC_INFO << "called on item which shouldn't have any anchors (this method not " | |
|
12532 | "reimplemented). anchorId" | |
|
12534 | qDebug() << Q_FUNC_INFO | |
|
12535 | << "called on item which shouldn't have any anchors (this method not " | |
|
12536 | "reimplemented). anchorId" | |
|
12533 | 12537 | << anchorId; |
|
12534 | 12538 | return QPointF(); |
|
12535 | 12539 | } |
@@ -13455,9 +13459,10 void QCustomPlot::setOpenGl(bool enabled, int multisampling) | |||
|
13455 | 13459 | setupPaintBuffers(); |
|
13456 | 13460 | #else |
|
13457 | 13461 | Q_UNUSED(enabled) |
|
13458 | qDebug() << Q_FUNC_INFO << "QCustomPlot can't use OpenGL because QCUSTOMPLOT_USE_OPENGL was " | |
|
13459 | "not defined during compilation (add 'DEFINES += " | |
|
13460 | "QCUSTOMPLOT_USE_OPENGL' to your qmake .pro file)"; | |
|
13462 | qDebug() << Q_FUNC_INFO | |
|
13463 | << "QCustomPlot can't use OpenGL because QCUSTOMPLOT_USE_OPENGL was " | |
|
13464 | "not defined during compilation (add 'DEFINES += " | |
|
13465 | "QCUSTOMPLOT_USE_OPENGL' to your qmake .pro file)"; | |
|
13461 | 13466 | #endif |
|
13462 | 13467 | } |
|
13463 | 13468 | |
@@ -13814,8 +13819,9 QCPGraph *QCustomPlot::addGraph(QCPAxis *keyAxis, QCPAxis *valueAxis) | |||
|
13814 | 13819 | if (!valueAxis) |
|
13815 | 13820 | valueAxis = yAxis; |
|
13816 | 13821 | if (!keyAxis || !valueAxis) { |
|
13817 | qDebug() << Q_FUNC_INFO << "can't use default QCustomPlot xAxis or yAxis, because at least " | |
|
13818 | "one is invalid (has been deleted)"; | |
|
13822 | qDebug() << Q_FUNC_INFO | |
|
13823 | << "can't use default QCustomPlot xAxis or yAxis, because at least " | |
|
13824 | "one is invalid (has been deleted)"; | |
|
13819 | 13825 | return 0; |
|
13820 | 13826 | } |
|
13821 | 13827 | if (keyAxis->parentPlot() != this || valueAxis->parentPlot() != this) { |
@@ -15237,8 +15243,9 QCPAbstractPaintBuffer *QCustomPlot::createPaintBuffer() | |||
|
15237 | 15243 | return new QCPPaintBufferGlPbuffer(viewport().size(), mBufferDevicePixelRatio, |
|
15238 | 15244 | mOpenGlMultisamples); |
|
15239 | 15245 | #else |
|
15240 | qDebug() << Q_FUNC_INFO << "OpenGL enabled even though no support for it compiled in, this " | |
|
15241 | "shouldn't have happened. Falling back to pixmap paint buffer."; | |
|
15246 | qDebug() << Q_FUNC_INFO | |
|
15247 | << "OpenGL enabled even though no support for it compiled in, this " | |
|
15248 | "shouldn't have happened. Falling back to pixmap paint buffer."; | |
|
15242 | 15249 | return new QCPPaintBufferPixmap(viewport().size(), mBufferDevicePixelRatio); |
|
15243 | 15250 | #endif |
|
15244 | 15251 | } |
@@ -16469,8 +16476,9 void QCPColorGradient::updateColorBuffer() | |||
|
16469 | 16476 | hue -= 1.0; |
|
16470 | 16477 | if (useAlpha) { |
|
16471 | 16478 | const QRgb rgb |
|
16472 |
= QColor::fromHsvF(hue, |
|
|
16473 |
|
|
|
16479 | = QColor::fromHsvF(hue, | |
|
16480 | (1 - t) * lowHsv.saturationF() | |
|
16481 | + t * highHsv.saturationF(), | |
|
16474 | 16482 | (1 - t) * lowHsv.valueF() + t * highHsv.valueF()) |
|
16475 | 16483 | .rgb(); |
|
16476 | 16484 | const float alpha = (1 - t) * lowHsv.alphaF() + t * highHsv.alphaF(); |
@@ -16479,8 +16487,9 void QCPColorGradient::updateColorBuffer() | |||
|
16479 | 16487 | } |
|
16480 | 16488 | else { |
|
16481 | 16489 | mColorBuffer[i] |
|
16482 |
= QColor::fromHsvF(hue, |
|
|
16483 |
|
|
|
16490 | = QColor::fromHsvF(hue, | |
|
16491 | (1 - t) * lowHsv.saturationF() | |
|
16492 | + t * highHsv.saturationF(), | |
|
16484 | 16493 | (1 - t) * lowHsv.valueF() + t * highHsv.valueF()) |
|
16485 | 16494 | .rgb(); |
|
16486 | 16495 | } |
@@ -18570,7 +18579,7 void QCPLegend::setIconSize(const QSize &size) | |||
|
18570 | 18579 | } |
|
18571 | 18580 | |
|
18572 | 18581 | /*! \overload |
|
18573 | */ | |
|
18582 | */ | |
|
18574 | 18583 | void QCPLegend::setIconSize(int width, int height) |
|
18575 | 18584 | { |
|
18576 | 18585 | mIconSize.setWidth(width); |
@@ -6,6 +6,7 | |||
|
6 | 6 | #include <cmath> |
|
7 | 7 | |
|
8 | 8 | #include <QDateTime> |
|
9 | #include <QThread> | |
|
9 | 10 | |
|
10 | 11 | Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider") |
|
11 | 12 | |
@@ -39,6 +40,8 CosinusProvider::retrieveData(const DataProviderParameters ¶meters) const | |||
|
39 | 40 | |
|
40 | 41 | void CosinusProvider::requestDataLoading(const QVector<SqpDateTime> &dateTimeList) |
|
41 | 42 | { |
|
43 | qCInfo(LOG_CosinusProvider()) << "CosinusProvider::requestDataLoading" | |
|
44 | << QThread::currentThread()->objectName(); | |
|
42 | 45 | // NOTE: Try to use multithread if possible |
|
43 | 46 | for (const auto &dateTime : dateTimeList) { |
|
44 | 47 | auto scalarSeries = this->retrieveData(DataProviderParameters{dateTime}); |
General Comments 0
You need to be logged in to leave comments.
Login now