mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 15:43:25 +00:00
single simplify call to create whole anchor point hierarchy
This commit is contained in:
@@ -20,6 +20,7 @@ abstract class GPXTreeElement<T extends GPXTreeElement<any>> {
|
||||
|
||||
abstract getStartTimestamp(): Date;
|
||||
abstract getEndTimestamp(): Date;
|
||||
abstract getTrackPoints(): TrackPoint[];
|
||||
abstract getTrackPointsAndStatistics(): { points: TrackPoint[], statistics: TrackPointStatistics };
|
||||
|
||||
abstract toGeoJSON(): any;
|
||||
@@ -71,6 +72,10 @@ abstract class GPXTreeNode<T extends GPXTreeElement<any>> extends GPXTreeElement
|
||||
return this.getChildren()[this.getChildren().length - 1].getEndTimestamp();
|
||||
}
|
||||
|
||||
getTrackPoints(): TrackPoint[] {
|
||||
return this.getChildren().flatMap((child) => child.getTrackPoints());
|
||||
}
|
||||
|
||||
getTrackPointsAndStatistics(): { points: TrackPoint[]; statistics: TrackPointStatistics; } {
|
||||
let points: TrackPoint[] = [];
|
||||
let statistics: TrackPointStatistics = {
|
||||
@@ -379,6 +384,10 @@ export class TrackSegment extends GPXTreeLeaf {
|
||||
return this.trkpt[this.trkpt.length - 1].time;
|
||||
}
|
||||
|
||||
getTrackPoints(): TrackPoint[] {
|
||||
return this.trkpt;
|
||||
}
|
||||
|
||||
getTrackPointsAndStatistics(): { points: TrackPoint[], statistics: TrackPointStatistics } {
|
||||
return {
|
||||
points: this.trkpt,
|
||||
|
Reference in New Issue
Block a user