mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data warning C4805: '!=': unsafe mix of type 'int' and type 'bool' in operation warning C4305: 'argument': truncation from 'double' to 'float'
59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
#include "qwt_plot_gapped_curve.h"
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
QwtPlotGappedCurve::QwtPlotGappedCurve(double gapValue)
|
|
: QwtPlotCurve(),
|
|
gapValue_(gapValue), naValue_(0)
|
|
{
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
QwtPlotGappedCurve::QwtPlotGappedCurve(const QwtText &title, double gapValue)
|
|
: QwtPlotCurve(title),
|
|
gapValue_(gapValue), naValue_(0)
|
|
{
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
QwtPlotGappedCurve::QwtPlotGappedCurve(const QString &title, double gapValue)
|
|
: QwtPlotCurve(title),
|
|
gapValue_(gapValue) , naValue_(0)
|
|
{
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
void QwtPlotGappedCurve::drawSeries(QPainter *painter, const QwtScaleMap &xMap,
|
|
const QwtScaleMap &yMap, const QRectF &canvRect, int from, int to) const
|
|
{
|
|
if ( !painter || dataSize() <= 0 )
|
|
return;
|
|
|
|
size_t samples = (to < 0) ? dataSize() : to;
|
|
|
|
int i = from;
|
|
double last = 0;
|
|
while (i < samples)
|
|
{
|
|
// First non-missed point will be the start of curve section.
|
|
double x = sample(i).x();
|
|
double y = sample(i).y();
|
|
double yprev = 0;
|
|
if (i>0) yprev = sample(i-1).y();
|
|
|
|
if ((y < (naValue_ + -0.001) || y > (naValue_ + 0.001)) && (x - last <= gapValue_) &&
|
|
(yprev < (naValue_ + -0.001) || yprev > (naValue_ + 0.001))) {
|
|
|
|
int start = i-1;
|
|
int end = i;
|
|
|
|
// Draw the curve section
|
|
QwtPlotCurve::drawSeries(painter, xMap, yMap, canvRect, start, end);
|
|
}
|
|
|
|
last = x;
|
|
i++;
|
|
}
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|