From 56c3963a84f68d72cdbaed8151b018d48e206035 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Fri, 19 Apr 2024 11:33:07 +0200 Subject: [PATCH] no need to track time range anymore --- .../src/visualizers/arrows2d.rs | 30 ++++++++-------- .../src/visualizers/arrows3d.rs | 30 ++++++++-------- .../src/visualizers/boxes2d.rs | 30 ++++++++-------- .../src/visualizers/boxes3d.rs | 34 +++++++++---------- .../src/visualizers/lines2d.rs | 28 +++++++-------- .../src/visualizers/lines3d.rs | 28 +++++++-------- .../src/visualizers/points2d.rs | 26 +++++++------- .../src/visualizers/points3d.rs | 26 +++++++------- .../src/visualizers/results_ext.rs | 9 ++--- 9 files changed, 118 insertions(+), 123 deletions(-) diff --git a/crates/re_space_view_spatial/src/visualizers/arrows2d.rs b/crates/re_space_view_spatial/src/visualizers/arrows2d.rs index fe5ae78e63506..a93b9e67ec825 100644 --- a/crates/re_space_view_spatial/src/visualizers/arrows2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/arrows2d.rs @@ -268,14 +268,14 @@ impl VisualizerSystem for Arrows2DVisualizer { let resolver = ctx.recording().resolver(); - let vectors = match results.get_dense::(resolver, _query) { + let vectors = match results.get_dense::(resolver) { Some(Ok(vectors)) => vectors, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_vectors = vectors - .range_indexed(_query.range()) + .range_indexed() .map(|(_, vectors)| vectors.len()) .sum::(); if num_vectors == 0 { @@ -285,21 +285,21 @@ impl VisualizerSystem for Arrows2DVisualizer { line_builder.reserve_strips(num_vectors)?; line_builder.reserve_vertices(num_vectors * 2)?; - let origins = results.get_or_empty_dense(resolver, _query)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let origins = results.get_or_empty_dense(resolver)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x6( - vectors.range_indexed(_query.range()), - origins.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + vectors.range_indexed(), + origins.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |( diff --git a/crates/re_space_view_spatial/src/visualizers/arrows3d.rs b/crates/re_space_view_spatial/src/visualizers/arrows3d.rs index afbc075fd86d2..e884f4afc9438 100644 --- a/crates/re_space_view_spatial/src/visualizers/arrows3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/arrows3d.rs @@ -271,14 +271,14 @@ impl VisualizerSystem for Arrows3DVisualizer { let resolver = ctx.recording().resolver(); - let vectors = match results.get_dense::(resolver, _query) { + let vectors = match results.get_dense::(resolver) { Some(Ok(vectors)) => vectors, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_vectors = vectors - .range_indexed(_query.range()) + .range_indexed() .map(|(_, vectors)| vectors.len()) .sum::(); if num_vectors == 0 { @@ -288,21 +288,21 @@ impl VisualizerSystem for Arrows3DVisualizer { line_builder.reserve_strips(num_vectors)?; line_builder.reserve_vertices(num_vectors * 2)?; - let origins = results.get_or_empty_dense(resolver, _query)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let origins = results.get_or_empty_dense(resolver)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x6( - vectors.range_indexed(_query.range()), - origins.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + vectors.range_indexed(), + origins.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |( diff --git a/crates/re_space_view_spatial/src/visualizers/boxes2d.rs b/crates/re_space_view_spatial/src/visualizers/boxes2d.rs index 24296e5f725df..c34521f3ab1df 100644 --- a/crates/re_space_view_spatial/src/visualizers/boxes2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/boxes2d.rs @@ -265,14 +265,14 @@ impl VisualizerSystem for Boxes2DVisualizer { let resolver = ctx.recording().resolver(); - let half_sizes = match results.get_dense::(resolver, _query) { + let half_sizes = match results.get_dense::(resolver) { Some(Ok(vectors)) => vectors, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_boxes = half_sizes - .range_indexed(_query.range()) + .range_indexed() .map(|(_, vectors)| vectors.len()) .sum::(); if num_boxes == 0 { @@ -283,21 +283,21 @@ impl VisualizerSystem for Boxes2DVisualizer { line_builder.reserve_strips(num_boxes * 4)?; line_builder.reserve_vertices(num_boxes * 4 * 2)?; - let centers = results.get_or_empty_dense(resolver, _query)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let centers = results.get_or_empty_dense(resolver)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x6( - half_sizes.range_indexed(_query.range()), - centers.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + half_sizes.range_indexed(), + centers.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |( diff --git a/crates/re_space_view_spatial/src/visualizers/boxes3d.rs b/crates/re_space_view_spatial/src/visualizers/boxes3d.rs index 9b07651d3e0d8..9162f8edc1a94 100644 --- a/crates/re_space_view_spatial/src/visualizers/boxes3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/boxes3d.rs @@ -257,14 +257,14 @@ impl VisualizerSystem for Boxes3DVisualizer { let resolver = ctx.recording().resolver(); - let half_sizes = match results.get_dense::(resolver, _query) { + let half_sizes = match results.get_dense::(resolver) { Some(Ok(vectors)) => vectors, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_boxes = half_sizes - .range_indexed(_query.range()) + .range_indexed() .map(|(_, vectors)| vectors.len()) .sum::(); if num_boxes == 0 { @@ -275,23 +275,23 @@ impl VisualizerSystem for Boxes3DVisualizer { line_builder.reserve_strips(num_boxes * 12)?; line_builder.reserve_vertices(num_boxes * 12 * 2)?; - let centers = results.get_or_empty_dense(resolver, _query)?; - let rotations = results.get_or_empty_dense(resolver, _query)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let centers = results.get_or_empty_dense(resolver)?; + let rotations = results.get_or_empty_dense(resolver)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x7( - half_sizes.range_indexed(_query.range()), - centers.range_indexed(_query.range()), - rotations.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + half_sizes.range_indexed(), + centers.range_indexed(), + rotations.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |( diff --git a/crates/re_space_view_spatial/src/visualizers/lines2d.rs b/crates/re_space_view_spatial/src/visualizers/lines2d.rs index 6ae116c7df3a9..a0ced702e8a6f 100644 --- a/crates/re_space_view_spatial/src/visualizers/lines2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/lines2d.rs @@ -254,14 +254,14 @@ impl VisualizerSystem for Lines2DVisualizer { let resolver = ctx.recording().resolver(); - let strips = match results.get_dense::(resolver, _query) { + let strips = match results.get_dense::(resolver) { Some(Ok(strips)) => strips, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_strips = strips - .range_indexed(_query.range()) + .range_indexed() .map(|(_, strips)| strips.len()) .sum::(); if num_strips == 0 { @@ -270,24 +270,24 @@ impl VisualizerSystem for Lines2DVisualizer { line_builder.reserve_strips(num_strips)?; let num_vertices = strips - .range_indexed(_query.range()) + .range_indexed() .map(|(_, strips)| strips.iter().map(|strip| strip.0.len()).sum::()) .sum::(); line_builder.reserve_vertices(num_vertices)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x5( - strips.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + strips.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |(_index, strips, colors, radii, labels, class_ids, keypoint_ids)| { diff --git a/crates/re_space_view_spatial/src/visualizers/lines3d.rs b/crates/re_space_view_spatial/src/visualizers/lines3d.rs index 075baa92d6962..877e80ce1509c 100644 --- a/crates/re_space_view_spatial/src/visualizers/lines3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/lines3d.rs @@ -263,14 +263,14 @@ impl VisualizerSystem for Lines3DVisualizer { let resolver = ctx.recording().resolver(); - let strips = match results.get_dense::(resolver, _query) { + let strips = match results.get_dense::(resolver) { Some(Ok(strips)) => strips, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_strips = strips - .range_indexed(_query.range()) + .range_indexed() .map(|(_, strips)| strips.len()) .sum::(); if num_strips == 0 { @@ -279,24 +279,24 @@ impl VisualizerSystem for Lines3DVisualizer { line_builder.reserve_strips(num_strips)?; let num_vertices = strips - .range_indexed(_query.range()) + .range_indexed() .map(|(_, strips)| strips.iter().map(|strip| strip.0.len()).sum::()) .sum::(); line_builder.reserve_vertices(num_vertices)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x5( - strips.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + strips.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |(_index, strips, colors, radii, labels, class_ids, keypoint_ids)| { diff --git a/crates/re_space_view_spatial/src/visualizers/points2d.rs b/crates/re_space_view_spatial/src/visualizers/points2d.rs index 4d6cdd26f9d87..c1b47970c3646 100644 --- a/crates/re_space_view_spatial/src/visualizers/points2d.rs +++ b/crates/re_space_view_spatial/src/visualizers/points2d.rs @@ -269,14 +269,14 @@ impl VisualizerSystem for Points2DVisualizer { let resolver = ctx.recording().resolver(); - let positions = match results.get_dense::(resolver, _query) { + let positions = match results.get_dense::(resolver) { Some(Ok(positions)) => positions, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_positions = positions - .range_indexed(_query.range()) + .range_indexed() .map(|(_, positions)| positions.len()) .sum::(); if num_positions == 0 { @@ -285,19 +285,19 @@ impl VisualizerSystem for Points2DVisualizer { point_builder.reserve(num_positions)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x5( - positions.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + positions.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |(_index, positions, colors, radii, labels, class_ids, keypoint_ids)| { diff --git a/crates/re_space_view_spatial/src/visualizers/points3d.rs b/crates/re_space_view_spatial/src/visualizers/points3d.rs index 1b1d2009f9bca..7c701bc60f6a9 100644 --- a/crates/re_space_view_spatial/src/visualizers/points3d.rs +++ b/crates/re_space_view_spatial/src/visualizers/points3d.rs @@ -260,14 +260,14 @@ impl VisualizerSystem for Points3DVisualizer { let resolver = ctx.recording().resolver(); - let positions = match results.get_dense::(resolver, _query) { + let positions = match results.get_dense::(resolver) { Some(Ok(positions)) => positions, Some(err @ Err(_)) => err?, _ => return Ok(()), }; let num_positions = positions - .range_indexed(_query.range()) + .range_indexed() .map(|(_, positions)| positions.len()) .sum::(); if num_positions == 0 { @@ -276,19 +276,19 @@ impl VisualizerSystem for Points3DVisualizer { point_builder.reserve(num_positions)?; - let colors = results.get_or_empty_dense(resolver, _query)?; - let radii = results.get_or_empty_dense(resolver, _query)?; - let labels = results.get_or_empty_dense(resolver, _query)?; - let class_ids = results.get_or_empty_dense(resolver, _query)?; - let keypoint_ids = results.get_or_empty_dense(resolver, _query)?; + let colors = results.get_or_empty_dense(resolver)?; + let radii = results.get_or_empty_dense(resolver)?; + let labels = results.get_or_empty_dense(resolver)?; + let class_ids = results.get_or_empty_dense(resolver)?; + let keypoint_ids = results.get_or_empty_dense(resolver)?; let data = range_zip_1x5( - positions.range_indexed(_query.range()), - colors.range_indexed(_query.range()), - radii.range_indexed(_query.range()), - labels.range_indexed(_query.range()), - class_ids.range_indexed(_query.range()), - keypoint_ids.range_indexed(_query.range()), + positions.range_indexed(), + colors.range_indexed(), + radii.range_indexed(), + labels.range_indexed(), + class_ids.range_indexed(), + keypoint_ids.range_indexed(), ) .map( |(_index, positions, colors, radii, labels, class_ids, keypoint_ids)| { diff --git a/crates/re_space_view_spatial/src/visualizers/results_ext.rs b/crates/re_space_view_spatial/src/visualizers/results_ext.rs index 377b8c34c0c04..7685372a6bd12 100644 --- a/crates/re_space_view_spatial/src/visualizers/results_ext.rs +++ b/crates/re_space_view_spatial/src/visualizers/results_ext.rs @@ -1,4 +1,3 @@ -use re_data_store::RangeQuery; use re_query_cache2::{ CachedLatestAtResults, CachedRangeData, CachedRangeResults, PromiseResolver, PromiseResult, }; @@ -52,13 +51,11 @@ pub trait CachedRangeResultsExt { fn get_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - query: &RangeQuery, ) -> Option>>; fn get_or_empty_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - query: &RangeQuery, ) -> re_query_cache2::Result>; } @@ -67,12 +64,11 @@ impl CachedRangeResultsExt for CachedRangeResults { fn get_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - query: &RangeQuery, ) -> Option>> { let results = self.get(C::name())?.to_dense(resolver); // TODO(#5607): what should happen if the promise is still pending? - let (front_status, back_status) = results.status(query.range()); + let (front_status, back_status) = results.status(); match front_status { PromiseResult::Error(err) => { return Some(Err(re_query_cache2::QueryError::Other(err.into()))) @@ -93,12 +89,11 @@ impl CachedRangeResultsExt for CachedRangeResults { fn get_or_empty_dense<'a, C: Component>( &'a self, resolver: &PromiseResolver, - query: &RangeQuery, ) -> re_query_cache2::Result> { let results = self.get_or_empty(C::name()).to_dense(resolver); // TODO(#5607): what should happen if the promise is still pending? - let (front_status, back_status) = results.status(query.range()); + let (front_status, back_status) = results.status(); match front_status { PromiseResult::Error(err) => { return Err(re_query_cache2::QueryError::Other(err.into()))