Struct las::point::Format [−][src]
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
impl Format
[src]
pub fn new(n: u8) -> Result<Format>
[src]
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());
pub fn extend(&mut self)
[src]
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);
pub fn len(&self) -> u16
[src]
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());
pub fn to_u8(&self) -> Result<u8>
[src]
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
impl Clone for Format
[src]
impl Copy for Format
[src]
impl Debug for Format
[src]
impl Default for Format
[src]
impl Display for Format
[src]
impl PartialEq<Format> for Format
[src]
impl StructuralPartialEq for Format
[src]
Auto Trait Implementations
impl RefUnwindSafe for Format
[src]
impl Send for Format
[src]
impl Sync for Format
[src]
impl Unpin for Format
[src]
impl UnwindSafe for Format
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,