##// END OF EJS Templates
Adds method into ArrayData and DataSeries iterator to get all values
Alexandre Leroux -
r621:91c7adcb7714
parent child
Show More
@@ -87,10 +87,9 public:
87 return it != end ? *it : std::numeric_limits<double>::quiet_NaN();
87 return it != end ? *it : std::numeric_limits<double>::quiet_NaN();
88 }
88 }
89
89
90 private:
90 QVector<double> values() const override
91 std::vector<double> values() const
92 {
91 {
93 auto result = std::vector<double>{};
92 auto result = QVector<double>{};
94 for (auto i = 0; i < m_NbComponents; ++i) {
93 for (auto i = 0; i < m_NbComponents; ++i) {
95 result.push_back(*(m_It + i));
94 result.push_back(*(m_It + i));
96 }
95 }
@@ -98,6 +97,7 private:
98 return result;
97 return result;
99 }
98 }
100
99
100 private:
101 DataContainer::const_iterator m_It;
101 DataContainer::const_iterator m_It;
102 int m_NbComponents;
102 int m_NbComponents;
103 };
103 };
@@ -4,6 +4,7
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5 #include "Data/SqpIterator.h"
5 #include "Data/SqpIterator.h"
6
6
7 #include <QVector>
7 #include <memory>
8 #include <memory>
8
9
9 /**
10 /**
@@ -25,6 +26,7 public:
25 virtual double first() const = 0;
26 virtual double first() const = 0;
26 virtual double min() const = 0;
27 virtual double min() const = 0;
27 virtual double max() const = 0;
28 virtual double max() const = 0;
29 virtual QVector<double> values() const = 0;
28 };
30 };
29
31
30 explicit ArrayDataIteratorValue(std::unique_ptr<Impl> impl);
32 explicit ArrayDataIteratorValue(std::unique_ptr<Impl> impl);
@@ -46,6 +48,8 public:
46 double min() const;
48 double min() const;
47 /// Gets max value among all components
49 /// Gets max value among all components
48 double max() const;
50 double max() const;
51 /// Gets all values
52 QVector<double> values() const;
49
53
50 private:
54 private:
51 std::unique_ptr<Impl> m_Impl;
55 std::unique_ptr<Impl> m_Impl;
@@ -67,6 +67,7 public:
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(); }
68 double minValue() const override { return m_ValuesIt->min(); }
69 double maxValue() const override { return m_ValuesIt->max(); }
69 double maxValue() const override { return m_ValuesIt->max(); }
70 QVector<double> values() const override { return m_ValuesIt->values(); }
70
71
71 private:
72 private:
72 ArrayDataIterator m_XIt;
73 ArrayDataIterator m_XIt;
@@ -4,6 +4,7
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5 #include "Data/SqpIterator.h"
5 #include "Data/SqpIterator.h"
6
6
7 #include <QVector>
7 #include <memory>
8 #include <memory>
8
9
9 /**
10 /**
@@ -27,6 +28,7 public:
27 virtual double value(int componentIndex) const = 0;
28 virtual double value(int componentIndex) const = 0;
28 virtual double minValue() const = 0;
29 virtual double minValue() const = 0;
29 virtual double maxValue() const = 0;
30 virtual double maxValue() const = 0;
31 virtual QVector<double> values() const = 0;
30 };
32 };
31
33
32 explicit DataSeriesIteratorValue(std::unique_ptr<Impl> impl);
34 explicit DataSeriesIteratorValue(std::unique_ptr<Impl> impl);
@@ -50,6 +52,8 public:
50 double minValue() const;
52 double minValue() const;
51 /// Gets max of all values data
53 /// Gets max of all values data
52 double maxValue() const;
54 double maxValue() const;
55 /// Gets all values data
56 QVector<double> values() const;
53
57
54 private:
58 private:
55 std::unique_ptr<Impl> m_Impl;
59 std::unique_ptr<Impl> m_Impl;
@@ -50,3 +50,8 double ArrayDataIteratorValue::max() const
50 {
50 {
51 return m_Impl->max();
51 return m_Impl->max();
52 }
52 }
53
54 QVector<double> ArrayDataIteratorValue::values() const
55 {
56 return m_Impl->values();
57 }
@@ -56,3 +56,8 double DataSeriesIteratorValue::maxValue() const
56 {
56 {
57 return m_Impl->maxValue();
57 return m_Impl->maxValue();
58 }
58 }
59
60 QVector<double> DataSeriesIteratorValue::values() const
61 {
62 return m_Impl->values();
63 }
General Comments 0
You need to be logged in to leave comments. Login now