CFEL - ASG Software Suite  2.5.0
CASS
one_d_viewer_data.h
Go to the documentation of this file.
1 // Copyright (C) 2013 Lutz Foucar
2 
3 /**
4  * @file one_d_viewer_data.h contains the wrapper of the data for the 1d viewer
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _ONEDVIEWERDATA_
10 #define _ONEDVIEWERDATA_
11 
12 #include <vector>
13 
14 #include <QtCore/QString>
15 
16 #include <qwt_series_data.h>
17 
18 #include "data.h"
19 
20 namespace cass
21 {
22 class Histogram1DFloat;
23 }//end namespace cass
24 
25 namespace jocassview
26 {
27 
28 /** the 1d data wrapper
29  *
30  * @author Lutz Foucar
31  */
32 class OneDViewerData : public QwtSeriesData<QPointF>, public Data
33 {
34 public:
35  /** default constructor
36  *
37  * intializes the _hist pointer with 0
38  */
40 
41  /** destructor
42  *
43  * deletes the _hist pointer
44  */
45  virtual ~OneDViewerData();
46 
47  /** return the size of the data
48  *
49  * @return the size of the vector that holds the data
50  */
51  virtual size_t size() const;
52 
53  /** return the x value for data point
54  *
55  * @param i the datapoint whos x value should be returned
56  */
57  virtual QPointF sample(size_t i) const;
58 
59  /** return the bounding rectangle
60  *
61  * @return the bounding rectangle
62  */
63  virtual QRectF boundingRect() const;
64 
65  /** set the cass data to be wrapped by this
66  *
67  * @param result the cass data to be wrapped
68  */
70 
71  /** retrieve pointer to the cass data
72  *
73  * @return pointer to cass data
74  */
76 
77  /** retrieve const pointer to the cass data
78  *
79  * @return const pointer to cass data
80  */
82 
83  /** set up the bounding rect for when x should be log scale
84  *
85  * in case of log-scale:
86  * find the minimum x value that is bigger than 0 and set Left to be that
87  * value.
88  *
89  * in case of lin-scale:
90  * set Left to the lowest value
91  *
92  * @param log when this parameter is true the scale will be set up for
93  * log-scale otherwise for lin-scale
94  */
95  void setXRangeForLog(bool log);
96 
97  /** set up the bounding rect for when y should be log scale
98  *
99  * in case of log-scale:
100  * find the minimum y value that is bigger than 0 and a valid number, set
101  * bottom to that value.
102  *
103  * in case of lin-scale:
104  * set bottom to the lowest value
105  *
106  * @param log when this parameter is true the scale will be set up for
107  * log-scale otherwise for lin-scale
108  */
109  void setYRangeForLog(bool log);
110 
111 public:
112  /** the minimum positions in x and y for log scales */
114 
115  /** flag to tell whether x scale will be drawn in log */
116  bool _xLog;
117 
118  /** flag to tell whether y scale will be drawn in log */
119  bool _yLog;
120 
121  /** pointer to the cass data */
123 };
124 }//end namespace jocassview
125 #endif
bool _xLog
flag to tell whether x scale will be drawn in log
virtual QRectF boundingRect() const
return the bounding rectangle
virtual QPointF sample(size_t i) const
return the x value for data point
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
Definition: result.hpp:323
contains the base class for add viewer data
QPointF _logMinPos
the minimum positions in x and y for log scales
the 1d data wrapper
virtual ~OneDViewerData()
destructor
OneDViewerData()
default constructor
void setResult(result_t::shared_pointer result)
set the cass data to be wrapped by this
virtual size_t size() const
return the size of the data
result_t::shared_pointer _result
pointer to the cass data
void setYRangeForLog(bool log)
set up the bounding rect for when y should be log scale
Data::result_t::shared_pointer result()
retrieve pointer to the cass data
void setXRangeForLog(bool log)
set up the bounding rect for when x should be log scale
base class for all data wrappers
Definition: data.h:22
bool _yLog
flag to tell whether y scale will be drawn in log