epoint_io/las/
mod.rs

1use crate::Error;
2use crate::Error::InvalidVersion;
3
4pub mod read;
5mod read_impl;
6pub mod write;
7mod write_impl;
8
9pub const FILE_EXTENSION_LAS_FORMAT: &str = "las";
10pub const FILE_EXTENSION_LAZ_FORMAT: &str = "laz";
11
12#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd)]
13pub enum LasVersion {
14    /// LAS version 1.0 released 2003 by ASPRS.
15    V1_0,
16    /// LAS version 1.1 released 2005 by ASPRS.
17    V1_1,
18    /// LAS version 1.2 released 2008 by ASPRS.
19    V1_2,
20    /// LAS version 1.3 released 2010 by ASPRS.
21    V1_3,
22    /// LAS version 1.4 released 2013 by ASPRS.
23    V1_4,
24}
25
26impl LasVersion {
27    pub fn from(major: u8, minor: u8) -> Result<Self, Error> {
28        match (major, minor) {
29            (1, 0) => Ok(Self::V1_0),
30            (1, 1) => Ok(Self::V1_1),
31            (1, 2) => Ok(Self::V1_2),
32            (1, 3) => Ok(Self::V1_3),
33            (1, 4) => Ok(Self::V1_4),
34            _ => Err(InvalidVersion { major, minor }),
35        }
36    }
37}