Add temperature to AllPlot

Fixes #536.
This commit is contained in:
Damien Grauser
2011-12-07 21:55:35 +00:00
committed by Mark Liversedge
parent 9f25fdc6f8
commit 8d3d89d44d
24 changed files with 143 additions and 41 deletions

View File

@@ -206,6 +206,7 @@ AllPlot::AllPlot(AllPlotWindow *parent, MainWindow *mainWindow):
showSpeedState(Qt::Checked),
showCadState(Qt::Checked),
showAltState(Qt::Checked),
showTempState(Qt::Checked),
bydist(false),
parent(parent)
{
@@ -246,6 +247,9 @@ AllPlot::AllPlot(AllPlotWindow *parent, MainWindow *mainWindow):
// altCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
altCurve->setYAxis(yRight2);
tempCurve = new QwtPlotCurve(tr("Temperature"));
tempCurve->setYAxis(yRight);
intervalHighlighterCurve = new QwtPlotCurve();
intervalHighlighterCurve->setYAxis(yLeft);
intervalHighlighterCurve->setData(IntervalPlotData(this, mainWindow));
@@ -281,6 +285,7 @@ AllPlot::configChanged()
speedCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
cadCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
altCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
tempCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
intervalHighlighterCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
}
@@ -303,6 +308,20 @@ AllPlot::configChanged()
QColor brush_color = GColor(CALTITUDEBRUSH);
brush_color.setAlpha(200);
altCurve->setBrush(brush_color); // fill below the line
QPen tempPen = QPen(GColor(CTEMP));
tempPen.setStyle(Qt::DotLine);
tempPen.setWidth(width);
//tempCurve->setPen(tempPen);
QwtSymbol sym;
sym.setStyle(QwtSymbol::Ellipse);
sym.setSize(width*10);
sym.setPen(QPen(GColor(CTEMP)));
sym.setBrush(QBrush(GColor(CTEMP)));
tempCurve->setPen(tempPen); //Qt::NoPen
tempCurve->setStyle(QwtPlotCurve::Dots);
tempCurve->setSymbol(sym);
QPen ihlPen = QPen(GColor(CINTERVALHIGHLIGHTER));
ihlPen.setWidth(width);
intervalHighlighterCurve->setPen(ihlPen);
@@ -377,9 +396,9 @@ AllPlot::configChanged()
}
struct DataPoint {
double time, hr, watts, speed, cad, alt;
DataPoint(double t, double h, double w, double s, double c, double a) :
time(t), hr(h), watts(w), speed(s), cad(c), alt(a) {}
double time, hr, watts, speed, cad, alt, temp;
DataPoint(double t, double h, double w, double s, double c, double a, double te) :
time(t), hr(h), watts(w), speed(s), cad(c), alt(a), temp(te) {}
};
bool AllPlot::shadeZones() const
@@ -449,6 +468,8 @@ AllPlot::recalc()
cadCurve->setData(data, data);
if (!altArray.empty())
altCurve->setData(data, data);
if (!tempArray.empty())
tempCurve->setData(data, data);
return;
}
// we should only smooth the curves if smoothed rate is greater than sample rate
@@ -460,6 +481,7 @@ AllPlot::recalc()
double totalCad = 0.0;
double totalDist = 0.0;
double totalAlt = 0.0;
double totalTemp = 0.0;
QList<DataPoint> list;
@@ -470,6 +492,7 @@ AllPlot::recalc()
smoothTime.resize(rideTimeSecs + 1);
smoothDistance.resize(rideTimeSecs + 1);
smoothAltitude.resize(rideTimeSecs + 1);
smoothTemp.resize(rideTimeSecs + 1);
for (int secs = 0; ((secs < smooth)
&& (secs < rideTimeSecs)); ++secs) {
@@ -480,6 +503,7 @@ AllPlot::recalc()
smoothTime[secs] = secs / 60.0;
smoothDistance[secs] = 0.0;
smoothAltitude[secs] = 0.0;
smoothTemp[secs] = 0.0;
}
int i = 0;
@@ -490,7 +514,8 @@ AllPlot::recalc()
(!wattsArray.empty() ? wattsArray[i] : 0),
(!speedArray.empty() ? speedArray[i] : 0),
(!cadArray.empty() ? cadArray[i] : 0),
(!altArray.empty() ? altArray[i] : 0));
(!altArray.empty() ? altArray[i] : 0),
(!tempArray.empty() ? tempArray[i] : 0));
if (!wattsArray.empty())
totalWatts += wattsArray[i];
if (!hrArray.empty())
@@ -501,6 +526,8 @@ AllPlot::recalc()
totalCad += cadArray[i];
if (!altArray.empty())
totalAlt += altArray[i];
if (!tempArray.empty())
totalTemp += tempArray[i];
totalDist = distanceArray[i];
list.append(dp);
++i;
@@ -512,6 +539,7 @@ AllPlot::recalc()
totalSpeed -= dp.speed;
totalCad -= dp.cad;
totalAlt -= dp.alt;
totalTemp -= dp.temp;
list.removeFirst();
}
// TODO: this is wrong. We should do a weighted average over the
@@ -522,6 +550,7 @@ AllPlot::recalc()
smoothSpeed[secs] = 0.0;
smoothCad[secs] = 0.0;
smoothAltitude[secs] = smoothAltitude[secs - 1];
smoothTemp[secs] = 0.0;
}
else {
smoothWatts[secs] = totalWatts / list.size();
@@ -529,6 +558,7 @@ AllPlot::recalc()
smoothSpeed[secs] = totalSpeed / list.size();
smoothCad[secs] = totalCad / list.size();
smoothAltitude[secs] = totalAlt / list.size();
smoothTemp[secs] = totalTemp / list.size();
}
smoothDistance[secs] = totalDist;
smoothTime[secs] = secs / 60.0;
@@ -544,6 +574,7 @@ AllPlot::recalc()
smoothTime.resize(0);
smoothDistance.resize(0);
smoothAltitude.resize(0);
smoothTemp.resize(0);
foreach (RideFilePoint *dp, rideItem->ride()->dataPoints()) {
smoothWatts.append(dp->watts);
@@ -553,7 +584,7 @@ AllPlot::recalc()
smoothTime.append(dp->secs/60);
smoothDistance.append(useMetricUnits ? dp->km : dp->km * MILES_PER_KM);
smoothAltitude.append(useMetricUnits ? dp->alt : dp->alt * FEET_PER_METER);
smoothTemp.append(dp->temp);
}
}
@@ -587,6 +618,11 @@ AllPlot::recalc()
altCurve->setData(xaxis.data() + startingIndex, smoothAltitude.data() + startingIndex, totalPoints);
intervalHighlighterCurve->setYAxis(yRight2);
} if (!tempArray.empty()) {
tempCurve->setData(xaxis.data() + startingIndex, smoothTemp.data() + startingIndex, totalPoints);
intervalHighlighterCurve->setYAxis(yRight);
}
setYMax();
@@ -672,12 +708,28 @@ AllPlot::setYMax()
setAxisLabelRotation(yLeft2,270);
setAxisLabelAlignment(yLeft2,Qt::AlignVCenter);
}
if (speedCurve->isVisible()) {
setAxisTitle(yRight, (useMetricUnits ? tr("KPH") : tr("MPH")));
if (referencePlot == NULL)
setAxisScale(yRight, 0.0, 1.05 * speedCurve->maxYValue());
else
setAxisScale(yRight, 0.0, 1.05 * referencePlot->speedCurve->maxYValue());
if (speedCurve->isVisible() || tempCurve->isVisible()) {
double ymax = 0;
QStringList labels;
if (speedCurve->isVisible()) {
labels << (useMetricUnits ? tr("KPH") : tr("MPH"));
if (referencePlot == NULL)
ymax = speedCurve->maxYValue();
else
ymax = referencePlot->speedCurve->maxYValue();
}
if (tempCurve->isVisible()) {
labels << QString::fromUtf8("°C");
if (referencePlot == NULL)
ymax = qMax(ymax, tempCurve->maxYValue());
else
ymax = qMax(ymax, referencePlot->tempCurve->maxYValue());
}
setAxisTitle(yRight, labels.join(" / "));
setAxisScale(yRight, 0.0, 1.05 * ymax);
setAxisLabelRotation(yRight,90);
setAxisLabelAlignment(yRight,Qt::AlignVCenter);
}
@@ -750,6 +802,7 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
double *smoothC = &plot->smoothCad[startidx];
double *smoothA = &plot->smoothAltitude[startidx];
double *smoothD = &plot->smoothDistance[startidx];
double *smoothTE = &plot->smoothTemp[startidx];
double *xaxis = bydist ? smoothD : smoothT;
@@ -761,18 +814,21 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
speedCurve->detach();
cadCurve->detach();
altCurve->detach();
tempCurve->detach();
wattsCurve->setVisible(rideItem->ride()->areDataPresent()->watts && showPowerState < 2);
hrCurve->setVisible(rideItem->ride()->areDataPresent()->hr && showHrState == Qt::Checked);
speedCurve->setVisible(rideItem->ride()->areDataPresent()->kph && showSpeedState == Qt::Checked);
cadCurve->setVisible(rideItem->ride()->areDataPresent()->cad && showCadState == Qt::Checked);
altCurve->setVisible(rideItem->ride()->areDataPresent()->alt && showAltState == Qt::Checked);
tempCurve->setVisible(rideItem->ride()->areDataPresent()->temp && showTempState == Qt::Checked);
wattsCurve->setData(xaxis,smoothW,stopidx-startidx);
hrCurve->setData(xaxis, smoothHR,stopidx-startidx);
speedCurve->setData(xaxis, smoothS, stopidx-startidx);
cadCurve->setData(xaxis, smoothC, stopidx-startidx);
altCurve->setData(xaxis, smoothA, stopidx-startidx);
tempCurve->setData(xaxis, smoothTE, stopidx-startidx);
QwtSymbol sym;
sym.setPen(QPen(GColor(CPLOTMARKER)));
@@ -788,6 +844,7 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
speedCurve->setSymbol(sym);
cadCurve->setSymbol(sym);
altCurve->setSymbol(sym);
tempCurve->setSymbol(sym);
setYMax();
@@ -813,6 +870,10 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
cadCurve->attach(this);
intervalHighlighterCurve->setYAxis(yLeft2);
}
if (!plot->smoothTemp.empty()) {
tempCurve->attach(this);
intervalHighlighterCurve->setYAxis(yRight);
}
refreshIntervalMarkers();
refreshZoneLabels();
@@ -970,6 +1031,16 @@ AllPlot::showAlt(int state)
replot();
}
void
AllPlot::showTemp(int state)
{
showTempState = state;
assert(state != Qt::PartiallyChecked);
tempCurve->setVisible(state == Qt::Checked);
setYMax();
replot();
}
void
AllPlot::showGrid(int state)
{

View File

@@ -74,6 +74,7 @@ class AllPlot : public QwtPlot
void showSpeed(int state);
void showCad(int state);
void showAlt(int state);
void showTemp(int state);
void showGrid(int state);
void setPaintBrush(int state);
void setShadeZones(bool x) { shade_zones=x; }
@@ -105,6 +106,7 @@ class AllPlot : public QwtPlot
int showSpeedState;
int showCadState;
int showAltState;
int showTempState;
// plot objects
QwtPlotGrid *grid;
@@ -116,6 +118,7 @@ class AllPlot : public QwtPlot
QwtPlotCurve *speedCurve;
QwtPlotCurve *cadCurve;
QwtPlotCurve *altCurve;
QwtPlotCurve *tempCurve;
QwtPlotCurve *intervalHighlighterCurve; // highlight selected intervals on the Plot
QList <AllPlotZoneLabel *> zoneLabels;
@@ -127,6 +130,7 @@ class AllPlot : public QwtPlot
QVector<double> timeArray;
QVector<double> distanceArray;
QVector<double> altArray;
QVector<double> tempArray;
// smoothed data
QVector<double> smoothWatts;
@@ -136,6 +140,7 @@ class AllPlot : public QwtPlot
QVector<double> smoothTime;
QVector<double> smoothDistance;
QVector<double> smoothAltitude;
QVector<double> smoothTemp;
// array / smooth state
int arrayLength;

View File

@@ -111,6 +111,10 @@ AllPlotWindow::AllPlotWindow(MainWindow *mainWindow) :
showAlt->setCheckState(Qt::Checked);
cl->addWidget(showAlt);
showTemp = new QCheckBox(tr("Temperature"), this);
showTemp->setCheckState(Qt::Checked);
cl->addWidget(showTemp);
showPower = new QComboBox();
showPower->addItem(tr("Power + shade"));
showPower->addItem(tr("Power - shade"));
@@ -332,6 +336,7 @@ AllPlotWindow::AllPlotWindow(MainWindow *mainWindow) :
connect(showSpeed, SIGNAL(stateChanged(int)), this, SLOT(setShowSpeed(int)));
connect(showCad, SIGNAL(stateChanged(int)), this, SLOT(setShowCad(int)));
connect(showAlt, SIGNAL(stateChanged(int)), this, SLOT(setShowAlt(int)));
connect(showTemp, SIGNAL(stateChanged(int)), this, SLOT(setShowTemp(int)));
connect(showGrid, SIGNAL(stateChanged(int)), this, SLOT(setShowGrid(int)));
connect(showFull, SIGNAL(stateChanged(int)), this, SLOT(setShowFull(int)));
connect(showStack, SIGNAL(stateChanged(int)), this, SLOT(showStackChanged(int)));
@@ -690,6 +695,7 @@ AllPlotWindow::setAllPlotWidgets(RideItem *ride)
showSpeed->setEnabled(dataPresent->kph);
showCad->setEnabled(dataPresent->cad);
showAlt->setEnabled(dataPresent->alt);
showTemp->setEnabled(dataPresent->temp);
} else {
showPower->setEnabled(false);
@@ -697,6 +703,7 @@ AllPlotWindow::setAllPlotWidgets(RideItem *ride)
showSpeed->setEnabled(false);
showCad->setEnabled(false);
showAlt->setEnabled(false);
showTemp->setEnabled(false);
}
// turn on/off shading, if it's not available
@@ -1120,6 +1127,18 @@ AllPlotWindow::setShowAlt(int value)
plot->showAlt(value);
}
void
AllPlotWindow::setShowTemp(int value)
{
showTemp->setChecked(value);
//if (!current) return;
allPlot->showTemp(value);
foreach (AllPlot *plot, allPlots)
plot->showTemp(value);
}
void
AllPlotWindow::setShowFull(int value)
{
@@ -1422,6 +1441,7 @@ AllPlotWindow::setupStackPlots()
_allPlot->showSpeed(showSpeed->checkState());
_allPlot->showCad(showCad->checkState());
_allPlot->showAlt(showAlt->checkState());
_allPlot->showTemp(showTemp->checkState());
_allPlot->showGrid(showGrid->checkState());
_allPlot->setPaintBrush(paintBrush->checkState());
_allPlot->setSmoothing(smoothSlider->value());

View File

@@ -104,6 +104,7 @@ class AllPlotWindow : public GcWindow
void setShowSpeed(int state);
void setShowCad(int state);
void setShowAlt(int state);
void setShowTemp(int state);
void setShowGrid(int state);
void setPaintBrush(int state);
void setShowFull(int state);
@@ -160,6 +161,7 @@ class AllPlotWindow : public GcWindow
QCheckBox *showSpeed;
QCheckBox *showCad;
QCheckBox *showAlt;
QCheckBox *showTemp;
QComboBox *showPower;
QComboBox *comboDistance;
QSlider *smoothSlider;

View File

@@ -23,7 +23,7 @@
#include <QDir>
#include "Settings.h"
static Colors ColorList[60], DefaultColorList[60];
static Colors ColorList[61], DefaultColorList[61];
static void copyArray(Colors source[], Colors target[])
{
@@ -35,7 +35,7 @@ static bool setupColors()
{
// consider removing when we can guarantee extended initialisation support in gcc
// (c++0x not supported by Qt currently and not planned for 4.8 or 5.0)
Colors init[60] = {
Colors init[61] = {
{ "Plot Background", "COLORPLOTBACKGROUND", Qt::white },
{ "Ride Plot Background", "COLORRIDEPLOTBACKGROUND", Qt::black },
{ "Plot Thumbnail Background", "COLORPLOTTHUMBNAIL", Qt::gray },
@@ -95,6 +95,7 @@ static bool setupColors()
{ "Activity History Group", "CRIDEGROUP", QColor(236,246,255) },
{ "SpinScan Left", "CSPINSCANLEFT", Qt::gray },
{ "SpinScan Right", "CSPINSCANRIGHT", Qt::cyan },
{ "Temperature", "COLORTEMPERATURE", Qt::yellow },
{ "", "", QColor(0,0,0) },
};

View File

@@ -134,5 +134,6 @@ class ColorEngine : public QObject
#define CRIDEGROUP 56
#define CSPINSCANLEFT 57
#define CSPINSCANRIGHT 58
#define CTEMP 59
#endif

View File

@@ -238,7 +238,7 @@ RideFile *Computrainer3dpFileReader::openRideFile(QFile & file,
// special case first data point
rideFile->appendPoint((double) ms/1000, (double) cad,
(double) hr, km, speed, 0.0, watts,
altitude, 0, 0, 0.0, 0.0, 0.0, 0);
altitude, 0, 0, 0.0, 0.0, RideFile::noTemp, 0);
}
// while loop since an interval in the .3dp file might
// span more than one CT_EMIT_MS interval

View File

@@ -250,7 +250,7 @@ RideFile *CsvFileReader::openRideFile(QFile &file, QStringList &errors, QList<Ri
watts = 0;
rideFile->appendPoint(minutes * 60.0, cad, hr, km,
kph, nm, watts, alt, lon, lat, headwind, 0.0, 0.0, interval);
kph, nm, watts, alt, lon, lat, headwind, 0.0, RideFile::noTemp, interval);
}
++lineno;
}

View File

@@ -99,7 +99,7 @@ FitlogParser::startElement( const QString&, const QString&,
// now add
rideFile->appendPoint(point.secs,point.cad,point.hr,point.km,point.kph,point.nm,
point.watts,point.alt,point.lon,point.lat, point.headwind,
0.0, 0.0, point.interval);
0.0, RideFile::noTemp, point.interval);
}
return TRUE;
}

