Struct laz::laszip::LasZipCompressor
source · pub struct LasZipCompressor<'a, W: Write + Send + 'a> { /* private fields */ }
Expand description
Struct that handles the compression of the points into the given destination
This supports both variable-size and fixed-size chunks.
Its the LazVlr
that controls which type of chunks you want to write.
Fixed-Size
- Use
compress_one
and/orcompress_many
. - The compressor will take care of managing the chunking.
- Use
done
when you have compressed all the points you wanted.
Variable-Size
- Use
compress_one
and/orcompress_many
to compress points. - Use
finish_current_chunk
achieve variable-size chunks. - Use
done
when you have compressed all the points you wanted.
Or
- Use
compress_chunks
to compress chunks. - Use
done
when you have compressed all the points you wanted.
Implementations§
source§impl<'a, W: Write + Seek + Send + 'a> LasZipCompressor<'a, W>
impl<'a, W: Write + Seek + Send + 'a> LasZipCompressor<'a, W>
sourcepub fn new(output: W, vlr: LazVlr) -> Result<Self>
pub fn new(output: W, vlr: LazVlr) -> Result<Self>
Creates a compressor using the provided vlr.
sourcepub fn from_laz_items(output: W, items: Vec<LazItem>) -> Result<Self>
pub fn from_laz_items(output: W, items: Vec<LazItem>) -> Result<Self>
Creates a new LasZipCompressor using the items provided,
If you wish to use a different chunk size
see from_laz_vlr
sourcepub fn compress_one(&mut self, input: &[u8]) -> Result<()>
pub fn compress_one(&mut self, input: &[u8]) -> Result<()>
Compress the point and write the compressed data to the destination given when the compressor was constructed
The data is written in the buffer is expected to be exactly as it would have been in a LAS File, that is:
- The fields/dimensions are in the same order than the LAS spec says
- The data in the buffer is in Little Endian order
sourcepub fn compress_many(&mut self, input: &[u8]) -> Result<()>
pub fn compress_many(&mut self, input: &[u8]) -> Result<()>
Compress all the points contained in the input
slice
sourcepub fn compress_chunks<Chunks, Item>(&mut self, chunks: Chunks) -> Result<()>where
Item: AsRef<[u8]>,
Chunks: IntoIterator<Item = Item>,
pub fn compress_chunks<Chunks, Item>(&mut self, chunks: Chunks) -> Result<()>where Item: AsRef<[u8]>, Chunks: IntoIterator<Item = Item>,
sourcepub fn finish_current_chunk(&mut self) -> Result<()>
pub fn finish_current_chunk(&mut self) -> Result<()>
Finished the current chunks.
All points compressed with the previous calls to compress_one
and compress_many
will form one chunk. And the subsequent calls to compress_one
and compress_many
will form a new chunk.
Important
Only call this when writing variable-size chunks.
sourcepub fn reserve_offset_to_chunk_table(&mut self) -> Result<()>
pub fn reserve_offset_to_chunk_table(&mut self) -> Result<()>
Reserves and prepares the offset to chunk table that will be updated when done is called.
This method will automatically be called on the first point being compressed, but for some scenarios, manually calling this might be useful.