mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-10-04 12:58:23 +00:00
reorganize
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
use crate::state::StackEntry;
|
|
||||||
|
|
||||||
pub trait Action {
|
|
||||||
fn apply(entry: &mut StackEntry) -> Result<(), &'static str>;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
use crate::action::Action;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
mod action;
|
|
||||||
mod file;
|
|
||||||
|
|
||||||
pub use action::*;
|
|
||||||
pub use file::*;
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
pub struct CoordinatesBuffer {
|
|
||||||
pub lng: Vec<f64>,
|
|
||||||
pub lat: Vec<f64>,
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
mod coordinates;
|
|
||||||
mod statistics;
|
|
||||||
|
|
||||||
pub use coordinates::*;
|
|
||||||
pub use statistics::*;
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
gpx::{TrackSegment, TrackSegmentIndex},
|
core::gpx::{TrackSegment, TrackSegmentIndex},
|
||||||
utils::crossarc,
|
core::utils::crossarc,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn ramer_douglas_peucker<F>(
|
pub fn ramer_douglas_peucker<F>(
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::gpx::{Trackpoint, Waypoint};
|
use crate::{Trackpoint, Waypoint};
|
||||||
|
|
||||||
static MAX_TRKPT_CHUNK_SIZE: usize = 4096;
|
static MAX_TRKPT_CHUNK_SIZE: usize = 4096;
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ use std::rc::Rc;
|
|||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::gpx::{Link, Track, WaypointChunk};
|
use crate::{Link, Track, WaypointChunk};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct FileId(pub Uuid);
|
pub struct FileId(pub Uuid);
|
||||||
@@ -2,7 +2,7 @@ use std::{ops::Index, rc::Rc};
|
|||||||
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::gpx::{Trackpoint, TrackpointChunk};
|
use crate::{Trackpoint, TrackpointChunk};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||||
pub struct TrackSegmentId(Uuid);
|
pub struct TrackSegmentId(Uuid);
|
||||||
@@ -174,8 +174,6 @@ impl<'a> Iterator for TrackSegmentIterator<'a> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::gpx::TrackpointChunk;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
fn create_track_segment(nb_chunks: usize) -> TrackSegment {
|
fn create_track_segment(nb_chunks: usize) -> TrackSegment {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::gpx::{Link, TrackSegment};
|
use crate::{Link, TrackSegment};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||||
pub struct TrackId(Uuid);
|
pub struct TrackId(Uuid);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::gpx::LngLat;
|
use crate::LngLat;
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Trackpoint {
|
pub struct Trackpoint {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::gpx::{Link, LngLat};
|
use crate::{Link, LngLat};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub struct WaypointId(Uuid);
|
pub struct WaypointId(Uuid);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use crate::gpx::{
|
use crate::{
|
||||||
Author, File, Link, LngLat, Track, TrackSegment, Trackpoint, TrackpointChunk, Waypoint,
|
Author, File, Link, LngLat, Track, TrackSegment, Trackpoint, TrackpointChunk, Waypoint,
|
||||||
WaypointChunk,
|
WaypointChunk,
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
mod algorithm;
|
||||||
|
pub(crate) mod gpx;
|
||||||
|
mod io;
|
||||||
|
pub(crate) mod statistics;
|
||||||
|
mod utils;
|
||||||
|
|
||||||
|
pub use algorithm::*;
|
||||||
|
pub use gpx::*;
|
||||||
|
pub use io::*;
|
||||||
|
pub use statistics::*;
|
||||||
|
pub use utils::*;
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
mod cache;
|
|
||||||
mod statistics;
|
mod statistics;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
pub use cache::*;
|
|
||||||
pub use statistics::*;
|
pub use statistics::*;
|
||||||
pub use utils::*;
|
pub use utils::*;
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
algorithm::ramer_douglas_peucker,
|
LngLat, LngLatBounds, TrackSegment, TrackSegmentIndex, Trackpoint, distance, for_each_window,
|
||||||
for_each_window,
|
ramer_douglas_peucker, slope, speed, sum_options, time_diff,
|
||||||
gpx::{LngLat, LngLatBounds, TrackSegment, TrackSegmentIndex, Trackpoint},
|
|
||||||
statistics::sum_options,
|
|
||||||
utils::{distance, slope, speed, time_diff},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
@@ -290,7 +287,7 @@ pub struct SlopeSegment {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use std::{fs::File, io::Read};
|
use std::{fs::File, io::Read};
|
||||||
|
|
||||||
use crate::io::parse;
|
use crate::parse;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::f64::consts::PI;
|
use std::f64::consts::PI;
|
||||||
|
|
||||||
use crate::gpx::LngLat;
|
use crate::LngLat;
|
||||||
|
|
||||||
static TO_RADIANS: f64 = PI / 180.0;
|
static TO_RADIANS: f64 = PI / 180.0;
|
||||||
static EARTH_RADIUS: f64 = 6371.0088;
|
static EARTH_RADIUS: f64 = 6371.0088;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
mod statistics_buffer;
|
||||||
|
mod statistics_cache;
|
||||||
|
|
||||||
|
pub use statistics_buffer::*;
|
||||||
|
pub use statistics_cache::*;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::statistics::{GlobalStatistics, Statistics, sum_options};
|
use crate::{GlobalStatistics, Statistics, sum_options};
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct StatisticsBuffer {
|
pub struct StatisticsBuffer {
|
||||||
@@ -3,12 +3,7 @@ use std::{
|
|||||||
rc::Rc,
|
rc::Rc,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{File, Selection, StackEntry, Statistics, Track, TrackSegment, TrackSegmentRevisionId};
|
||||||
gpx::{File, Track, TrackSegment, TrackSegmentRevisionId},
|
|
||||||
selection::Selection,
|
|
||||||
state::StackEntry,
|
|
||||||
statistics::Statistics,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct StatisticsCache {
|
pub struct StatisticsCache {
|
||||||
@@ -6,14 +6,7 @@ use js_sys::{Float64Array, Function, Int32Array};
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{File, FileId, Selection, Stack, StackEntry, StatisticsBuffer, StatisticsCache, parse};
|
||||||
buffer::StatisticsBuffer,
|
|
||||||
gpx::{File, FileId},
|
|
||||||
io::parse,
|
|
||||||
selection::Selection,
|
|
||||||
state::{Stack, StackEntry},
|
|
||||||
statistics::StatisticsCache,
|
|
||||||
};
|
|
||||||
|
|
||||||
extern crate console_error_panic_hook;
|
extern crate console_error_panic_hook;
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
mod derived;
|
||||||
|
mod engine;
|
||||||
|
mod selection;
|
||||||
|
mod state;
|
||||||
|
|
||||||
|
pub use derived::*;
|
||||||
|
pub use engine::*;
|
||||||
|
pub use selection::*;
|
||||||
|
pub use state::*;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::gpx::{FileId, TrackId, TrackSegmentId, WaypointId};
|
use crate::{FileId, TrackId, TrackSegmentId, WaypointId};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FileSelection {
|
pub struct FileSelection {
|
||||||
@@ -3,7 +3,7 @@ use std::{
|
|||||||
rc::Rc,
|
rc::Rc,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::gpx::{File, FileId};
|
use crate::{File, FileId};
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Stack {
|
pub struct Stack {
|
||||||
+2
-9
@@ -1,12 +1,5 @@
|
|||||||
mod action;
|
mod core;
|
||||||
mod algorithm;
|
|
||||||
mod buffer;
|
|
||||||
mod engine;
|
mod engine;
|
||||||
mod gpx;
|
|
||||||
mod io;
|
|
||||||
mod selection;
|
|
||||||
mod state;
|
|
||||||
mod statistics;
|
|
||||||
mod utils;
|
|
||||||
|
|
||||||
|
pub use core::*;
|
||||||
pub use engine::*;
|
pub use engine::*;
|
||||||
|
|||||||
Reference in New Issue
Block a user