175
// data points: offset, hr, spd, pwr, torq, cad, dist, lat, lon, alt (ignored: temp, time)
174
// data points: offset, hr, spd, pwr, torq, cad, dist, lat, lon, alt, temp
176
175
} else if (node.nodeName() == "sample") {
177
176
RideFilePoint add;
394
397
QDomElement summarydata = doc.createElement("summarydata");
395
398
root.appendChild(summarydata);
396
399
QDomElement beginning = doc.createElement("beginning");
397
text = doc.createTextNode(QString("%1").arg(ride->dataPoints().first()->secs));
400
text = doc.createTextNode(QString("%1").arg(ride->dataPoints().empty()
401
? 0 : ride->dataPoints().first()->secs));
398
402
beginning.appendChild(text);
399
403
summarydata.appendChild(beginning);
401
405
QDomElement duration = doc.createElement("duration");
402
text = doc.createTextNode(QString("%1").arg(ride->dataPoints().last()->secs));
406
text = doc.createTextNode(QString("%1").arg(ride->dataPoints().empty()
407
? 0 : ride->dataPoints().last()->secs));
403
408
duration.appendChild(text);
404
409
summarydata.appendChild(duration);
453
460
summarydata.appendChild(s);
463
if (ride->areDataPresent()->temp) {
464
QDomElement s = doc.createElement("temp");
465
s.setAttribute("max", "0");
466
s.setAttribute("min", "0");
467
s.setAttribute("avg", "0");
468
summarydata.appendChild(s);
456
471
// interval "segments"
457
if (!ride->intervals().empty()) {
458
foreach (RideFileInterval i, ride->intervals()) {
459
QDomElement segment = doc.createElement("segment");
460
root.appendChild(segment);
463
QDomElement name = doc.createElement("name");
464
text = doc.createTextNode(i.name); name.appendChild(text);
465
segment.appendChild(name);
468
QDomElement summarydata = doc.createElement("summarydata");
469
segment.appendChild(summarydata);
472
QDomElement beginning = doc.createElement("beginning");
473
text = doc.createTextNode(QString("%1").arg(i.start));
474
beginning.appendChild(text);
475
summarydata.appendChild(beginning);
478
QDomElement duration = doc.createElement("duration");
479
text = doc.createTextNode(QString("%1").arg(i.stop - i.start));
480
duration.appendChild(text);
481
summarydata.appendChild(duration);
472
foreach (RideFileInterval i, ride->intervals()) {
473
QDomElement segment = doc.createElement("segment");
474
root.appendChild(segment);
477
QDomElement name = doc.createElement("name");
478
text = doc.createTextNode(i.name); name.appendChild(text);
479
segment.appendChild(name);
482
QDomElement summarydata = doc.createElement("summarydata");
483
segment.appendChild(summarydata);
486
QDomElement beginning = doc.createElement("beginning");
487
text = doc.createTextNode(QString("%1").arg(i.start));
488
beginning.appendChild(text);
489
summarydata.appendChild(beginning);
492
QDomElement duration = doc.createElement("duration");
493
text = doc.createTextNode(QString("%1").arg(i.stop - i.start));
494
duration.appendChild(text);
495
summarydata.appendChild(duration);
486
499
// data points: timeoffset, dist, hr, spd, pwr, torq, cad, lat, lon, alt
487
500
if (!ride->dataPoints().empty()) {
488
503
foreach (const RideFilePoint *point, ride->dataPoints()) {
504
// if there was a gap, log time when this sample started:
505
if( secs + ride->recIntSecs() < point->secs ){
506
QDomElement sample = doc.createElement("sample");
507
root.appendChild(sample);
509
QDomElement timeoffset = doc.createElement("timeoffset");
510
text = doc.createTextNode(QString("%1")
511
.arg(point->secs - ride->recIntSecs() ));
512
timeoffset.appendChild(text);
513
sample.appendChild(timeoffset);
489
516
QDomElement sample = doc.createElement("sample");
490
517
root.appendChild(sample);
493
520
QDomElement timeoffset = doc.createElement("timeoffset");
494
text = doc.createTextNode(QString("%1").arg((int)point->secs));
521
text = doc.createTextNode(QString("%1").arg(point->secs));
495
522
timeoffset.appendChild(text);
496
523
sample.appendChild(timeoffset);