##// END OF EJS Templates
Updates access to y-axis properties of the data series (1)...
Alexandre Leroux -
r988:99f1718ec669
parent child
Show More
@@ -193,6 +193,9 public:
193 /// @sa IDataSeries::xAxisUnit()
193 /// @sa IDataSeries::xAxisUnit()
194 Unit xAxisUnit() const override { return m_XAxisUnit; }
194 Unit xAxisUnit() const override { return m_XAxisUnit; }
195
195
196 /// @sa IDataSeries::yAxisUnit()
197 Unit yAxisUnit() const override { return m_YAxis.unit(); }
198
196 /// @return the values dataset
199 /// @return the values dataset
197 std::shared_ptr<ArrayData<Dim> > valuesData() { return m_ValuesData; }
200 std::shared_ptr<ArrayData<Dim> > valuesData() { return m_ValuesData; }
198 const std::shared_ptr<ArrayData<Dim> > valuesData() const { return m_ValuesData; }
201 const std::shared_ptr<ArrayData<Dim> > valuesData() const { return m_ValuesData; }
@@ -202,6 +205,8 public:
202
205
203 int nbPoints() const override { return m_ValuesData->totalSize(); }
206 int nbPoints() const override { return m_ValuesData->totalSize(); }
204
207
208 std::pair<double, double> yBounds() const override { return m_YAxis.bounds(); }
209
205 void clear()
210 void clear()
206 {
211 {
207 m_XAxisData->clear();
212 m_XAxisData->clear();
@@ -384,8 +389,8 public:
384 }
389 }
385
390
386 /// @return the y-axis associated to the data series
391 /// @return the y-axis associated to the data series
387 /// @todo pass getter as protected and use iterators to access the y-axis data
392 const OptionalAxis &yAxis() const { return m_YAxis; }
388 OptionalAxis yAxis() const { return m_YAxis; }
393 OptionalAxis &yAxis() { return m_YAxis; }
389
394
390 // /////// //
395 // /////// //
391 // Mutexes //
396 // Mutexes //
@@ -39,6 +39,9 public:
39
39
40 virtual Unit xAxisUnit() const = 0;
40 virtual Unit xAxisUnit() const = 0;
41
41
42 /// @return the y-axis unit, if axis is defined, default unit otherwise
43 virtual Unit yAxisUnit() const = 0;
44
42 virtual Unit valuesUnit() const = 0;
45 virtual Unit valuesUnit() const = 0;
43
46
44 virtual void merge(IDataSeries *dataSeries) = 0;
47 virtual void merge(IDataSeries *dataSeries) = 0;
@@ -53,6 +56,9 public:
53 /// @return the total number of points contained in the data series
56 /// @return the total number of points contained in the data series
54 virtual int nbPoints() const = 0;
57 virtual int nbPoints() const = 0;
55
58
59 /// @return the bounds of the y-axis axis (if defined)
60 virtual std::pair<double, double> yBounds() const = 0;
61
56 // ///////// //
62 // ///////// //
57 // Iterators //
63 // Iterators //
58 // ///////// //
64 // ///////// //
@@ -101,8 +101,7 struct AxisSetter<T, typename std::enable_if_t<std::is_base_of<SpectrogramSeries
101 {
101 {
102 dataSeries.lockRead();
102 dataSeries.lockRead();
103 auto xAxisUnit = dataSeries.xAxisUnit();
103 auto xAxisUnit = dataSeries.xAxisUnit();
104 /// @todo ALX: use iterators here
104 auto yAxisUnit = dataSeries.yAxisUnit();
105 auto yAxisUnit = dataSeries.yAxis().unit();
106 auto valuesUnit = dataSeries.valuesUnit();
105 auto valuesUnit = dataSeries.valuesUnit();
107 dataSeries.unlock();
106 dataSeries.unlock();
108
107
@@ -180,8 +180,7 struct PlottablesUpdater<T,
180 static void setPlotYAxisRange(T &dataSeries, const SqpRange &xAxisRange, QCustomPlot &plot)
180 static void setPlotYAxisRange(T &dataSeries, const SqpRange &xAxisRange, QCustomPlot &plot)
181 {
181 {
182 double min, max;
182 double min, max;
183 /// @todo ALX: use iterators here
183 std::tie(min, max) = dataSeries.yBounds();
184 std::tie(min, max) = dataSeries.yAxis().bounds();
185
184
186 if (!std::isnan(min) && !std::isnan(max)) {
185 if (!std::isnan(min) && !std::isnan(max)) {
187 plot.yAxis->setRange(QCPRange{min, max});
186 plot.yAxis->setRange(QCPRange{min, max});
General Comments 0
You need to be logged in to leave comments. Login now