1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2019-03-15 19:43:17 +01:00
parent 3176a42aa5
commit 0a24a8e466
10 changed files with 27 additions and 27 deletions

View File

@ -63,11 +63,11 @@ QList<GraphItem*> CadenceGraph::loadData(const Data &data)
qreal CadenceGraph::avg() const
{
qreal sum = 0, w = 0;
QList<QPointF>::const_iterator it;
for (it = _avg.begin(); it != _avg.end(); it++) {
sum += it->y() * it->x();
w += it->x();
for (int i = 0; i < _avg.size(); i++) {
const QPointF &p = _avg.at(i);
sum += p.y() * p.x();
w += p.x();
}
return (sum / w);

View File

@ -21,7 +21,7 @@ private:
qreal max() const {return bounds().bottom();}
void setInfo();
QList<QPointF> _avg;
QVector<QPointF> _avg;
bool _showTracks;
};

View File

@ -63,11 +63,11 @@ QList<GraphItem*> HeartRateGraph::loadData(const Data &data)
qreal HeartRateGraph::avg() const
{
qreal sum = 0, w = 0;
QList<QPointF>::const_iterator it;
for (it = _avg.begin(); it != _avg.end(); it++) {
sum += it->y() * it->x();
w += it->x();
for (int i = 0; i < _avg.size(); i++) {
const QPointF &p = _avg.at(i);
sum += p.y() * p.x();
w += p.x();
}
return (sum / w);

View File

@ -20,7 +20,7 @@ private:
qreal max() const {return bounds().bottom();}
void setInfo();
QList<QPointF> _avg;
QVector<QPointF> _avg;
bool _showTracks;
};

View File

@ -63,11 +63,11 @@ QList<GraphItem*> PowerGraph::loadData(const Data &data)
qreal PowerGraph::avg() const
{
qreal sum = 0, w = 0;
QList<QPointF>::const_iterator it;
for (it = _avg.begin(); it != _avg.end(); it++) {
sum += it->y() * it->x();
w += it->x();
for (int i = 0; i < _avg.size(); i++) {
const QPointF &p = _avg.at(i);
sum += p.y() * p.x();
w += p.x();
}
return (sum / w);

View File

@ -20,7 +20,7 @@ private:
qreal max() const {return bounds().bottom();}
void setInfo();
QList<QPointF> _avg;
QVector<QPointF> _avg;
bool _showTracks;
};

View File

@ -74,12 +74,12 @@ QList<GraphItem*> SpeedGraph::loadData(const Data &data)
qreal SpeedGraph::avg() const
{
qreal sum = 0, w = 0;
QList<QPointF>::const_iterator it;
const QList<QPointF> &list = (_timeType == Moving) ? _mavg : _avg;
const QVector<QPointF> &vector = (_timeType == Moving) ? _mavg : _avg;
for (it = list.begin(); it != list.end(); it++) {
sum += it->y() * it->x();
w += it->x();
for (int i = 0; i < vector.size(); i++) {
const QPointF &p = vector.at(i);
sum += p.y() * p.x();
w += p.x();
}
return (sum / w);

View File

@ -24,8 +24,8 @@ private:
void setYUnits();
void setInfo();
QList<QPointF> _avg;
QList<QPointF> _mavg;
QVector<QPointF> _avg;
QVector<QPointF> _mavg;
Units _units;
TimeType _timeType;

View File

@ -66,11 +66,11 @@ QList<GraphItem*> TemperatureGraph::loadData(const Data &data)
qreal TemperatureGraph::avg() const
{
qreal sum = 0, w = 0;
QList<QPointF>::const_iterator it;
for (it = _avg.begin(); it != _avg.end(); it++) {
sum += it->y() * it->x();
w += it->x();
for (int i = 0; i < _avg.size(); i++) {
const QPointF &p = _avg.at(i);
sum += p.y() * p.x();
w += p.x();
}
return (sum / w);

View File

@ -23,7 +23,7 @@ private:
void setYUnits(Units units);
void setInfo();
QList<QPointF> _avg;
QVector<QPointF> _avg;
bool _showTracks;
};