View File

@@ -147,7 +147,7 @@ FitlogFileReader::writeRideFile(MainWindow *mainWindow, const RideFile *ride, QF
if (p->secs >= interval.stop)
break;
f.appendPoint(p->secs, p->cad, p->hr, p->km, p->kph, p->nm,
p->watts, p->alt, p->lon, p->lat, p->headwind, 0.0, 0.0, 0);
p->watts, p->alt, p->lon, p->lat, p->headwind, 0.0, RideFile::noTemp, 0);
}
if (f.dataPoints().size() == 0) {
// Interval empty, do not compute any metrics

View File

@@ -146,7 +146,7 @@ GcFileReader::openRideFile(QFile &file, QStringList &errors, QList<RideFile*>*)
lat = sample.attribute("lat", "0.0").toDouble();
while ((interval < intervalStops.size()) && (secs >= intervalStops[interval]))
++interval;
rideFile->appendPoint(secs, cad, hr, km, kph, nm, watts, alt, lon, lat, headwind, 0.0, 0.0, interval);
rideFile->appendPoint(secs, cad, hr, km, kph, nm, watts, alt, lon, lat, headwind, 0.0, RideFile::noTemp, interval);
if (!recIntSet) {
rideFile->setRecIntSecs(sample.attribute("len").toDouble());
recIntSet = true;

View File

@@ -171,7 +171,7 @@ bool
if(rideFile->dataPoints().empty()) {
// first point
rideFile->appendPoint(secs, 0, 0, distance, speed, 0, 0, alt, lon, lat, 0, 0.0, 0.0, 0);
rideFile->appendPoint(secs, 0, 0, distance, speed, 0, 0, alt, lon, lat, 0, 0.0, RideFile::noTemp, 0);
}
else {
// assumption that the change in ride is linear... :)
@@ -186,7 +186,7 @@ bool
// Smart Recording High Water Mark.
if ((isGarminSmartRecording.toInt() == 0) || (deltaSecs == 1) || (deltaSecs >= GarminHWM.toInt())) {
// no smart recording, or delta exceeds HW treshold, just insert the data
rideFile->appendPoint(secs, 0, 0, distance, speed, 0,0, alt, lon, lat, 0, 0.0, 0.0, 0);
rideFile->appendPoint(secs, 0, 0, distance, speed, 0,0, alt, lon, lat, 0, 0.0, RideFile::noTemp, 0);
}
else {
// smart recording is on and delta is less than GarminHWM seconds.
@@ -208,9 +208,9 @@ bool
prevPoint->alt + (deltaAlt * weight),
lon, // lon
lat, // lat
0,
0.0,
0.0,
0,
0.0,
RideFile::noTemp,
0);
}
prevPoint = rideFile->dataPoints().back();

View File

@@ -125,7 +125,7 @@ RideFile *ManualFileReader::openRideFile(QFile &file, QStringList &errors, QList
interval = 0;
rideFile->appendPoint(minutes * 60.0, cad, hr, km,
kph, nm, watts, alt, 0.0, 0.0, 0.0, 0.0, 0.0, interval);
kph, nm, watts, alt, 0.0, 0.0, 0.0, 0.0, RideFile::noTemp, interval);
QMap<QString,QString> bsm;
bsm.insert("value", QString("%1").arg(bs));
rideFile->metricOverrides.insert("skiba_bike_score", bsm);

View File

@@ -216,7 +216,7 @@ this differently
alt *= METERS_PER_FOOT;
}
rideFile->appendPoint(seconds, cad, hr, km, kph, nm, watts, alt, 0.0, 0.0, 0.0, 0.0, 0.0, interval);
rideFile->appendPoint(seconds, cad, hr, km, kph, nm, watts, alt, 0.0, 0.0, 0.0, 0.0, RideFile::noTemp, interval);
//fprintf(stderr, " %f, %f, %f, %f, %f, %f, %f, %d\n", seconds, cad, hr, km, kph, nm, watts, alt, interval);
}

