route full support

This commit is contained in:
vcoppe committed 2026-10-26 18:51:56 +01:00
1 parent c842da8dc1
commit b6c0f5190a
91 files changed
+2523 -847

No files matched your search

+12 -2
View File
@@ -1,4 +1,4 @@
use crate::{File, Track, TrackSegment, Waypoint};
use crate::{File, Route, Track, TrackSegment, Waypoint};
// The trackpoints of a segment are shared chunks, so copying elements is cheap.
@@ -18,10 +18,20 @@ pub fn copy_track(track: &Track) -> Track {
}
}
/// A copy of the file and of its tracks and segments, with new ids.
/// A copy of the route and of its segment, with new ids.
pub fn copy_route(route: &Route) -> Route {
Route {
id: Default::default(),
seg: copy_segment(&route.seg),
..route.clone()
}
}
/// A copy of the file and of its routes, tracks and segments, with new ids.
pub fn copy_file(file: &File) -> File {
File {
id: Default::default(),
rte: file.rte.iter().map(copy_route).collect(),
trk: file.trk.iter().map(copy_track).collect(),
..file.clone()
}