1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 19:55:53 +01:00

Fixed broken parsing of TCX files with heart rate data

This commit is contained in:
Martin Tůma 2017-09-14 20:18:34 +02:00
parent 89947851fd
commit b457fc430c
2 changed files with 12 additions and 1 deletions

View File

@ -56,6 +56,16 @@ Coordinates TCXParser::position()
return pos; return pos;
} }
void TCXParser::heartRateBpm(Trackpoint &trackpoint)
{
while (_reader.readNextStartElement()) {
if (_reader.name() == "Value")
trackpoint.setHeartRate(number());
else
_reader.skipCurrentElement();
}
}
void TCXParser::extensions(Trackpoint &trackpoint) void TCXParser::extensions(Trackpoint &trackpoint)
{ {
while (_reader.readNextStartElement()) { while (_reader.readNextStartElement()) {
@ -78,7 +88,7 @@ void TCXParser::trackpointData(Trackpoint &trackpoint)
else if (_reader.name() == "Time") else if (_reader.name() == "Time")
trackpoint.setTimestamp(time()); trackpoint.setTimestamp(time());
else if (_reader.name() == "HeartRateBpm") else if (_reader.name() == "HeartRateBpm")
trackpoint.setHeartRate(number()); heartRateBpm(trackpoint);
else if (_reader.name() == "Cadence") else if (_reader.name() == "Cadence")
trackpoint.setCadence(number()); trackpoint.setCadence(number());
else if (_reader.name() == "Extensions") else if (_reader.name() == "Extensions")

View File

@ -26,6 +26,7 @@ private:
void trackpointData(Trackpoint &trackpoint); void trackpointData(Trackpoint &trackpoint);
void waypointData(Waypoint &waypoint); void waypointData(Waypoint &waypoint);
void extensions(Trackpoint &trackpoint); void extensions(Trackpoint &trackpoint);
void heartRateBpm(Trackpoint &trackpoint);
Coordinates position(); Coordinates position();
qreal number(); qreal number();
QDateTime time(); QDateTime time();