Struct las::file::File
[−]
[src]
pub struct File { // some fields omitted }
A las file.
Methods
impl File
fn from_path<P: AsRef<Path>>(path: P) -> Result<File>
Reads a las file from the filesystem.
Examples
use las::file::File; let file = File::from_path("data/1.0_0.las").unwrap();
fn read_from<R: Read + Seek>(reader: R) -> Result<File>
Reads a las file from a Read
.
Examples
use std::fs; use las::file::File; let reader = fs::File::open("data/1.0_0.las").unwrap(); let file = File::read_from(reader).unwrap();
fn new() -> File
fn set_header(&mut self, header: Header)
Sets the header for this file.
Since the header contains so much metadata, we might want to construct a header elsewhere then set it to the file just before write.
Examples
use las::file::File; use las::header::Header; let mut file = File::new(); let header = Header::new(); file.set_header(header);
fn points(&self) -> &Vec<Point>
Returns a reference to a vector of this file's points.
Examples
use las::file::File; let file = File::from_path("data/1.0_0.las").unwrap(); let points = file.points();
fn add_point(&mut self, point: Point)
Adds a point to this lasfile.
Examples
use las::file::File; use las::point::Point; let mut file = File::new(); let point = Point::new(); file.add_point(point);
fn to_path<P: AsRef<Path>>(&mut self, path: P, auto_offsets: bool) -> Result<()>
Writes out this las file to a Path
.
Examples
use std::fs::remove_file; use las::file::File; let mut file = File::new(); file.to_path("temp.las", true).unwrap(); remove_file("temp.las");
fn write_to<W: Write>(&mut self, writer: &mut W, auto_offsets: bool) -> Result<()>
Writes this las file to a Write
.
If auto_offsets is true, reasonable offset values will be calculated and written to the header before the file is written.
Examples
use std::io::Cursor; use las::file::File; let mut file = File::from_path("data/1.0_0.las").unwrap(); let ref mut cursor = Cursor::new(Vec::new()); file.write_to(cursor, true).unwrap();