mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-27 02:27:18 +00:00
route full support
This commit is contained in:
1 parent
c842da8dc1
commit
b6c0f5190a
91 files changed
+2523
-847
No files matched your search
@@ -15,13 +15,14 @@
|
||||
const files = engine.files;
|
||||
const statistics = engine.statistics;
|
||||
|
||||
/** The number of segments of a file or of one of its tracks. */
|
||||
/** The number of segments of a file (its routes have one each) or of one of its tracks. */
|
||||
function segmentCount(fileId: string, trackId?: string) {
|
||||
const file = $files.get(fileId);
|
||||
const tracks = file ? get(file).structure.tracks : [];
|
||||
return tracks
|
||||
const structure = file ? get(file).structure : undefined;
|
||||
const routes = trackId === undefined ? (structure?.routes.length ?? 0) : 0;
|
||||
return (structure?.tracks ?? [])
|
||||
.filter((track) => trackId === undefined || track.id === trackId)
|
||||
.reduce((count, track) => count + track.segments.length, 0);
|
||||
.reduce((count, track) => count + track.segments.length, routes);
|
||||
}
|
||||
|
||||
// files or tracks, which all have several segments
|
||||
|
||||
Reference in new issue
Block a user