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
impl PointData
Sourcepub fn transforms(&self) -> &Vector<Transform>
pub fn transforms(&self) -> &Vector<Transform>
Returns the coordinate transforms these records were built with.
Sourcepub fn raw_bytes(&self) -> &[u8] ⓘ
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.
Sourcepub fn record_len(&self) -> usize
pub fn record_len(&self) -> usize
Returns the record length in bytes for this format.
Sourcepub fn points(&self) -> PointDataIter<'_>
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.
Sourcepub fn resize_for(&mut self, n: usize) -> &mut [u8] ⓘ
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.
Sourcepub fn x_raw(&self) -> impl Iterator<Item = i32>
pub fn x_raw(&self) -> impl Iterator<Item = i32>
Raw scaled x values (little-endian i32 loads from the x column).
Sourcepub fn classification(&self) -> impl Iterator<Item = u8>
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.
Sourcepub fn return_number(&self) -> impl Iterator<Item = u8>
pub fn return_number(&self) -> impl Iterator<Item = u8>
Return number column.
Sourcepub fn number_of_returns(&self) -> impl Iterator<Item = u8>
pub fn number_of_returns(&self) -> impl Iterator<Item = u8>
Number-of-returns column.
Sourcepub fn scan_angle_degrees(&self) -> impl Iterator<Item = f32>
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.
Sourcepub fn point_source_id(&self) -> impl Iterator<Item = u16>
pub fn point_source_id(&self) -> impl Iterator<Item = u16>
Point source ID column.
Sourcepub fn gps_time(&self) -> Option<impl Iterator<Item = f64>>
pub fn gps_time(&self) -> Option<impl Iterator<Item = f64>>
GPS time column, or None if the format has no gps_time field.