Struct pasture_io::las::LASReader
source · pub struct LASReader<'a, R: Read + Seek + Send + 'a> { /* private fields */ }
Expand description
PointReader
implementation for LAS/LAZ files
Implementations§
source§impl LASReader<'static, BufReader<File>>
impl LASReader<'static, BufReader<File>>
sourcepub fn from_path<P: AsRef<Path>>(
path: P,
point_layout_matches_memory_layout: bool
) -> Result<LASReader<'static, BufReader<File>>>
pub fn from_path<P: AsRef<Path>>( path: P, point_layout_matches_memory_layout: bool ) -> Result<LASReader<'static, BufReader<File>>>
Creates a new LASReader
by opening the file at the given path
. Tries to determine whether
the file is compressed from the file extension (i.e. files with extension .laz
are assumed to be
compressed). If point_layout_matches_memory_layout
is true
, the reader will return point data with a PointLayout
that exactly matches the binary
layout of the LAS point records. See [point_layout_from_las_point_format
] for more information.
Errors
If path
does not exist, cannot be opened or does not point to a valid LAS/LAZ file, an error is returned.
source§impl<'a, R: Read + Seek + Send> LASReader<'a, R>
impl<'a, R: Read + Seek + Send> LASReader<'a, R>
sourcepub fn from_read(
read: R,
is_compressed: bool,
point_layout_matches_memory_layout: bool
) -> Result<Self>
pub fn from_read( read: R, is_compressed: bool, point_layout_matches_memory_layout: bool ) -> Result<Self>
Creates a new LASReader
from the given read
. This method has to know whether
the read
points to a compressed LAZ file or a regular LAS file. If point_layout_matches_memory_layout
is true
, the reader will return point data with a PointLayout
that exactly matches the binary
layout of the LAS point records. See [point_layout_from_las_point_format
] for more information.
Errors
If the given Read
does not represent a valid LAS/LAZ file, an error is returned.
pub fn remaining_points(&self) -> usize
sourcepub fn las_metadata(&self) -> &LASMetadata
pub fn las_metadata(&self) -> &LASMetadata
Returns the LAS metadata for the associated LASReader
Trait Implementations§
source§impl<'a, R: Read + Seek + Send + 'a> PointReader for LASReader<'a, R>
impl<'a, R: Read + Seek + Send + 'a> PointReader for LASReader<'a, R>
source§fn get_metadata(&self) -> &dyn Metadata
fn get_metadata(&self) -> &dyn Metadata
Metadata
of the associated PointReader
source§fn get_default_point_layout(&self) -> &PointLayout
fn get_default_point_layout(&self) -> &PointLayout
PointLayout
of the associated PointReader
source§fn read_into<'b, 'c, B: BorrowedMutBuffer<'b>>(
&mut self,
point_buffer: &'c mut B,
count: usize
) -> Result<usize>where
'b: 'c,
fn read_into<'b, 'c, B: BorrowedMutBuffer<'b>>(
&mut self,
point_buffer: &'c mut B,
count: usize
) -> Result<usize>where
'b: 'c,
count
points from this PointReader
into the given point_buffer
. Uses the PointLayout
of the given PointBuffer
for reading. If no conversion from the default PointLayout
to this
new layout are possible, an error is returned. On success, returns the number of points that
were read. Overwrites existing data in point_buffer
starting at the first point, so the length
of point_buffer
must be greater than or equal to count
source§fn read<'a, B: OwningBuffer<'a> + MakeBufferFromLayout<'a> + 'a>(
&mut self,
count: usize
) -> Result<B>
fn read<'a, B: OwningBuffer<'a> + MakeBufferFromLayout<'a> + 'a>( &mut self, count: usize ) -> Result<B>
count
points from this PointReader
into a new buffer of type B
. The PointLayout
this new buffer will be equal to self.get_default_point_layout
source§impl<'a, R: Read + Seek + Send + 'a> SeekToPoint for LASReader<'a, R>
impl<'a, R: Read + Seek + Send + 'a> SeekToPoint for LASReader<'a, R>
source§fn seek_point(&mut self, position: SeekFrom) -> Result<usize>
fn seek_point(&mut self, position: SeekFrom) -> Result<usize>
position
in the underlying stream. Read moresource§fn point_index(&mut self) -> Result<usize>
fn point_index(&mut self) -> Result<usize>
seek_point(SeekFrom::Current(0))
.source§fn point_count(&mut self) -> Result<usize>
fn point_count(&mut self) -> Result<usize>
Auto Trait Implementations§
impl<'a, R> !RefUnwindSafe for LASReader<'a, R>
impl<'a, R> Send for LASReader<'a, R>
impl<'a, R> !Sync for LASReader<'a, R>
impl<'a, R> Unpin for LASReader<'a, R>where
R: Unpin,
impl<'a, R> !UnwindSafe for LASReader<'a, R>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.