##// END OF EJS Templates
Implements method to get min/max values of a dataseries giving a range (2)
Alexandre Leroux -
r570:3d5120e0d250
parent child
Show More
@@ -65,6 +65,8 public:
65 double x() const override { return m_XIt->at(0); }
65 double x() const override { return m_XIt->at(0); }
66 double value() const override { return m_ValuesIt->at(0); }
66 double value() const override { return m_ValuesIt->at(0); }
67 double value(int componentIndex) const override { return m_ValuesIt->at(componentIndex); }
67 double value(int componentIndex) const override { return m_ValuesIt->at(componentIndex); }
68 double minValue() const override { return m_ValuesIt->min(); }
69 double maxValue() const override { return m_ValuesIt->max(); }
68
70
69 private:
71 private:
70 ArrayData<1>::Iterator m_XIt;
72 ArrayData<1>::Iterator m_XIt;
@@ -241,8 +243,19 public:
241 return std::make_pair(cend(), cend());
243 return std::make_pair(cend(), cend());
242 }
244 }
243
245
244 /// @todo ALX: complete
246 // Gets the iterator on the min of all values data
247 auto minIt = std::min_element(
248 xAxisRangeIts.first, xAxisRangeIts.second, [](const auto &it1, const auto &it2) {
249 return SortUtils::minCompareWithNaN(it1.minValue(), it2.minValue());
250 });
245
251
252 // Gets the iterator on the max of all values data
253 auto maxIt = std::max_element(
254 xAxisRangeIts.first, xAxisRangeIts.second, [](const auto &it1, const auto &it2) {
255 return SortUtils::maxCompareWithNaN(it1.maxValue(), it2.maxValue());
256 });
257
258 return std::make_pair(minIt, maxIt);
246 }
259 }
247
260
248 // /////// //
261 // /////// //
@@ -24,6 +24,8 public:
24 virtual double x() const = 0;
24 virtual double x() const = 0;
25 virtual double value() const = 0;
25 virtual double value() const = 0;
26 virtual double value(int componentIndex) const = 0;
26 virtual double value(int componentIndex) const = 0;
27 virtual double minValue() const = 0;
28 virtual double maxValue() const = 0;
27 };
29 };
28
30
29 explicit DataSeriesIteratorValue(std::unique_ptr<Impl> impl);
31 explicit DataSeriesIteratorValue(std::unique_ptr<Impl> impl);
@@ -43,6 +45,10 public:
43 double value() const;
45 double value() const;
44 /// Gets value data depending on an index
46 /// Gets value data depending on an index
45 double value(int componentIndex) const;
47 double value(int componentIndex) const;
48 /// Gets min of all values data
49 double minValue() const;
50 /// Gets max of all values data
51 double maxValue() const;
46
52
47 private:
53 private:
48 std::unique_ptr<Impl> m_Impl;
54 std::unique_ptr<Impl> m_Impl;
@@ -47,6 +47,16 double DataSeriesIteratorValue::value(int componentIndex) const
47 return m_Impl->value(componentIndex);
47 return m_Impl->value(componentIndex);
48 }
48 }
49
49
50 double DataSeriesIteratorValue::minValue() const
51 {
52 return m_Impl->minValue();
53 }
54
55 double DataSeriesIteratorValue::maxValue() const
56 {
57 return m_Impl->maxValue();
58 }
59
50 DataSeriesIterator::DataSeriesIterator(DataSeriesIteratorValue value)
60 DataSeriesIterator::DataSeriesIterator(DataSeriesIteratorValue value)
51 : m_CurrentValue{std::move(value)}
61 : m_CurrentValue{std::move(value)}
52 {
62 {
General Comments 0
You need to be logged in to leave comments. Login now