mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 19:52:09 +01:00
Some more code cleanup
This commit is contained in:
parent
f9b4cd991f
commit
4a82055867
@ -13,7 +13,7 @@ QDebug operator<<(QDebug dbg, const SMLParser::Sensors &sensors)
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
|
||||
void SMLParser::sample(SegmentData &segment, QMap<QDateTime, Sensors> &map)
|
||||
void SMLParser::sample(SegmentData &segment, SensorsMap &map)
|
||||
{
|
||||
QDateTime timestamp;
|
||||
Sensors sensors;
|
||||
@ -97,19 +97,20 @@ void SMLParser::sample(SegmentData &segment, QMap<QDateTime, Sensors> &map)
|
||||
|
||||
void SMLParser::samples(SegmentData &segment)
|
||||
{
|
||||
QMap<QDateTime, Sensors> sensors;
|
||||
QMap<QDateTime, Sensors>::const_iterator it;
|
||||
SensorsMap map;
|
||||
|
||||
while (_reader.readNextStartElement()) {
|
||||
if (_reader.name() == QLatin1String("Sample")) {
|
||||
sample(segment, sensors);
|
||||
sample(segment, map);
|
||||
} else
|
||||
_reader.skipCurrentElement();
|
||||
}
|
||||
|
||||
for (int i = 0; i < segment.size(); i++) {
|
||||
Trackpoint &t = segment[i];
|
||||
if ((it = sensors.lowerBound(t.timestamp())) != sensors.constEnd()) {
|
||||
SensorsMap::const_iterator it(map.lowerBound(t.timestamp()));
|
||||
|
||||
if (it != map.constEnd()) {
|
||||
t.setCadence(it->cadence * 60);
|
||||
t.setTemperature(it->temperature - 273.15);
|
||||
t.setHeartRate(it->hr * 60);
|
||||
|
@ -23,10 +23,12 @@ private:
|
||||
qreal cadence, temperature, hr, power, speed;
|
||||
};
|
||||
|
||||
typedef QMap<QDateTime, Sensors> SensorsMap;
|
||||
|
||||
void sml(QList<TrackData> &tracks);
|
||||
void deviceLog(TrackData &track);
|
||||
void samples(SegmentData &segment);
|
||||
void sample(SegmentData &segment, QMap<QDateTime, Sensors> &map);
|
||||
void sample(SegmentData &segment, SensorsMap &map);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
friend QDebug operator<<(QDebug dbg, const Sensors &sensors);
|
||||
|
Loading…
x
Reference in New Issue
Block a user