Fixed text file permissions
[snark14.git] / tools / Display / plot_t.hpp
1 /** @file plot_t.hpp
2     @author Deniz
3     @description class plot_t is defined here
4     licensed under (open-source) QPL v1.0
5     which accompanies this distribution in the file QPL
6 */
7 #ifndef _PLOT_T
8 #define _PLOT_T
9
10 #include "sd_line_t.hpp"
11 #include "line_window_onevar_t.hpp"
12
13 class line_real_set_t;
14 class QString;
15 class QPainter;
16
17 typedef std::list<line_window_onevar_t> data_manyexecs_t;
18
19 /** ultimate window-coord class: holds SEVERAL vars' info and can plot them in different colors */
20 class plot_t
21 {
22   int myWidth, myHeight;
23   data_manyexecs_t data;
24   QPainter* myPainterP;
25   int rMinX, rMaxX;
26   double rMinY, rMaxY;
27   int xr_range;
28   double yr_range;
29   int xwmin, xwmax, ywmin, ywmax, xwrange, ywrange;
30   double xscalar, yscalar;
31   QString plotName, XAxisName, YAxisName;
32 public:
33   /** plot_t ctor/3
34    *  prepare a plot based on line_real_set_t and WIDTH and HEIGHT args 
35    *  name can be set in setName()
36    */
37   plot_t(line_real_set_t& LRS, int WIDTH=sd_line_t::WIDTH, int HEIGHT=sd_line_t::HEIGHT);
38
39   /** give a name to this plot_t object */
40   void setName(QString& inName);
41
42   void setXAxisName(QString& inNameX);
43
44   void setYAxisName(QString& inNameY);
45
46   /** calculate and make appropriate and human-oriented range increment for Y Axis:
47    *  1, 2, or 5 times a power of 10
48    *  such there are usually about 10 to 20 marks on the axis
49    *  this calibration can be fudged to about halve or double the number of notches
50    */
51   void makeNotchesOnYAxis(QPainter& P);
52   
53   /** just like the above, slightly trickier since we only want integers
54    */
55   void makeNotchesOnXAxis(QPainter& P);
56
57   /** plot the plot_t object */
58   void plot(QPainter& P);
59   void plotGray(QPainter& P);
60 }; // -- class plot_t
61 #endif