mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-28 02:47:17 +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
@@ -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()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user