SciDAVis
1.D4
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
scidavis
src
Plot.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : Plot.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 : Plot window 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 PLOT_H
30
#define PLOT_H
31
32
#include <QObject>
33
#include <QMap>
34
35
#include <qwt_plot.h>
36
#include <qwt_plot_curve.h>
37
#include <qwt_plot_grid.h>
38
#include <qwt_plot_marker.h>
39
40
class
Grid
;
41
43
class
Plot
:
public
QwtPlot
44
{
45
Q_OBJECT
46
47
friend
class
Graph
;
// part of axes gaps workaround
48
49
public
:
50
Plot
(QWidget *parent = 0,
const
char
*name = 0);
51
52
enum
LabelFormat
{
Automatic
,
Decimal
,
Scientific
,
Superscripts
};
53
54
Grid
*
grid
(){
return
(
Grid
*)
d_grid
;};
55
QList<int>
curveKeys
(){
return
d_curves
.keys();};
56
QList<QwtPlotItem *>
curvesList
(){
return
d_curves
.values();};
57
58
int
insertCurve
(QwtPlotItem *c);
59
void
removeCurve
(
int
index);
60
61
int
closestCurve
(
int
xpos,
int
ypos,
int
&dist,
int
&point);
62
QwtPlotCurve*
curve
(
int
index);
63
QwtPlotItem*
plotItem
(
int
index){
return
d_curves
.value(index);};
64
QMap<int, QwtPlotItem*>
curves
(){
return
d_curves
;};
65
66
QwtPlotMarker*
marker
(
int
index){
return
d_markers
.value(index);};
67
QList<int>
markerKeys
(){
return
d_markers
.keys();};
68
int
insertMarker
(QwtPlotMarker *m);
69
void
removeMarker
(
int
index);
70
71
QList<int>
getMajorTicksType
();
72
void
setMajorTicksType
(
int
axis,
int
type);
73
74
QList<int>
getMinorTicksType
();
75
void
setMinorTicksType
(
int
axis,
int
type);
76
77
int
minorTickLength
()
const
;
78
int
majorTickLength
()
const
;
79
void
setTickLength
(
int
minLength,
int
majLength);
80
81
int
axesLinewidth
()
const
;
82
void
setAxesLinewidth
(
int
width);
83
84
void
setAxisLabelFormat
(
int
axis,
char
f,
int
prec);
85
void
axisLabelFormat
(
int
axis,
char
&f,
int
&prec)
const
;
86
87
int
axisLabelFormat
(
int
axis);
88
int
axisLabelPrecision
(
int
axis);
89
90
void
printFrame
(QPainter *painter,
const
QRect &rect)
const
;
91
92
QColor
frameColor
();
93
const
QColor &
paletteBackgroundColor
()
const
;
94
95
void
print
(QPainter *,
const
QRect &rect,
const
QwtPlotPrintFilter & = QwtPlotPrintFilter());
96
void
updateLayout
();
97
98
protected
:
99
void
printCanvas
(QPainter *painter,
const
QRect &canvasRect,
100
const
QwtScaleMap map[axisCnt],
const
QwtPlotPrintFilter &pfilter)
const
;
101
102
virtual
void
drawItems
(QPainter *painter,
const
QRect &rect,
103
const
QwtScaleMap map[axisCnt],
const
QwtPlotPrintFilter &pfilter)
const
;
104
105
void
drawInwardTicks
(QPainter *painter,
const
QRect &rect,
106
const
QwtScaleMap&map,
int
axis,
bool
min,
bool
maj)
const
;
107
Grid
*
d_grid
;
108
QMap<int, QwtPlotItem*>
d_curves
;
109
QMap<int, QwtPlotMarker*>
d_markers
;
110
111
int
minTickLength
,
majTickLength
;
112
int
marker_key
;
113
int
curve_key
;
114
};
115
#endif
Generated by
1.8.1