@@ -191,16 +191,16 public: | |||||
191 | std::make_unique<dataseries_detail::IteratorValue<Dim> >(*this, false)}}; |
|
191 | std::make_unique<dataseries_detail::IteratorValue<Dim> >(*this, false)}}; | |
192 | } |
|
192 | } | |
193 |
|
193 | |||
194 | /// @sa IDataSeries::minData() |
|
194 | /// @sa IDataSeries::minXAxisData() | |
195 | DataSeriesIterator minData(double minXAxisData) const override |
|
195 | DataSeriesIterator minXAxisData(double minXAxisData) const override | |
196 | { |
|
196 | { | |
197 | return std::lower_bound( |
|
197 | return std::lower_bound( | |
198 | cbegin(), cend(), minXAxisData, |
|
198 | cbegin(), cend(), minXAxisData, | |
199 | [](const auto &itValue, const auto &value) { return itValue.x() < value; }); |
|
199 | [](const auto &itValue, const auto &value) { return itValue.x() < value; }); | |
200 | } |
|
200 | } | |
201 |
|
201 | |||
202 | /// @sa IDataSeries::maxData() |
|
202 | /// @sa IDataSeries::maxXAxisData() | |
203 | DataSeriesIterator maxData(double maxXAxisData) const override |
|
203 | DataSeriesIterator maxXAxisData(double maxXAxisData) const override | |
204 | { |
|
204 | { | |
205 | // Gets the first element that greater than max value |
|
205 | // Gets the first element that greater than max value | |
206 | auto it = std::upper_bound( |
|
206 | auto it = std::upper_bound( |
@@ -72,11 +72,11 public: | |||||
72 |
|
72 | |||
73 | /// @return the iterator to the first entry of the data series whose x-axis data is greater than |
|
73 | /// @return the iterator to the first entry of the data series whose x-axis data is greater than | |
74 | /// or equal to the value passed in parameter, or the end iterator if there is no matching value |
|
74 | /// or equal to the value passed in parameter, or the end iterator if there is no matching value | |
75 | virtual DataSeriesIterator minData(double minXAxisData) const = 0; |
|
75 | virtual DataSeriesIterator minXAxisData(double minXAxisData) const = 0; | |
76 |
|
76 | |||
77 | /// @return the iterator to the last entry of the data series whose x-axis data is less than or |
|
77 | /// @return the iterator to the last entry of the data series whose x-axis data is less than or | |
78 | /// equal to the value passed in parameter, or the end iterator if there is no matching value |
|
78 | /// equal to the value passed in parameter, or the end iterator if there is no matching value | |
79 | virtual DataSeriesIterator maxData(double maxXAxisData) const = 0; |
|
79 | virtual DataSeriesIterator maxXAxisData(double maxXAxisData) const = 0; | |
80 |
|
80 | |||
81 | virtual std::pair<DataSeriesIterator, DataSeriesIterator> subData(double min, |
|
81 | virtual std::pair<DataSeriesIterator, DataSeriesIterator> subData(double min, | |
82 | double max) const = 0; |
|
82 | double max) const = 0; |
@@ -174,11 +174,11 QVariant VariableModel::data(const QModelIndex &index, int role) const | |||||
174 | case TSTART_COLUMN: |
|
174 | case TSTART_COLUMN: | |
175 | // Shows the min value of the data series above the range tstart |
|
175 | // Shows the min value of the data series above the range tstart | |
176 | return dateTimeVariant([min = variable->range().m_TStart]( |
|
176 | return dateTimeVariant([min = variable->range().m_TStart]( | |
177 | const auto &dataSeries) { return dataSeries.minData(min); }); |
|
177 | const auto &dataSeries) { return dataSeries.minXAxisData(min); }); | |
178 | case TEND_COLUMN: |
|
178 | case TEND_COLUMN: | |
179 | // Shows the max value of the data series under the range tend |
|
179 | // Shows the max value of the data series under the range tend | |
180 | return dateTimeVariant([max = variable->range().m_TEnd]( |
|
180 | return dateTimeVariant([max = variable->range().m_TEnd]( | |
181 | const auto &dataSeries) { return dataSeries.maxData(max); }); |
|
181 | const auto &dataSeries) { return dataSeries.maxXAxisData(max); }); | |
182 | case UNIT_COLUMN: |
|
182 | case UNIT_COLUMN: | |
183 | return variable->metadata().value(QStringLiteral("units")); |
|
183 | return variable->metadata().value(QStringLiteral("units")); | |
184 | case MISSION_COLUMN: |
|
184 | case MISSION_COLUMN: |
@@ -24,18 +24,18 private slots: | |||||
24 | void testMerge(); |
|
24 | void testMerge(); | |
25 |
|
25 | |||
26 | /// Input test data |
|
26 | /// Input test data | |
27 | /// @sa testMinData() |
|
27 | /// @sa testMinXAxisData() | |
28 | void testMinData_data(); |
|
28 | void testMinXAxisData_data(); | |
29 |
|
29 | |||
30 | /// Tests get min data of a data series |
|
30 | /// Tests get min x-axis data of a data series | |
31 | void testMinData(); |
|
31 | void testMinXAxisData(); | |
32 |
|
32 | |||
33 | /// Input test data |
|
33 | /// Input test data | |
34 | /// @sa testMaxData() |
|
34 | /// @sa testMaxXAxisData() | |
35 | void testMaxData_data(); |
|
35 | void testMaxXAxisData_data(); | |
36 |
|
36 | |||
37 | /// Tests get max data of a data series |
|
37 | /// Tests get max x-axis data of a data series | |
38 | void testMaxData(); |
|
38 | void testMaxXAxisData(); | |
39 |
|
39 | |||
40 | /// Input test data |
|
40 | /// Input test data | |
41 | /// @sa testSubdata() |
|
41 | /// @sa testSubdata() | |
@@ -181,7 +181,7 void TestDataSeries::testMerge() | |||||
181 | seriesValuesData.cbegin())); |
|
181 | seriesValuesData.cbegin())); | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 | void TestDataSeries::testMinData_data() |
|
184 | void TestDataSeries::testMinXAxisData_data() | |
185 | { |
|
185 | { | |
186 | // ////////////// // |
|
186 | // ////////////// // | |
187 | // Test structure // |
|
187 | // Test structure // | |
@@ -217,7 +217,7 void TestDataSeries::testMinData_data() | |||||
217 | << std::numeric_limits<double>::quiet_NaN(); |
|
217 | << std::numeric_limits<double>::quiet_NaN(); | |
218 | } |
|
218 | } | |
219 |
|
219 | |||
220 | void TestDataSeries::testMinData() |
|
220 | void TestDataSeries::testMinXAxisData() | |
221 | { |
|
221 | { | |
222 | QFETCH(std::shared_ptr<ScalarSeries>, dataSeries); |
|
222 | QFETCH(std::shared_ptr<ScalarSeries>, dataSeries); | |
223 | QFETCH(double, min); |
|
223 | QFETCH(double, min); | |
@@ -225,7 +225,7 void TestDataSeries::testMinData() | |||||
225 | QFETCH(bool, expectedOK); |
|
225 | QFETCH(bool, expectedOK); | |
226 | QFETCH(double, expectedMin); |
|
226 | QFETCH(double, expectedMin); | |
227 |
|
227 | |||
228 | auto it = dataSeries->minData(min); |
|
228 | auto it = dataSeries->minXAxisData(min); | |
229 |
|
229 | |||
230 | QCOMPARE(expectedOK, it != dataSeries->cend()); |
|
230 | QCOMPARE(expectedOK, it != dataSeries->cend()); | |
231 |
|
231 | |||
@@ -235,7 +235,7 void TestDataSeries::testMinData() | |||||
235 | } |
|
235 | } | |
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 | void TestDataSeries::testMaxData_data() |
|
238 | void TestDataSeries::testMaxXAxisData_data() | |
239 | { |
|
239 | { | |
240 | // ////////////// // |
|
240 | // ////////////// // | |
241 | // Test structure // |
|
241 | // Test structure // | |
@@ -271,7 +271,7 void TestDataSeries::testMaxData_data() | |||||
271 | << std::numeric_limits<double>::quiet_NaN(); |
|
271 | << std::numeric_limits<double>::quiet_NaN(); | |
272 | } |
|
272 | } | |
273 |
|
273 | |||
274 | void TestDataSeries::testMaxData() |
|
274 | void TestDataSeries::testMaxXAxisData() | |
275 | { |
|
275 | { | |
276 | QFETCH(std::shared_ptr<ScalarSeries>, dataSeries); |
|
276 | QFETCH(std::shared_ptr<ScalarSeries>, dataSeries); | |
277 | QFETCH(double, max); |
|
277 | QFETCH(double, max); | |
@@ -279,7 +279,7 void TestDataSeries::testMaxData() | |||||
279 | QFETCH(bool, expectedOK); |
|
279 | QFETCH(bool, expectedOK); | |
280 | QFETCH(double, expectedMax); |
|
280 | QFETCH(double, expectedMax); | |
281 |
|
281 | |||
282 | auto it = dataSeries->maxData(max); |
|
282 | auto it = dataSeries->maxXAxisData(max); | |
283 |
|
283 | |||
284 | QCOMPARE(expectedOK, it != dataSeries->cend()); |
|
284 | QCOMPARE(expectedOK, it != dataSeries->cend()); | |
285 |
|
285 |
General Comments 0
You need to be logged in to leave comments.
Login now