map routepoint to trackpoint explicitly

This commit is contained in:
vcoppe 2024-09-13 18:44:21 +02:00
parent 082276d71d
commit 0d6fe4093f

View file

@ -104,7 +104,7 @@ abstract class GPXTreeLeaf extends GPXTreeElement<GPXTreeLeaf> {
}
// A class that represents a GPX file
export class GPXFile extends GPXTreeNode<Track>{
export class GPXFile extends GPXTreeNode<Track> {
[immerable] = true;
attributes: GPXFileAttributes;
@ -1579,10 +1579,16 @@ function convertRouteToTrack(route: RouteType): Track {
route.rtept.forEach((rpt) => {
if (rpt.extensions && rpt.extensions['gpxx:RoutePointExtension'] && rpt.extensions['gpxx:RoutePointExtension']["gpxx:rpt"]) {
rpt.extensions['gpxx:RoutePointExtension']["gpxx:rpt"].forEach((rptExtension) => {
segment.trkpt.push(new TrackPoint(rptExtension as TrackPointType));
segment.trkpt.push(new TrackPoint({
attributes: rptExtension.attributes,
}));
});
} else {
segment.trkpt.push(new TrackPoint(rpt as TrackPointType));
segment.trkpt.push(new TrackPoint({
attributes: rpt.attributes,
ele: rpt.ele,
time: rpt.time,
}));
}
});