Trait las::reader::Read

source ·
pub trait Read {
    // Required methods
    fn header(&self) -> &Header;
    fn read(&mut self) -> Option<Result<Point>>;
    fn read_n(&mut self, n: u64) -> Result<Vec<Point>>;
    fn read_n_into(&mut self, n: u64, points: &mut Vec<Point>) -> Result<u64>;
    fn read_all_points(&mut self, points: &mut Vec<Point>) -> Result<u64>;
    fn seek(&mut self, position: u64) -> Result<()>;
    fn points(&mut self) -> PointIterator<'_> ;
}
Expand description

A trait for objects which read LAS data.

Required Methods§

source

fn header(&self) -> &Header

Returns a reference to this reader’s header.

§Examples
use las::{Read, Reader};
let reader = Reader::from_path("tests/data/autzen.las").unwrap();
let header = reader.header();
source

fn read(&mut self) -> Option<Result<Point>>

Reads a point.

§Examples
let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
let point = reader.read().unwrap().unwrap();
source

fn read_n(&mut self, n: u64) -> Result<Vec<Point>>

Reads n points.

source

fn read_n_into(&mut self, n: u64, points: &mut Vec<Point>) -> Result<u64>

Reads n points into the vec

source

fn read_all_points(&mut self, points: &mut Vec<Point>) -> Result<u64>

Reads all points left into the vec

source

fn seek(&mut self, position: u64) -> Result<()>

Seeks to the given point number, zero-indexed.

Note that seeking on compressed (LAZ) data can be expensive as the reader will have to seek to the closest chunk start and decompress all points up until the point seeked to.

§Examples
use las::{Read, Reader};
let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
reader.seek(1).unwrap(); // <- seeks to the second point
let the_second_point = reader.read().unwrap().unwrap();
source

fn points(&mut self) -> PointIterator<'_>

Returns an iterator over this reader’s points.

§Examples
let mut reader = Reader::from_path("tests/data/autzen.las").unwrap();
let points = reader.points().collect::<Result<Vec<_>, _>>().unwrap();

Implementors§

source§

impl<'a> Read for Reader<'a>