Struct las::point::Format [−][src]
pub struct Format {
pub has_gps_time: bool,
pub has_color: bool,
pub is_extended: bool,
pub has_waveform: bool,
pub has_nir: bool,
pub extra_bytes: u16,
pub is_compressed: bool,
}
Expand description
Point formats are defined by the las spec.
As of las 1.4, there are eleven point formats (0-10). A new Format
can be created from its
code and converted back into it:
use las::point::Format;
let format_1 = Format::new(1).unwrap();
assert!(format_1.has_gps_time);
assert_eq!(1, format_1.to_u8().unwrap());
assert!(Format::new(11).is_err());
Point formats can have extra bytes, which are user-defined attributes. Extra bytes were introduced in las 1.4.
use las::point::Format;
let mut format = Format::new(0).unwrap();
format.extra_bytes = 1;
assert_eq!(21, format.len());
Certain combinations of attributes in a point format are illegal, e.g. gps time is required for all formats >= 6:
use las::point::Format;
let mut format = Format::new(6).unwrap();
format.has_gps_time = false;
assert!(format.to_u8().is_err());
Fields
has_gps_time: bool
Does this point format include gps time?
has_color: bool
Does this point format include red, green, and blue colors?
is_extended: bool
Does this point format use two bytes for its flags and scaled scan angles?
has_waveform: bool
Does this point format have waveforms?
has_nir: bool
Does this point format have near infrared data?
extra_bytes: u16
The number of extra bytes on each point.
is_compressed: bool
Is this point format compressed?
Implementations
Creates a new point format from a u8.
Examples
use las::point::Format;
let format = Format::new(0).unwrap();
assert!(!format.has_gps_time);
assert!(!format.has_color);
let format = Format::new(3).unwrap();
assert!(format.has_gps_time);
assert!(format.has_color);
assert!(Format::new(11).is_err());
Converts this point format into an extended format.
“Extended” formats can contain more information per point, and must have gps time.
Examples
use las::point::Format;
let mut format = Format::default();
assert!(!format.has_gps_time);
assert!(!format.is_extended);
format.extend();
assert!(format.has_gps_time);
assert!(format.is_extended);
Returns this point format’s length.
Examples
use las::point::Format;
let mut format = Format::new(0).unwrap();
assert_eq!(20, format.len());
format.has_gps_time = true;
assert_eq!(28, format.len());
Converts this point format to a u8.
Can return an error if there is an invalid combination of attributes.
Examples
use las::point::Format;
let mut format = Format::default();
assert_eq!(0, format.to_u8().unwrap());
format.is_extended = true;
assert!(format.to_u8().is_err());
format.has_gps_time = true;
assert_eq!(6, format.to_u8().unwrap());
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Format
impl UnwindSafe for Format
Blanket Implementations
Mutably borrows from an owned value. Read more