##// END OF EJS Templates
Update Variable impl for v5
perrinel -
r494:798c6712baad
parent child
Show More
@@ -47,10 +47,8 public:
47 47 bool cacheIsInside(const SqpRange &range) const noexcept;
48 48
49 49 QVector<SqpRange> provideNotInCacheRangeList(const SqpRange &range);
50
51
52 public slots:
53 50 void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
51 void mergeDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
54 52
55 53 signals:
56 54 void updated();
@@ -62,5 +60,6 private:
62 60
63 61 // Required for using shared_ptr in signals/slots
64 62 SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_REGISTRY, std::shared_ptr<Variable>)
63 SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_VECTOR_REGISTRY, QVector<std::shared_ptr<Variable> >)
65 64
66 65 #endif // SCIQLOP_VARIABLE_H
@@ -61,6 +61,26 void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept
61 61 return;
62 62 }
63 63
64 impl->m_DataSeries = dataSeries->clone();
65
66 // // Inits the data series of the variable
67 // if (!impl->m_DataSeries) {
68 // impl->m_DataSeries = dataSeries->clone();
69 // }
70 // else {
71 // impl->m_DataSeries->merge(dataSeries.get());
72 // }
73 }
74
75 void Variable::mergeDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept
76 {
77 qCDebug(LOG_Variable()) << "Variable::setDataSeries" << QThread::currentThread()->objectName();
78 if (!dataSeries) {
79 /// @todo ALX : log
80 return;
81 }
82
83 // Add or merge the data
64 84 // Inits the data series of the variable
65 85 if (!impl->m_DataSeries) {
66 86 impl->m_DataSeries = dataSeries->clone();
@@ -68,6 +88,13 void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept
68 88 else {
69 89 impl->m_DataSeries->merge(dataSeries.get());
70 90 }
91
92 // sub the data
93 auto subData = this->dataSeries()->subData(this->cacheRange());
94 qCCritical(LOG_Variable()) << "TORM: Variable::mergeDataSeries sub" << subData->range();
95 this->setDataSeries(subData);
96 qCCritical(LOG_Variable()) << "TORM: Variable::mergeDataSeries set"
97 << this->dataSeries()->range();
71 98 }
72 99
73 100 IDataSeries *Variable::dataSeries() const noexcept
@@ -127,10 +154,10 QVector<SqpRange> Variable::provideNotInCacheRangeList(const SqpRange &range)
127 154 else if (range.m_TStart < impl->m_CacheRange.m_TStart
128 155 && range.m_TEnd > impl->m_CacheRange.m_TEnd) {
129 156 notInCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TStart}
130 << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart};
157 << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TEnd};
131 158 }
132 159 else if (range.m_TStart < impl->m_CacheRange.m_TEnd) {
133 notInCache << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart};
160 notInCache << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TEnd};
134 161 }
135 162 else {
136 163 qCCritical(LOG_Variable()) << tr("Detection of unknown case.")
General Comments 0
You need to be logged in to leave comments. Login now