From 24463d3f6a81c7e15f4087ad6a2908ae2b2c499c Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 27 Oct 2023 16:22:45 +0200 Subject: [PATCH] deps: bump e57rs --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/convert_pointcloud.rs | 11 +++++++---- src/get_las_writer.rs | 5 +++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1630e49..2f70bf8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -206,9 +206,9 @@ dependencies = [ [[package]] name = "e57" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7132285ffa7cbde6f24b60eb9d84d94c294964ee2643cedec25346624791fb9" +checksum = "71886780ba3310075b6c8221927c8db282460c5c7a7dfe7c1fee47af3b9586cd" dependencies = [ "roxmltree", ] diff --git a/Cargo.toml b/Cargo.toml index fdcc943..cd1d6b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ authors = ["pnodet ", "pnwa "] [dependencies] anyhow = "1.0.75" clap = { version = "4.4.5", features = ["derive"] } -e57 = "0.9.1" +e57 = "0.10.0" serde_json = { version = "1.0.107" } serde = { version = "1.0.188", features = ["derive"] } las = "0.8.1" diff --git a/src/convert_pointcloud.rs b/src/convert_pointcloud.rs index ca48f4b..164b948 100644 --- a/src/convert_pointcloud.rs +++ b/src/convert_pointcloud.rs @@ -70,7 +70,7 @@ pub fn convert_pointcloud( ) .context("Unable to create path: ")?; - let mut writer = get_las_writer(&pointcloud.guid, path, max_cartesian) + let mut writer = get_las_writer(pointcloud.clone().guid, path, max_cartesian) .context("Unable to create writer: ")?; for p in las_points { @@ -98,7 +98,6 @@ pub fn convert_pointcloud( /// let output_path = String::from("path/to/output"); /// convert_pointclouds(e57_reader, output_path); /// ``` - pub fn convert_pointclouds( e57_reader: E57Reader>, output_path: &String, @@ -155,8 +154,12 @@ pub fn convert_pointclouds( ) .context("Unable to create path: ")?; - let mut writer = get_las_writer(guid, path, max_cartesian_mutex.lock().unwrap().to_owned()) - .context("Unable to create writer: ")?; + let mut writer = get_las_writer( + Some(guid.to_owned()), + path, + max_cartesian_mutex.lock().unwrap().to_owned(), + ) + .context("Unable to create writer: ")?; for p in las_points_mutex.lock().unwrap().to_owned() { writer.write(p).context("Unable to write: ")?; diff --git a/src/get_las_writer.rs b/src/get_las_writer.rs index 7d9e893..ba84323 100644 --- a/src/get_las_writer.rs +++ b/src/get_las_writer.rs @@ -17,7 +17,7 @@ fn find_smallest_scale(x: f64) -> f64 { } pub(crate) fn get_las_writer( - guid: impl Into, + guid: Option, output_path: PathBuf, max_cartesian: f64, ) -> Result>> { @@ -34,7 +34,8 @@ pub(crate) fn get_las_writer( y: transform, z: transform, }; - builder.guid = Uuid::parse_str(&guid.into().replace("_", "-")).unwrap_or(Uuid::new_v4()); + builder.guid = Uuid::parse_str(&guid.unwrap_or(Uuid::new_v4().to_string()).replace("_", "-")) + .unwrap_or(Uuid::new_v4()); let header = builder.into_header().context("Error encountered: ")?;