SciDAVis  1.D4
BoxCurve.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : BoxCurve.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6  Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7  Description : Box curve
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef BOXCURVE_H
30 #define BOXCURVE_H
31 
32 #include "PlotCurve.h"
33 #include <qwt_plot.h>
34 #include <qwt_symbol.h>
35 
37 class BoxCurve: public DataCurve
38 {
39 public:
42 
43  BoxCurve(Table *t, const char *name, int startRow = 0, int endRow = -1);
44 
45  void copy(const BoxCurve *b);
46 
47  virtual QwtDoubleRect boundingRect() const;
48 
49  QwtSymbol::Style minStyle(){return min_style;};
50  void setMinStyle(QwtSymbol::Style s){min_style = s;};
51 
52  QwtSymbol::Style maxStyle(){return max_style;};
53  void setMaxStyle(QwtSymbol::Style s){max_style = s;};
54 
55  void setMeanStyle(QwtSymbol::Style s){mean_style = s;};
56  QwtSymbol::Style meanStyle(){return mean_style;};
57 
58  void setP99Style(QwtSymbol::Style s){p99_style = s;};
59  QwtSymbol::Style p99Style(){return p99_style;};
60 
61  void setP1Style(QwtSymbol::Style s){p1_style = s;};
62  QwtSymbol::Style p1Style(){return p1_style;};
63 
64  int boxStyle(){return b_style;};
65  void setBoxStyle(int style);
66 
67  int boxWidth(){return b_width;};
68  void setBoxWidth(int width){b_width=width;};
69 
70  double boxRange(){return b_coeff;};
71  int boxRangeType(){return b_range;};
72  void setBoxRange(int type, double coeff);
73 
74  double whiskersRange(){return w_coeff;};
75  int whiskersRangeType(){return w_range;};
76  void setWhiskersRange(int type, double coeff);
77 
78  virtual bool loadData();
79 
80 private:
81  void draw(QPainter *painter,const QwtScaleMap &xMap,
82  const QwtScaleMap &yMap, int from, int to) const;
83  void drawBox(QPainter *painter, const QwtScaleMap &xMap,
84  const QwtScaleMap &yMap, double *dat, int size) const;
85  void drawSymbols(QPainter *painter, const QwtScaleMap &xMap,
86  const QwtScaleMap &yMap, double *dat, int size) const;
87 
89  double b_coeff, w_coeff;
91 };
92 
93 
95 class QwtSingleArrayData: public QwtData
96 {
97 public:
98  QwtSingleArrayData(const double x, QwtArray<double> y, size_t)
99  {
100  d_y = y;
101  d_x = x;
102  };
103 
104  virtual QwtData *copy() const{return new QwtSingleArrayData(d_x, d_y, size());};
105 
106  virtual size_t size() const{return d_y.size();};
107  virtual double x(size_t) const{return d_x;};
108  virtual double y(size_t i) const{return d_y[int(i)];};
109 
110 private:
111  QwtArray<double> d_y;
112  double d_x;
113 };
114 
115 #endif