@@ -23,17 +23,24 @@ use rayon::prelude::*;
23
23
///
24
24
/// # Example
25
25
/// ```ignore
26
- /// use e57_to_las::convert_pointcloud;
27
- /// let pointcloud = e57::Pointcloud { };
28
- /// let input_path = String::from("path/to/input.e57");
29
- /// let output_path = String::from("path/to/output");
30
- /// convert_pointcloud(0, &pointcloud, input_path, output_path);
26
+ /// use std::path::Path;
27
+ /// use e57_to_las::{convert_pointcloud, LasVersion};
28
+ ///
29
+ /// # fn example() -> anyhow::Result<()> {
30
+ /// let input_path = Path::new("path/to/input.e57");
31
+ /// let output_path = Path::new("path/to/output");
32
+ /// let las_version = LasVersion::new(1, 4)?;
33
+ /// // pointcloud would be obtained from E57Reader in practice
34
+ /// # let pointcloud = todo!();
35
+ /// convert_pointcloud(0, &pointcloud, input_path, output_path, &las_version)?;
36
+ /// # Ok(())
37
+ /// # }
31
38
/// ```
32
39
pub fn convert_pointcloud (
33
40
index : usize ,
34
41
pointcloud : & PointCloud ,
35
- input_path : & String ,
36
- output_path : & String ,
42
+ input_path : & Path ,
43
+ output_path : & Path ,
37
44
las_version : & LasVersion ,
38
45
) -> Result < ( ) > {
39
46
let mut e57_reader = E57Reader :: from_file ( input_path) . context ( "Failed to open e57 file: " ) ?;
@@ -69,7 +76,7 @@ pub fn convert_pointcloud(
69
76
let max_cartesian = max_x. max ( max_y) . max ( max_z) ;
70
77
71
78
let path = create_path (
72
- Path :: new ( & output_path)
79
+ output_path
73
80
. join ( "las" )
74
81
. join ( format ! ( "{}{}" , index, ".las" ) ) ,
75
82
)
@@ -104,14 +111,22 @@ pub fn convert_pointcloud(
104
111
///
105
112
/// # Example
106
113
/// ```ignore
107
- /// use e57_to_las::convert_pointclouds;
108
- /// let e57_reader = e57::E57Reader::from_file("path/to/input.e56").context("Failed to open e57 file")?;
109
- /// let output_path = String::from("path/to/output");
110
- /// convert_pointclouds(e57_reader, output_path);
114
+ /// use std::path::Path;
115
+ /// use e57_to_las::{convert_pointclouds, LasVersion};
116
+ /// use anyhow::Context;
117
+ ///
118
+ /// # fn example() -> anyhow::Result<()> {
119
+ /// let input_path = Path::new("path/to/input.e57");
120
+ /// let e57_reader = e57::E57Reader::from_file(input_path).context("Failed to open e57 file")?;
121
+ /// let output_path = Path::new("path/to/output");
122
+ /// let las_version = LasVersion::new(1, 4)?;
123
+ /// convert_pointclouds(e57_reader, output_path, &las_version)?;
124
+ /// # Ok(())
125
+ /// # }
111
126
/// ```
112
127
pub fn convert_pointclouds (
113
128
e57_reader : E57Reader < BufReader < File > > ,
114
- output_path : & String ,
129
+ output_path : & Path ,
115
130
las_version : & LasVersion ,
116
131
) -> Result < ( ) > {
117
132
let pointclouds = e57_reader. pointclouds ( ) ;
@@ -164,7 +179,7 @@ pub fn convert_pointclouds(
164
179
. context ( "Error while converting pointcloud" ) ?;
165
180
166
181
let path = create_path (
167
- Path :: new ( & output_path)
182
+ output_path
168
183
. join ( "las" )
169
184
. join ( format ! ( "{}{}" , 0 , ".las" ) ) ,
170
185
)
0 commit comments