pub struct TemporalCache { /* private fields */ }Expand description
Incrementally-loaded temporal index cache.
Implementations§
Source§impl TemporalCache
impl TemporalCache
Sourcepub async fn from_reader<S: ByteSource>(
reader: &CopcStreamingReader<S>,
) -> Result<Option<Self>, TemporalError>
pub async fn from_reader<S: ByteSource>( reader: &CopcStreamingReader<S>, ) -> Result<Option<Self>, TemporalError>
Open the temporal index from a COPC reader.
Loads the temporal header and root page. Returns Ok(None) if
no temporal EVLR exists in the file.
Sourcepub async fn load_header(
&mut self,
source: &impl ByteSource,
evlr_offset: u64,
evlr_count: u32,
) -> Result<bool, TemporalError>
pub async fn load_header( &mut self, source: &impl ByteSource, evlr_offset: u64, evlr_count: u32, ) -> Result<bool, TemporalError>
Scan EVLRs to find the temporal EVLR and read its header. Returns false if no temporal EVLR exists.
Sourcepub async fn load_root_page(
&mut self,
source: &impl ByteSource,
) -> Result<(), TemporalError>
pub async fn load_root_page( &mut self, source: &impl ByteSource, ) -> Result<(), TemporalError>
Load the root temporal page.
Sourcepub async fn load_pages_for_time_range(
&mut self,
source: &impl ByteSource,
start: GpsTime,
end: GpsTime,
) -> Result<(), TemporalError>
pub async fn load_pages_for_time_range( &mut self, source: &impl ByteSource, start: GpsTime, end: GpsTime, ) -> Result<(), TemporalError>
Load child pages that overlap a time range, pruning by subtree bounds.
Sourcepub async fn load_all_pages(
&mut self,
source: &impl ByteSource,
) -> Result<(), TemporalError>
pub async fn load_all_pages( &mut self, source: &impl ByteSource, ) -> Result<(), TemporalError>
Load ALL pending pages.
Sourcepub async fn query(
&mut self,
source: &impl ByteSource,
start: GpsTime,
end: GpsTime,
) -> Result<Vec<&NodeTemporalEntry>, TemporalError>
pub async fn query( &mut self, source: &impl ByteSource, start: GpsTime, end: GpsTime, ) -> Result<Vec<&NodeTemporalEntry>, TemporalError>
Load relevant pages and return all nodes that overlap a time range.
This is the primary query method — it ensures the right pages are loaded
before returning results. Equivalent to calling load_pages_for_time_range
followed by nodes_in_range, but cannot return incomplete results.
Sourcepub fn get(&self, key: &VoxelKey) -> Option<&NodeTemporalEntry>
pub fn get(&self, key: &VoxelKey) -> Option<&NodeTemporalEntry>
Look up the temporal entry for a node.
Sourcepub fn nodes_in_range(
&self,
start: GpsTime,
end: GpsTime,
) -> Vec<&NodeTemporalEntry>
pub fn nodes_in_range( &self, start: GpsTime, end: GpsTime, ) -> Vec<&NodeTemporalEntry>
Return all loaded nodes whose time range overlaps [start, end].
Sourcepub fn header(&self) -> Option<&TemporalHeader>
pub fn header(&self) -> Option<&TemporalHeader>
The parsed temporal index header, if loaded.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&VoxelKey, &NodeTemporalEntry)>
pub fn iter(&self) -> impl Iterator<Item = (&VoxelKey, &NodeTemporalEntry)>
Iterate all loaded entries.
Sourcepub async fn query_chunks<S: ByteSource>(
&mut self,
reader: &mut CopcStreamingReader<S>,
bounds: &Aabb,
start: GpsTime,
end: GpsTime,
fields: Fields,
) -> Result<Vec<(Chunk, Range<u32>)>, TemporalError>
pub async fn query_chunks<S: ByteSource>( &mut self, reader: &mut CopcStreamingReader<S>, bounds: &Aabb, start: GpsTime, end: GpsTime, fields: Fields, ) -> Result<Vec<(Chunk, Range<u32>)>, TemporalError>
Query chunks by time range and spatial bounds.
Loads the relevant hierarchy and temporal pages, fetches every
matching chunk with the caller’s fields mask, and returns
(chunk, candidate_range) pairs. candidate_range is the
sub-range of point indices in chunk whose GPS times could
possibly fall within [start, end] based on the temporal index
stride samples — points outside this range are guaranteed not to
match and can be skipped.
The caller is responsible for the exact per-point intersection.
Combine with Chunk::indices_in_bounds and
indices_in_time_range to compute
the precise matching set, then walk column accessors or call
Chunk::points_at to materialize owned values.
use copc_streaming::Fields;
let chunks = temporal
.query_chunks(
&mut reader,
&bbox,
start,
end,
Fields::Z | Fields::GPS_TIME,
)
.await?;
for (chunk, range) in &chunks {
let times = chunk.gps_time().unwrap();
for (i, t) in times.enumerate().skip(range.start as usize)
.take(range.len()) {
if t >= start.0 && t <= end.0 {
// ...
}
}
}Sourcepub async fn query_chunks_by_time<S: ByteSource>(
&mut self,
reader: &mut CopcStreamingReader<S>,
start: GpsTime,
end: GpsTime,
fields: Fields,
) -> Result<Vec<(Chunk, Range<u32>)>, TemporalError>
pub async fn query_chunks_by_time<S: ByteSource>( &mut self, reader: &mut CopcStreamingReader<S>, start: GpsTime, end: GpsTime, fields: Fields, ) -> Result<Vec<(Chunk, Range<u32>)>, TemporalError>
Query chunks by time range only (no spatial filtering).
Like query_chunks but loads the full
hierarchy and skips the bounding-box intersection test. Returns
every chunk whose node temporal range overlaps [start, end],
each paired with its candidate index range.
Sourcepub async fn query_points<S: ByteSource>(
&mut self,
reader: &mut CopcStreamingReader<S>,
bounds: &Aabb,
start: GpsTime,
end: GpsTime,
) -> Result<Vec<Point>, TemporalError>
pub async fn query_points<S: ByteSource>( &mut self, reader: &mut CopcStreamingReader<S>, bounds: &Aabb, start: GpsTime, end: GpsTime, ) -> Result<Vec<Point>, TemporalError>
Query points by time range and spatial bounds.
Loads the relevant hierarchy and temporal pages, fetches matching chunks, and returns only the points that fall inside both the time window and the bounding box.
Thin wrapper over query_chunks with
Fields::ALL. Prefer query_chunks when you don’t need every
field materialized as las::Point values.
let points = temporal.query_points(
&mut reader, &query_box, start, end,
).await?;Sourcepub async fn query_points_by_time<S: ByteSource>(
&mut self,
reader: &mut CopcStreamingReader<S>,
start: GpsTime,
end: GpsTime,
) -> Result<Vec<Point>, TemporalError>
pub async fn query_points_by_time<S: ByteSource>( &mut self, reader: &mut CopcStreamingReader<S>, start: GpsTime, end: GpsTime, ) -> Result<Vec<Point>, TemporalError>
Query points by time range only (no spatial filtering).
Loads all hierarchy pages and temporal pages that overlap the time range, then returns points within the time window.
Thin wrapper over query_chunks_by_time
with Fields::ALL.