Skip to content

Commit

Permalink
no need to track time range anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Apr 23, 2024
1 parent 49225af commit 9db9a99
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
17 changes: 8 additions & 9 deletions crates/re_space_view_text_log/src/visualizer_system.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use re_data_store::{RangeQuery, TimeRange};
use re_data_store::TimeRange;
use re_entity_db::EntityPath;
use re_log_types::{RowId, TimeInt};
use re_query_cache2::{clamped_zip_1x2, range_zip_1x2, CachedRangeData, PromiseResult};
Expand Down Expand Up @@ -74,22 +74,22 @@ impl VisualizerSystem for TextLogSystem {
};
all_bodies.to_dense::<Text>(resolver)
};
check_range(&query, &all_bodies)?;
check_range(&all_bodies)?;

let all_levels = results
.get_or_empty(TextLogLevel::name())
.to_dense::<TextLogLevel>(resolver);
check_range(&query, &all_levels)?;
check_range(&all_levels)?;

let all_colors = results
.get_or_empty(Color::name())
.to_dense::<Color>(resolver);
check_range(&query, &all_colors)?;
check_range(&all_colors)?;

let all_frames = range_zip_1x2(
all_bodies.range_indexed(query.range()),
all_levels.range_indexed(query.range()),
all_colors.range_indexed(query.range()),
all_bodies.range_indexed(),
all_levels.range_indexed(),
all_colors.range_indexed(),
);

for (&(data_time, row_id), bodies, levels, colors) in all_frames {
Expand Down Expand Up @@ -132,10 +132,9 @@ impl VisualizerSystem for TextLogSystem {
// TODO(#5607): what should happen if the promise is still pending?
#[inline]
fn check_range<'a, C: Component>(
query: &RangeQuery,
results: &'a CachedRangeData<'a, C>,
) -> re_query_cache2::Result<()> {
let (front_status, back_status) = results.status(query.range());
let (front_status, back_status) = results.status();
match front_status {
PromiseResult::Pending => return Ok(()),
PromiseResult::Error(err) => return Err(re_query_cache2::QueryError::Other(err.into())),
Expand Down
18 changes: 8 additions & 10 deletions crates/re_space_view_time_series/src/line_visualizer_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ fn load_series(
let all_scalars = results
.get_required(Scalar::name())?
.to_dense::<Scalar>(resolver);
let all_scalars_entry_range = all_scalars.entry_range(query.range());
let all_scalars_entry_range = all_scalars.entry_range();

if !matches!(
all_scalars.status(query.range()),
all_scalars.status(),
(PromiseResult::Ready(()), PromiseResult::Ready(()))
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand Down Expand Up @@ -250,7 +250,7 @@ fn load_series(
let all_colors = all_colors.to_dense::<Color>(resolver);

if !matches!(
all_colors.status(query.range()),
all_colors.status(),
(PromiseResult::Ready(()), PromiseResult::Ready(()))
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand All @@ -260,11 +260,9 @@ fn load_series(
.range_indices(all_scalars_entry_range.clone())
.map(|index| (index, ()));

let all_frames = re_query_cache2::range_zip_1x1(
all_scalars_indexed,
all_colors.range_indexed(query.range()),
)
.enumerate();
let all_frames =
re_query_cache2::range_zip_1x1(all_scalars_indexed, all_colors.range_indexed())
.enumerate();

for (i, (_index, _scalars, colors)) in all_frames {
if let Some(color) = colors.and_then(|colors| {
Expand All @@ -290,7 +288,7 @@ fn load_series(
let all_stroke_widths = all_stroke_widths.to_dense::<StrokeWidth>(resolver);

if !matches!(
all_stroke_widths.status(query.range()),
all_stroke_widths.status(),
(PromiseResult::Ready(()), PromiseResult::Ready(()))
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand All @@ -302,7 +300,7 @@ fn load_series(

let all_frames = re_query_cache2::range_zip_1x1(
all_scalars_indexed,
all_stroke_widths.range_indexed(query.range()),
all_stroke_widths.range_indexed(),
)
.enumerate();

Expand Down
16 changes: 8 additions & 8 deletions crates/re_space_view_time_series/src/point_visualizer_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ impl SeriesPointSystem {
let all_scalars = results
.get_required(Scalar::name())?
.to_dense::<Scalar>(resolver);
let all_scalars_entry_range = all_scalars.entry_range(query.range());
let all_scalars_entry_range = all_scalars.entry_range();

if !matches!(
all_scalars.status(query.range()),
all_scalars.status(),
(PromiseResult::Ready(()), PromiseResult::Ready(()))
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand Down Expand Up @@ -205,7 +205,7 @@ impl SeriesPointSystem {
let all_colors = all_colors.to_dense::<Color>(resolver);

if !matches!(
all_colors.status(query.range()),
all_colors.status(),
(PromiseResult::Ready(()), PromiseResult::Ready(()))
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand All @@ -217,7 +217,7 @@ impl SeriesPointSystem {

let all_frames = re_query_cache2::range_zip_1x1(
all_scalars_indexed,
all_colors.range_indexed(query.range()),
all_colors.range_indexed(),
)
.enumerate();

Expand Down Expand Up @@ -245,7 +245,7 @@ impl SeriesPointSystem {
let all_marker_sizes = all_marker_sizes.to_dense::<MarkerSize>(resolver);

if !matches!(
all_marker_sizes.status(query.range()),
all_marker_sizes.status(),
(PromiseResult::Ready(()), PromiseResult::Ready(()))
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand All @@ -257,7 +257,7 @@ impl SeriesPointSystem {

let all_frames = re_query_cache2::range_zip_1x1(
all_scalars_indexed,
all_marker_sizes.range_indexed(query.range()),
all_marker_sizes.range_indexed(),
)
.enumerate();

Expand All @@ -277,7 +277,7 @@ impl SeriesPointSystem {
let all_marker_shapes = all_marker_shapes.to_dense::<MarkerShape>(resolver);

if !matches!(
all_marker_shapes.status(query.range()),
all_marker_shapes.status(),
(PromiseResult::Ready(()), PromiseResult::Ready(()))
) {
// TODO(#5607): what should happen if the promise is still pending?
Expand All @@ -289,7 +289,7 @@ impl SeriesPointSystem {

let all_frames = re_query_cache2::range_zip_1x1(
all_scalars_indexed,
all_marker_shapes.range_indexed(query.range()),
all_marker_shapes.range_indexed(),
)
.enumerate();

Expand Down

0 comments on commit 9db9a99

Please sign in to comment.