View File

@@ -52,7 +52,7 @@ QuarqParser::incrementTime( const double new_time )
while (time_diff > seconds_from_start) {
rideFile->appendPoint(seconds_from_start, cad, hr, km,
kph, nm, watts, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
kph, nm, watts, 0, 0.0, 0.0, 0.0, 0.0, RideFile::noTemp, 0);
seconds_from_start += SAMPLE_INTERVAL;
}
@@ -114,7 +114,7 @@ QuarqParser::endElement( const QString&, const QString&, const QString& qName)
// flush one last data point
if (qName == "Qollector") {
rideFile->appendPoint(seconds_from_start, cad, hr, km,
kph, nm, watts, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0);
kph, nm, watts, 0, 0.0, 0.0, 0.0, 0.0, RideFile::noTemp, 0);
}
return TRUE;

View File

@@ -70,7 +70,7 @@ time_cb(struct tm *, time_t since_epoch, void *context)
double secs = since_epoch - state->start_since_epoch;
state->rideFile->appendPoint(secs, 0.0, 0.0,
state->last_miles * KM_PER_MILE, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, state->last_interval);
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, RideFile::noTemp, state->last_interval);
state->last_secs = secs;
}
@@ -84,7 +84,7 @@ data_cb(double secs, double nm, double mph, double watts, double miles, double a
ReadState *state = (ReadState*) context;
state->rideFile->appendPoint(secs, cad, hr, miles * KM_PER_MILE,
mph * KM_PER_MILE, nm, watts, alt, 0.0, 0.0, 0.0, 0.0, 0.0, interval);
mph * KM_PER_MILE, nm, watts, alt, 0.0, 0.0, 0.0, 0.0, RideFile::noTemp, interval);
state->last_secs = secs;
state->last_miles = miles;
state->last_interval = interval;

