2
* Copyright (c) 2011 Damien Grauser
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the Free
6
* Software Foundation; either version 2 of the License, or (at your option)
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc., 51
16
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
#ifndef _GC_HrPwWindow_h
20
#define _GC_HrPwWindow_h 1
23
#include "GoldenCheetah.h"
34
#include "LTMWindow.h" // for tooltip/canvaspicker
37
class HrPwWindow : public GcChartWindow
42
Q_PROPERTY(int shadeZones READ isShadeZones WRITE setShadeZones USER true)
43
Q_PROPERTY(int joinLine READ isJoinLine WRITE setJoinLine USER true)
44
Q_PROPERTY(int fullplot READ showFullplot WRITE setFullplot USER true)
46
int isJoinLine() const { return joinlineCheckBox->checkState(); }
47
void setJoinLine(int x) { joinlineCheckBox->setCheckState(x ? Qt::Checked : Qt::Unchecked); }
48
int isShadeZones() const { return shadeZones->checkState(); }
49
void setShadeZones(int x) { shadeZones->setCheckState(x ? Qt::Checked : Qt::Unchecked); }
50
int showFullplot() const { return fullplot->checkState(); }
51
void setFullplot(int x) { fullplot->setCheckState(x ? Qt::Checked : Qt::Unchecked); }
55
HrPwWindow(MainWindow *mainWindow);
56
void setData(RideItem *item);
57
int findDelay(QVector<double> &wattsArray, QVector<double> &hrArray, int rideTimeSecs);
59
// Maths functions used by HrPwPlot
60
double pente(QVector<double> &Xi,QVector<double> &Yi,int n);
61
double ordonnee(QVector<double> &Xi,QVector<double> &Yi,int n);
62
double corr(QVector<double> &Xi, QVector<double> &Yi,int n);
63
double moyenne(QVector<double> &Xi,int n);
66
bool hasReveal() { return true; }
74
void setJoinLineFromCheckBox();
75
void setDelayFromLineEdit();
76
void setDelayFromSlider();
77
void setSmoothingFromLineEdit();
78
void setSmoothingFromSlider();
79
void setrDelayFromLineEdit();
80
void setrDelayFromSlider();
81
void setrSmoothingFromLineEdit();
82
void setrSmoothingFromSlider();
89
MainWindow *mainWindow;
95
QCheckBox *joinlineCheckBox;
96
QCheckBox *shadeZones;
100
QLineEdit *delayEdit;
102
QSlider *smoothSlider;
103
QLineEdit *smoothEdit;
108
QSlider *rSmoothSlider;
109
QLineEdit *rSmoothEdit;
111
QSlider *rDelaySlider;
112
QLineEdit *rDelayEdit;
114
// Maths functions used by the plots
115
QVector<double> tab_temp; //Déclaration d'un tableau temporaire
116
int test_zero(QVector<double> &tab,int n);
117
int test_negatif(QVector<double> &tab,int n);
118
void logtab(QVector<double> &tab,QVector<double> &tabTemp,int n);
119
void lntab(QVector<double> &tab,QVector<double> &tabTemp,int n);
120
void invtab(QVector<double> &tab,QVector<double> &tabTemp,int n);
121
int ajustement(QVector<double> &Xi,QVector<double> &Yi,int n);
122
double moyenne(QVector<int> &tab,int n);
123
double moyenne2(double somme,int n);
124
double val_abs(double x);
125
int rmax(QVector<double> &r);
126
int somme(QVector<int> &tab,int n);
127
double somme(QVector<double> &tab,int n);
128
void produittab(QVector<double> &tab1,QVector<double> &tab2,int n);
129
void ecart_a_moyenne(QVector<double> &tab,double Moyenne,int n);
130
double covariance(QVector<double> &Xi, QVector<double> &Yi,int n);
131
double variance(QVector<double> &val,int n);
132
double ecarttype(QVector<double> &val,int n);
135
#endif // _GC_HrPwWindow_h