SciDAVis  1.D4
Grid.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : Grid.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2007 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : 2D Grid class
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 GRID_H
30 #define GRID_H
31 
32 #include <qwt_plot.h>
33 #include <qwt_plot_grid.h>
34 #include <qwt_plot_marker.h>
35 
37 class Grid : public QwtPlotGrid
38 {
39  public:
40  Grid();
41 
42  void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &rect) const;
43  void drawLines(QPainter *painter, const QRect &rect, Qt::Orientation orientation, const QwtScaleMap &map,
44  const QwtValueList &values) const;
45 
46  bool xZeroLineEnabled(){return (mrkX >= 0)?true:false;};
47  void enableZeroLineX(bool enable = true);
48  bool yZeroLineEnabled(){return (mrkY >= 0)?true:false;};
49  void enableZeroLineY(bool enable = true);
50 
51  void setMajPenX(const QPen &p){ setMajPen(p);};
52  const QPen& majPenX() const {return majPen();};
53 
54  void setMinPenX(const QPen &p){ setMinPen(p);};
55  const QPen& minPenX() const {return minPen();};
56 
57  void setMajPenY(const QPen &p){ if (d_maj_pen_y != p) d_maj_pen_y = p;};
58  const QPen& majPenY() const {return d_maj_pen_y;};
59 
60  void setMinPenY(const QPen &p){ if (d_min_pen_y != p) d_min_pen_y = p;};
61  const QPen& minPenY() const {return d_min_pen_y;};
62 
63  void load(const QStringList& );
64  void copy(Grid *);
65  QString saveToString();
66 
67  private:
70 
71  long mrkX, mrkY;//x=0 et y=0 line markers keys
72 };
73 
74 #endif