View File

@@ -398,7 +398,7 @@ void RideFile::appendPoint(double secs, double cad, double hr, double km,
dataPresent.lat |= (lat != 0);
dataPresent.headwind |= (headwind != 0);
dataPresent.slope |= (slope != 0);
dataPresent.temp |= (temp != 0);
dataPresent.temp |= (temp != noTemp);
dataPresent.interval |= (interval != 0);
}

View File

@@ -199,7 +199,7 @@ struct RideFilePoint
double secs, cad, hr, km, kph, nm, watts, alt, lon, lat, headwind, slope, temp;
int interval;
RideFilePoint() : secs(0.0), cad(0.0), hr(0.0), km(0.0), kph(0.0),
nm(0.0), watts(0.0), alt(0.0), lon(0.0), lat(0.0), headwind(0.0), slope(0.0), temp(0.0), interval(0) {}
nm(0.0), watts(0.0), alt(0.0), lon(0.0), lat(0.0), headwind(0.0), slope(0.0), temp(-255.0), interval(0) {}
RideFilePoint(double secs, double cad, double hr, double km, double kph,
double nm, double watts, double alt, double lon, double lat,
double headwind, double slope, double temp, int interval) :

View File

@@ -149,7 +149,7 @@ SlfParser::endElement( const QString&, const QString&, const QString& qName)
distance *= KM_PER_MILE;
alt *= FEET_PER_METER;
}
rideFile->appendPoint(secs, cadence, hr, distance, speed, torque, power, alt, lon, lat, headwind, 0.0, 0.0, lap);
rideFile->appendPoint(secs, cadence, hr, distance, speed, torque, power, alt, lon, lat, headwind, 0.0, RideFile::noTemp, lap);
secs += samplingRate;
}
}

