Skip to main content

PointData

Struct PointData 

Source
pub struct PointData { /* private fields */ }
Expand description

A set of decompressed LAS point records held as one contiguous byte slab.

PointData mirrors the on-disk layout for a specific point format. It’s produced by Reader — call Reader::read_points or Reader::read_all — or constructed directly via PointDataBuilder (paired with PointData::resize_for when driving an external decompressor, e.g. COPC).

The row view is PointData::points, yielding owned Point values; column views are PointData::x, PointData::intensity, etc., each a cheap iterator over one field at a time.

§Example

use las::Reader;

let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
let points = reader.read_points(10).unwrap();
assert_eq!(points.len(), 10);

Implementations§

Source§

impl PointData

Source

pub fn len(&self) -> usize

Returns the number of points currently held.

Source

pub fn is_empty(&self) -> bool

Returns true if this PointData contains no points.

Source

pub fn format(&self) -> &Format

Returns the point format these records were built for.

Source

pub fn transforms(&self) -> &Vector<Transform>

Returns the coordinate transforms these records were built with.

Source

pub fn raw_bytes(&self) -> &[u8]

Returns the underlying byte buffer.

Its length is self.len() * self.format().len() as usize. Callers that want to parse fields themselves or hand the slab to another system can use this as an escape hatch.

Source

pub fn record_len(&self) -> usize

Returns the record length in bytes for this format.

Source

pub fn points(&self) -> PointDataIter<'_>

Decodes rows into owned Point values, row by row.

Each call to .next() runs raw::Point::read_from + Point::new on one record. Not named .iter() because it’s not a view over existing Points — there is no Point in memory until you ask for one. Prefer the column accessors (PointData::x, PointData::intensity, …) when you only need a subset of fields; they skip the full-record decode.

Source

pub fn resize_for(&mut self, n: usize) -> &mut [u8]

Resizes the underlying byte buffer to hold exactly n points and returns a mutable view of it.

This is the primary entry point for callers that drive a decompressor directly (e.g. against COPC chunks that bypass Reader). Call resize_for, decompress into the returned slice, and then use the column accessors or PointData::points as usual.

Source

pub fn x_raw(&self) -> impl Iterator<Item = i32>

Raw scaled x values (little-endian i32 loads from the x column).

Source

pub fn y_raw(&self) -> impl Iterator<Item = i32>

Raw scaled y values.

Source

pub fn z_raw(&self) -> impl Iterator<Item = i32>

Raw scaled z values.

Source

pub fn x(&self) -> impl Iterator<Item = f64>

World x values, with scale and offset applied.

Source

pub fn y(&self) -> impl Iterator<Item = f64>

World y values.

Source

pub fn z(&self) -> impl Iterator<Item = f64>

World z values.

Source

pub fn intensity(&self) -> impl Iterator<Item = u16>

Intensity column.

Source

pub fn classification(&self) -> impl Iterator<Item = u8>

Classification byte column. For legacy formats this is the low 5 bits of the second flags byte; for extended formats it is the third flags byte directly.

Source

pub fn return_number(&self) -> impl Iterator<Item = u8>

Return number column.

Source

pub fn number_of_returns(&self) -> impl Iterator<Item = u8>

Number-of-returns column.

Source

pub fn scan_angle_degrees(&self) -> impl Iterator<Item = f32>

Scan angle column, in degrees.

Legacy formats store scan angle as an i8 rank in [-90, 90] degrees. Extended formats store it as an i16 in units of 0.006 degrees. Both are normalized to f32 degrees here.

Source

pub fn user_data(&self) -> impl Iterator<Item = u8>

User data byte column.

Source

pub fn point_source_id(&self) -> impl Iterator<Item = u16>

Point source ID column.

Source

pub fn gps_time(&self) -> Option<impl Iterator<Item = f64>>

GPS time column, or None if the format has no gps_time field.

Source

pub fn rgb(&self) -> Option<impl Iterator<Item = (u16, u16, u16)>>

RGB column, or None if the format has no color.

Source

pub fn nir(&self) -> Option<impl Iterator<Item = u16>>

NIR column, or None if the format has no NIR field.

Trait Implementations§

Source§

impl Clone for PointData

Source§

fn clone(&self) -> PointData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PointData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.