aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index e066a95..1859243 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,7 @@
use std::{env, fs, path::PathBuf};
use color_eyre::eyre::Result;
-use indicatif::ProgressBar;
+use indicatif::{ProgressBar, ProgressStyle};
mod gpx;
mod layer;
@@ -10,6 +10,9 @@ mod renderer;
fn main() -> Result<()> {
color_eyre::install()?;
+ let progress_style =
+ ProgressStyle::with_template("[{elapsed}] {prefix:.cyan} {wide_bar} {pos:.green}/{len}")?;
+
let gpx_folder = env::args().nth(1).unwrap();
println!("Reading from {gpx_folder}");
@@ -23,7 +26,9 @@ fn main() -> Result<()> {
for zoom in 0..=19 {
println!("Doing level {zoom}");
- let bar = ProgressBar::new(tracks.len().try_into().unwrap());
+ let bar =
+ ProgressBar::new(tracks.len().try_into().unwrap()).with_style(progress_style.clone());
+ bar.set_prefix("Rendering heat zones");
let counter =
renderer::render_heatcounter(zoom, &tracks, |x| bar.inc(x.try_into().unwrap()));
bar.finish();
@@ -31,7 +36,9 @@ fn main() -> Result<()> {
let target = ["tiles", &zoom.to_string()].iter().collect::<PathBuf>();
fs::create_dir(&target)?;
- let bar = ProgressBar::new(counter.tile_count().try_into().unwrap());
+ let bar = ProgressBar::new(counter.tile_count().try_into().unwrap())
+ .with_style(progress_style.clone());
+ bar.set_prefix("Saving heat tiles");
renderer::lazy_colorization(&counter, &target, |x| bar.inc(x.try_into().unwrap()))?;
bar.finish();
}