File: QwtSyntheticPointData.3

package info (click to toggle)
qwt 6.1.2-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,848 kB
  • ctags: 15,811
  • sloc: cpp: 57,382; makefile: 41
file content (289 lines) | stat: -rw-r--r-- 6,069 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
.TH "QwtSyntheticPointData" 3 "Thu Dec 11 2014" "Version 6.1.2" "Qwt User's Guide" \" -*- nroff -*-
.ad l
.nh
.SH NAME
QwtSyntheticPointData \- 
.PP
Synthetic point data\&.  

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <qwt_point_data\&.h>\fP
.PP
Inherits \fBQwtSeriesData< QPointF >\fP\&.
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBQwtSyntheticPointData\fP (size_t \fBsize\fP, const \fBQwtInterval\fP &=\fBQwtInterval\fP())"
.br
.ti -1c
.RI "void \fBsetSize\fP (size_t \fBsize\fP)"
.br
.ti -1c
.RI "virtual size_t \fBsize\fP () const "
.br
.ti -1c
.RI "void \fBsetInterval\fP (const \fBQwtInterval\fP &)"
.br
.ti -1c
.RI "\fBQwtInterval\fP \fBinterval\fP () const "
.br
.ti -1c
.RI "virtual QRectF \fBboundingRect\fP () const "
.br
.RI "\fICalculate the bounding rectangle\&. \fP"
.ti -1c
.RI "virtual QPointF \fBsample\fP (size_t i) const "
.br
.ti -1c
.RI "virtual double \fBy\fP (double \fBx\fP) const =0"
.br
.ti -1c
.RI "virtual double \fBx\fP (uint index) const "
.br
.ti -1c
.RI "virtual void \fBsetRectOfInterest\fP (const QRectF &)"
.br
.ti -1c
.RI "QRectF \fBrectOfInterest\fP () const "
.br
.in -1c
.SS "Additional Inherited Members"
.SH "Detailed Description"
.PP 
Synthetic point data\&. 

\fBQwtSyntheticPointData\fP provides a fixed number of points for an interval\&. The points are calculated in equidistant steps in x-direction\&.
.PP
If the interval is invalid, the points are calculated for the 'rectangle of interest', what normally is the displayed area on the plot canvas\&. In this mode you get different levels of detail, when zooming in/out\&.
.PP
\fBExample\fP
.RS 4

.RE
.PP
The following example shows how to implement a sinus curve\&.
.PP
.PP
.nf
#include <cmath>
#include <qwt_series_data\&.h>
#include <qwt_plot_curve\&.h>
#include <qwt_plot\&.h>
#include <qapplication\&.h>

class SinusData: public QwtSyntheticPointData
{
public:
    SinusData():
        QwtSyntheticPointData( 100 )
    {
    }

    virtual double y( double x ) const
    {
        return qSin( x );
    }
};

int main(int argc, char **argv)
{
    QApplication a( argc, argv );

    QwtPlot plot;
    plot\&.setAxisScale( QwtPlot::xBottom, 0\&.0, 10\&.0 );
    plot\&.setAxisScale( QwtPlot::yLeft, -1\&.0, 1\&.0 );

    QwtPlotCurve *curve = new QwtPlotCurve( "y = sin(x)" );
    curve->setData( new SinusData() );
    curve->attach( &plot );

    plot\&.show();
    return a\&.exec();
}
.fi
.PP
 
.SH "Constructor & Destructor Documentation"
.PP 
.SS "QwtSyntheticPointData::QwtSyntheticPointData (size_tsize, const \fBQwtInterval\fP &interval = \fC\fBQwtInterval\fP()\fP)"
Constructor
.PP
\fBParameters:\fP
.RS 4
\fIsize\fP Number of points 
.br
\fIinterval\fP Bounding interval for the points
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetInterval()\fP, \fBsetSize()\fP 
.RE
.PP

.SH "Member Function Documentation"
.PP 
.SS "QRectF QwtSyntheticPointData::boundingRect () const\fC [virtual]\fP"

