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
@@ -6,7 +6,7 @@
|
||||
//! between them are kept: every part comes after the previous one in the new order, as late as the
|
||||
//! original one came after the part that followed it.
|
||||
|
||||
use crate::{Track, TrackSegment, Trackpoint};
|
||||
use crate::{Route, Track, TrackSegment, Trackpoint};
|
||||
|
||||
/// The time of the first trackpoint of a segment.
|
||||
pub fn start_time(segment: &TrackSegment) -> Option<i64> {
|
||||
@@ -94,6 +94,19 @@ pub fn reverse_segments(
|
||||
}
|
||||
}
|
||||
|
||||
/// Reverses the routes of a file, and their trackpoints, like the segments of a track (see
|
||||
/// [`reverse_segments`]).
|
||||
pub fn reverse_routes(routes: &mut [Route], original_next: Option<i64>, new_previous: Option<i64>) {
|
||||
routes.reverse();
|
||||
let (mut next, mut previous) = (original_next, new_previous);
|
||||
for route in routes.iter_mut() {
|
||||
let original_start = start_time(&route.seg);
|
||||
reverse_segment(&mut route.seg, next, previous);
|
||||
next = original_start;
|
||||
previous = end_time(&route.seg);
|
||||
}
|
||||
}
|
||||
|
||||
/// Reverses the tracks of a file, and their segments and trackpoints.
|
||||
pub fn reverse_tracks(tracks: &mut [Track], original_next: Option<i64>, new_previous: Option<i64>) {
|
||||
tracks.reverse();
|
||||
|
||||
Reference in new issue
Block a user