View File

@@ -91,7 +91,7 @@ RideFile *SrdFileReader::openRideFile(QFile &file, QStringList &errorStrings, QL
km = w->dist_data[i];
// add to ride
result->appendPoint(time, cad, hr, km, kph, nm, watts, alt, lon, lat, wind, 0.0, 0.0, 0);
result->appendPoint(time, cad, hr, km, kph, nm, watts, alt, lon, lat, wind, 0.0, RideFile::noTemp, 0);
// keep a track of time
time += w->recording_interval;

View File

@@ -203,7 +203,7 @@ bool readRideData(RideFile *rideFile, const QByteArray& block, const int nrOfRec
nextDataPoint.kph, nextDataPoint.nm,
nextDataPoint.watts, nextDataPoint.alt,
nextDataPoint.lon, nextDataPoint.lat,
nextDataPoint.headwind, 0.0, 0.0, nextDataPoint.interval);
nextDataPoint.headwind, 0.0, RideFile::noTemp, nextDataPoint.interval);
}
return true;
}

View File

@@ -162,7 +162,7 @@ TcxParser::endElement( const QString&, const QString&, const QString& qName)
if(rideFile->dataPoints().empty()) {
// first point
rideFile->appendPoint(secs, cadence, hr, distance,
speed, torque, power, alt, lon, lat, headwind, 0.0, 0.0, lap);
speed, torque, power, alt, lon, lat, headwind, 0.0, RideFile::noTemp, lap);
}
else {
// assumption that the change in ride is linear... :)
@@ -182,7 +182,7 @@ TcxParser::endElement( const QString&, const QString&, const QString& qName)
if ((isGarminSmartRecording.toInt() == 0) || (deltaSecs == 1) || (deltaSecs >= GarminHWM.toInt())) {
// no smart recording, or delta exceeds HW treshold, just insert the data
rideFile->appendPoint(secs, cadence, hr, distance,
speed, torque, power, alt, lon, lat, headwind, 0.0, 0.0, lap);
speed, torque, power, alt, lon, lat, headwind, 0.0, RideFile::noTemp, lap);
}
else {
// smart recording is on and delta is less than GarminHWM seconds.
@@ -208,7 +208,7 @@ TcxParser::endElement( const QString&, const QString&, const QString& qName)
lat, // lat
headwind, // headwind
0.0,
0.0,
RideFile::noTemp,
lap);
}
prevPoint = rideFile->dataPoints().back();