.PP
Calculate the bounding rectangle\&. This implementation iterates over all points, what could often be implemented much faster using the characteristics of the series\&. When there are many points it is recommended to overload and reimplement this method using the characteristics of the series ( if possible )\&.
.PP
\fBReturns:\fP
.RS 4
Bounding rectangle 
.RE
.PP

.PP
Implements \fBQwtSeriesData< QPointF >\fP\&.
.SS "\fBQwtInterval\fP QwtSyntheticPointData::interval () const"

.PP
\fBReturns:\fP
.RS 4
Bounding interval 
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetInterval()\fP, \fBsize()\fP 
.RE
.PP

.SS "QRectF QwtSyntheticPointData::rectOfInterest () const"

.PP
\fBReturns:\fP
.RS 4
'rectangle of interest' 
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetRectOfInterest()\fP 
.RE
.PP

.SS "QPointF QwtSyntheticPointData::sample (size_tindex) const\fC [virtual]\fP"
Calculate the point from an index
.PP
\fBParameters:\fP
.RS 4
\fIindex\fP Index 
.RE
.PP
\fBReturns:\fP
.RS 4
QPointF(x(index), y(x(index)));
.RE
.PP
\fBWarning:\fP
.RS 4
For invalid indices ( index < 0 || index >= \fBsize()\fP ) (0, 0) is returned\&. 
.RE
.PP

.PP
Implements \fBQwtSeriesData< QPointF >\fP\&.
.SS "void QwtSyntheticPointData::setInterval (const \fBQwtInterval\fP &interval)"
Set the bounding interval
.PP
\fBParameters:\fP
.RS 4
\fIinterval\fP Interval 
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBinterval()\fP, \fBsetSize()\fP 
.RE
.PP

.SS "void QwtSyntheticPointData::setRectOfInterest (const QRectF &rect)\fC [virtual]\fP"
Set a the 'rectangle of interest'
.PP
\fBQwtPlotSeriesItem\fP defines the current area of the plot canvas as 'rect of interest' ( \fBQwtPlotSeriesItem::updateScaleDiv()\fP )\&.
.PP
If \fBinterval()\fP\&.isValid() == false the x values are calculated in the interval rect\&.left() -> rect\&.right()\&.
.PP
\fBSee Also:\fP
.RS 4
\fBrectOfInterest()\fP 
.RE
.PP

.PP
Reimplemented from \fBQwtSeriesData< QPointF >\fP\&.
.SS "void QwtSyntheticPointData::setSize (size_tsize)"
Change the number of points
.PP
\fBParameters:\fP
.RS 4
\fIsize\fP Number of points 
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsize()\fP, \fBsetInterval()\fP 
.RE
.PP

.SS "size_t QwtSyntheticPointData::size () const\fC [virtual]\fP"

.PP
\fBReturns:\fP
.RS 4
Number of points 
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBsetSize()\fP, \fBinterval()\fP 
.RE
.PP

.PP
Implements \fBQwtSeriesData< QPointF >\fP\&.
.SS "double QwtSyntheticPointData::x (uintindex) const\fC [virtual]\fP"
Calculate a x-value from an index
.PP
x values are calculated by dividing an interval into equidistant steps\&. If !interval()\&.isValid() the interval is calculated from the 'rectangle of interest'\&.
.PP
\fBParameters:\fP
.RS 4
\fIindex\fP Index of the requested point 
.RE
.PP
\fBReturns:\fP
.RS 4
Calculated x coordinate
.RE
.PP
\fBSee Also:\fP
.RS 4
\fBinterval()\fP, \fBrectOfInterest()\fP, \fBy()\fP 
.RE
.PP

.SS "virtual double QwtSyntheticPointData::y (doublex) const\fC [pure virtual]\fP"
Calculate a y value for a x value
.PP
\fBParameters:\fP
.RS 4
\fIx\fP x value 
.RE
.PP
\fBReturns:\fP
.RS 4
Corresponding y value 
.RE
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for Qwt User's Guide from the source code\&.