This commit is contained in:
vcoppe
2026-10-01 18:42:31 +02:00
parent eb8e09b835
commit 5868595a6c
9 changed files with 175 additions and 70 deletions
+36 -2
View File
@@ -1,12 +1,30 @@
use uuid::Uuid;
use crate::gpx::{Trackpoint, Waypoint};
static MAX_TRKPT_CHUNK_SIZE: usize = 4096;
#[derive(Debug, Default)]
#[derive(Debug)]
pub struct TrackpointChunk {
pub id: Uuid,
pub trkpt: Vec<Trackpoint>,
}
impl Default for TrackpointChunk {
fn default() -> Self {
Self {
id: Uuid::new_v4(),
trkpt: Default::default(),
}
}
}
impl PartialEq for TrackpointChunk {
fn eq(&self, other: &Self) -> bool {
self.id == other.id
}
}
impl TrackpointChunk {
pub fn is_full(&self) -> bool {
self.trkpt.len() == MAX_TRKPT_CHUNK_SIZE
@@ -15,11 +33,27 @@ impl TrackpointChunk {
static MAX_WPT_CHUNK_SIZE: usize = 128;
#[derive(Debug, Default)]
#[derive(Debug)]
pub struct WaypointChunk {
pub id: Uuid,
pub wpt: Vec<Waypoint>,
}
impl Default for WaypointChunk {
fn default() -> Self {
Self {
id: Uuid::new_v4(),
wpt: Default::default(),
}
}
}
impl PartialEq for WaypointChunk {
fn eq(&self, other: &Self) -> bool {
self.id == other.id
}
}
impl WaypointChunk {
pub fn is_full(&self) -> bool {
self.wpt.len() == MAX_WPT_CHUNK_SIZE