View File

@@ -156,7 +156,7 @@ RideFile *TxtFileReader::openRideFile(QFile &file, QStringList &errors, QList<Ri
double km = kmIndex > -1 ? values[kmIndex].toDouble() : 0.0;
double kph = kphIndex > -1 ? values[kphIndex].toDouble() : 0.0;
double headwind = headwindIndex > -1 ? values[headwindIndex].toDouble() : 0.0;
rideFile->appendPoint(secs, cad, hr, km, kph, 0.0, watts, 0.0, 0.0, 0.0, headwind, 0.0, 0.0, 0);
rideFile->appendPoint(secs, cad, hr, km, kph, 0.0, watts, 0.0, 0.0, 0.0, headwind, 0.0, RideFile::noTemp, 0);
}
}

View File

@@ -211,7 +211,7 @@ WKO_UCHAR *
WkoParser::parseRawData(WKO_UCHAR *fb)
{
WKO_ULONG WKO_xormasks[32]; // xormasks used all over
double cad=0, hr=0, km=0, kph=0, nm=0, watts=0, slope=0, alt=0, lon=0, lat=0, wind=0, interval=0;
double cad=0, hr=0, km=0, kph=0, nm=0, watts=0, slope=0, alt=0, lon=0, lat=0, wind=0, temp=RideFile::noTemp, interval=0;
int isnull=0;
WKO_ULONG records, data;
@@ -312,6 +312,7 @@ WkoParser::parseRawData(WKO_UCHAR *fb)
// reset point values;
alt = slope = wind = cad= hr= km= kph= nm= watts= 0.0;
temp= RideFile::noTemp;
marker = get_bits(thelot, bit++, 1);
@@ -345,7 +346,8 @@ WkoParser::parseRawData(WKO_UCHAR *fb)
} else {
sval = val;
}
svalp = sval;
svalp = sval;
temp = sval;
sprintf(GRAPHDATA[i], "%8ld", svalp);
break;
case '^' : /* Slope */
@@ -490,7 +492,7 @@ WkoParser::parseRawData(WKO_UCHAR *fb)
if (!isnull) {
// !! needs to be modified to support the new alt patch
results->appendPoint((double)rtime/1000, cad, hr, km,
kph, nm, watts, alt, lon, lat, wind, slope, 0.0, 0);
kph, nm, watts, alt, lon, lat, wind, slope, temp, 0);
}
// increment time - even for null records (perhaps especially for null