Debian Codegraph @

contrib/qtsolutions/qwtcurve/qwt_plot_gapped_curve.cpp

raw symbols SCIP
1 #include "qwt_plot_gapped_curve.h"
2
3 ////////////////////////////////////////////////////////////////////////////////
4 QwtPlotGappedCurve::QwtPlotGappedCurve(double gapValue)
5 : QwtPlotCurve(),
6 gapValue_(gapValue), naValue_(0)
7 {
8 }
9
10 ////////////////////////////////////////////////////////////////////////////////
11 QwtPlotGappedCurve::QwtPlotGappedCurve(const QwtText &title, double gapValue)
12 : QwtPlotCurve(title),
13 gapValue_(gapValue), naValue_(0)
14 {
15 }
16
17 ////////////////////////////////////////////////////////////////////////////////
18 QwtPlotGappedCurve::QwtPlotGappedCurve(const QString &title, double gapValue)
19 : QwtPlotCurve(title),
20 gapValue_(gapValue) , naValue_(0)
21 {
22 }
23
24 ////////////////////////////////////////////////////////////////////////////////
25 void QwtPlotGappedCurve::drawSeries(QPainter *painter, const QwtScaleMap &xMap,
26 const QwtScaleMap &yMap, const QRectF &canvRect, int from, int to) const
27 {
28 if ( !painter || dataSize() <= 0 )
29 return;
30
31 if (to < 0)
32 to = dataSize();
33
34 int i = from;
35 double last = 0;
36 while (i < to)
37 {
38 // First non-missed point will be the start of curve section.
39 double x = sample(i).x();
40 double y = sample(i).y();
41 double yprev = 0;
42 if (i>0) yprev = sample(i-1).y();
43
44 if ((y < (naValue_ + -0.001) || y > (naValue_ + 0.001)) && (x - last <= gapValue_) &&
45 (yprev < (naValue_ + -0.001) || yprev > (naValue_ + 0.001))) {
46
47 int start = i-1;
48 int end = i;
49
50 // Draw the curve section
51 QwtPlotCurve::drawSeries(painter, xMap, yMap, canvRect, start, end);
52 }
53
54 last = x;
55 i++;
56 }
57 }
58
59 ////////////////////////////////////////////////////////////////////////////////