mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Do not show the session end as (a single) lap
This commit is contained in:
parent
0b6daad28f
commit
96044fd8da
@ -238,6 +238,7 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
|||||||
bool valid;
|
bool valid;
|
||||||
Event event;
|
Event event;
|
||||||
Waypoint waypoint;
|
Waypoint waypoint;
|
||||||
|
int trigger = -1;
|
||||||
|
|
||||||
if (!def->fields.size() && !def->devFields.size()) {
|
if (!def->fields.size() && !def->devFields.size()) {
|
||||||
_errorString = "Undefined data message";
|
_errorString = "Undefined data message";
|
||||||
@ -359,8 +360,8 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
|||||||
case 7:
|
case 7:
|
||||||
waypoint.setDescription(Format::timeSpan(val.toUInt() / 1000));
|
waypoint.setDescription(Format::timeSpan(val.toUInt() / 1000));
|
||||||
break;
|
break;
|
||||||
case 254:
|
case 24:
|
||||||
waypoint.setName("#" + QString::number(val.toUInt()));
|
trigger = val.toInt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,7 +385,7 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
|||||||
ctx.segment.append(ctx.trackpoint);
|
ctx.segment.append(ctx.trackpoint);
|
||||||
ctx.trackpoint = Trackpoint();
|
ctx.trackpoint = Trackpoint();
|
||||||
}
|
}
|
||||||
} else if (def->globalId == COURSEPOINT || def->globalId == LAP) {
|
} else if (def->globalId == COURSEPOINT) {
|
||||||
if (waypoint.coordinates().isValid())
|
if (waypoint.coordinates().isValid())
|
||||||
ctx.waypoints.append(waypoint);
|
ctx.waypoints.append(waypoint);
|
||||||
} else if (def->globalId == LOCATION) {
|
} else if (def->globalId == LOCATION) {
|
||||||
@ -393,6 +394,17 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
|||||||
+ 631065600, Qt::UTC));
|
+ 631065600, Qt::UTC));
|
||||||
ctx.waypoints.append(waypoint);
|
ctx.waypoints.append(waypoint);
|
||||||
}
|
}
|
||||||
|
} else if (def->globalId == LAP && trigger >= 0) {
|
||||||
|
if (waypoint.coordinates().isValid()) {
|
||||||
|
if (trigger == 7)
|
||||||
|
waypoint.setName("Finish");
|
||||||
|
else
|
||||||
|
waypoint.setName("Lap " + QString::number(++ctx.laps));
|
||||||
|
waypoint.setTimestamp(QDateTime::fromSecsSinceEpoch(ctx.timestamp
|
||||||
|
+ 631065600, Qt::UTC));
|
||||||
|
if (trigger != 7 || ctx.laps > 1)
|
||||||
|
ctx.waypoints.append(waypoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -52,7 +52,7 @@ private:
|
|||||||
struct CTX {
|
struct CTX {
|
||||||
CTX(QFile *file, QVector<Waypoint> &waypoints)
|
CTX(QFile *file, QVector<Waypoint> &waypoints)
|
||||||
: file(file), waypoints(waypoints), len(0), endian(0), timestamp(0),
|
: file(file), waypoints(waypoints), len(0), endian(0), timestamp(0),
|
||||||
ratio(NAN) {}
|
ratio(NAN), laps(0) {}
|
||||||
|
|
||||||
QFile *file;
|
QFile *file;
|
||||||
QVector<Waypoint> &waypoints;
|
QVector<Waypoint> &waypoints;
|
||||||
@ -63,6 +63,7 @@ private:
|
|||||||
qreal ratio;
|
qreal ratio;
|
||||||
Trackpoint trackpoint;
|
Trackpoint trackpoint;
|
||||||
SegmentData segment;
|
SegmentData segment;
|
||||||
|
unsigned laps;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool readData(QFile *file, char *data, size_t size);
|
bool readData(QFile *file, char *data, size_t size);
|
||||||
|
Loading…
Reference in New Issue
Block a user