Struct CopcWriter

Source
pub struct CopcWriter<'a, W: 'a + Write + Seek> { /* private fields */ }
Expand description

COPC file writer

Implementations§

Source§

impl CopcWriter<'_, BufWriter<File>>

Source

pub fn from_path<P: AsRef<Path>>( path: P, header: Header, min_size: i32, max_size: i32, ) -> Result<Self>

Creates a new COPC-writer for a path, creates a file at that path and wraps it in a BufWrite for you and passes it along to new

see new for usage

Source§

impl<W: Write + Seek> CopcWriter<'_, W>

public API

Source

pub fn new( write: W, header: Header, min_size: i32, max_size: i32, ) -> Result<Self>

Create a COPC file writer for the write- and seekable write configured with the provided las::Header recommended to use from_path for writing to file

The bounds field in the header is used as the bounds for the octree the bounds are checked for being normal

max_size is the maximal number of las::Points an octree node can hold any max_size < 1 sets the max_size to [crate::MAX_NODE_SIZE_DEFAULT] this is a soft limit

min_size is the minimal number of las::Points an octree node can hold any min_size < 1 sets the min_size to [crate::MIN_NODE_SIZE_DEFAULT] this is a hard limit

min_size greater or equal to max_size after checking values < 1 results in a crate::Error::InvalidNodeSize error

This writer is strictly following the LAS 1.4 spec and the COPC spec which means that any provided header not compatible with those will lead to an Err That being said, LAS 1.2 headers and PDRFs 1 and 3 are accepted and upgraded to their matching LAS 1.4 versions GeoTiff CRS VLR’s are parsed and written to WKT CRS VLR’s A CRS VLR is MANDATORY and without one

Source

pub fn write<D: IntoIterator<Item = Point>>( &mut self, data: D, num_points: i32, ) -> Result<()>

Write anything that implements IntoIterator over las::Point to the COPC Write Only one iterator can be written so a call to Self::write closes the writer.

num_points is the number of points in the iterator the number of points is used for stochastically filling the nodes if num_points is < 1 a greedy filling strategy is used this should only be used if the passed iterator is randomly ordered which most of the time not is the case if num_points is not equal to the actual number of points in the iterator all points will still be written but the point distribution in a node will not represent of the entire distribution over that node i.e. only full resolution queries will look right which means the point cloud will look wierd in any viewer which utilizes the COPC information

returns an Err(crate::Error::ClosedWriter) if the writer has already been closed.

If a point is outside the copc bounds or not matching the las::point::Format of the writer’s header Err is returned crate::PointAddError::PointAttributesDoNotMatch take precedence over crate::PointAddError::PointNotInBounds All the points inside the bounds and matching the point format are written regardless

All points which both match the point format and are inside the bounds are added

Lastly Self::close is called. If closing fails an crate::Error is returned and the state of the Write is undefined

If all points match the format, are inside the bounds and Self::close is successfull Ok(()) is returned

Source

pub fn is_closed(&self) -> bool

Whether this writer is closed or not

Source

pub fn max_node_size(&self) -> i32

number of points in the largest node

Source

pub fn min_node_size(&self) -> i32

number of points in the smallest node

Source

pub fn header(&self) -> &Header

This writer’s header, some fields are updated on closing of the writer

Source

pub fn hierarchy_entries(&self) -> &HierarchyPage

This writer’s EPT Hierarchy

Source

pub fn copc_info(&self) -> &CopcInfo

This writer’s COPC info

Trait Implementations§

Source§

impl<W: Write + Seek> Drop for CopcWriter<'_, W>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, W> Freeze for CopcWriter<'a, W>
where W: Freeze,

§

impl<'a, W> !RefUnwindSafe for CopcWriter<'a, W>

§

impl<'a, W> Send for CopcWriter<'a, W>
where W: Send,

§

impl<'a, W> !Sync for CopcWriter<'a, W>

§

impl<'a, W> Unpin for CopcWriter<'a, W>
where W: Unpin,

§

impl<'a, W> !UnwindSafe for CopcWriter<'a, W>

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> 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, 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.