mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-16 09:29:55 +00:00
Train: Add lap handling to qwkcode
This commit is contained in:
@@ -685,6 +685,9 @@ ErgFile::save(QStringList &errors)
|
||||
out << "[COURSE DATA]\n";
|
||||
|
||||
bool first=true;
|
||||
long lastLap = 0;
|
||||
double lastPointX = 0;
|
||||
|
||||
foreach(ErgFilePoint p, Points) {
|
||||
|
||||
// output
|
||||
@@ -694,6 +697,22 @@ ErgFile::save(QStringList &errors)
|
||||
// we scale back if needed
|
||||
if (Ftp && CP) watts = (double(p.y)/CP) * Ftp;
|
||||
|
||||
// check if a lap marker should be inserted
|
||||
foreach(ErgFileLap l, Laps) {
|
||||
bool addLap = false;
|
||||
if (l.x == p.x && lastLap != l.x) {
|
||||
// this is the case where a lap marker matches a load marker
|
||||
addLap = true;
|
||||
} else if (l.x > lastPointX && l.x < p.x) {
|
||||
// this is the case when a lap marker exist between two load markers
|
||||
addLap = true;
|
||||
}
|
||||
if (addLap) {
|
||||
out <<QString("%1 LAP\n").arg(minutes, 0, 'f', 2);
|
||||
lastLap = l.x;
|
||||
}
|
||||
}
|
||||
|
||||
if (first) {
|
||||
first=false;
|
||||
|
||||
@@ -705,6 +724,8 @@ ErgFile::save(QStringList &errors)
|
||||
|
||||
// output in minutes and watts
|
||||
out <<QString("%1 %2\n").arg(minutes, 0, 'f', 2).arg(watts);
|
||||
|
||||
lastPointX = p.x;
|
||||
}
|
||||
|
||||
out << "[END COURSE DATA]\n";
|
||||
|
||||
Reference in New Issue
Block a user