1
+ use itertools:: izip;
1
2
use re_chunk_store:: ResolvedTimeRange ;
2
3
use re_chunk_store:: RowId ;
3
4
use re_entity_db:: EntityPath ;
4
5
use re_log_types:: TimeInt ;
5
- use re_query:: { clamped_zip_1x2, range_zip_1x2} ;
6
- use re_space_view:: { range_with_blueprint_resolved_data, RangeResultsExt } ;
6
+ use re_log_types:: TimePoint ;
7
+ use re_query2:: { clamped_zip_1x2, range_zip_1x2} ;
8
+ use re_space_view:: { range_with_blueprint_resolved_data2, RangeResultsExt2 } ;
7
9
use re_types:: {
8
10
archetypes:: TextLog ,
9
11
components:: { Color , Text , TextLogLevel } ,
@@ -19,6 +21,7 @@ pub struct Entry {
19
21
pub row_id : RowId ,
20
22
pub entity_path : EntityPath ,
21
23
pub time : TimeInt ,
24
+ pub timepoint : TimePoint ,
22
25
pub color : Option < Color > ,
23
26
pub body : Text ,
24
27
pub level : Option < TextLogLevel > ,
@@ -53,13 +56,7 @@ impl VisualizerSystem for TextLogSystem {
53
56
re_chunk_store:: RangeQuery :: new ( view_query. timeline , ResolvedTimeRange :: EVERYTHING ) ;
54
57
55
58
for data_result in view_query. iter_visible_data_results ( ctx, Self :: identifier ( ) ) {
56
- if let Err ( err) = self . process_entity ( ctx, & query, data_result) {
57
- re_log:: error_once!(
58
- "Error visualizing text logs for {:?}: {:?}" ,
59
- data_result. entity_path,
60
- err
61
- ) ;
62
- }
59
+ self . process_entity ( ctx, & query, data_result) ;
63
60
}
64
61
65
62
{
@@ -86,36 +83,49 @@ impl TextLogSystem {
86
83
ctx : & ViewContext < ' _ > ,
87
84
query : & re_chunk_store:: RangeQuery ,
88
85
data_result : & re_viewer_context:: DataResult ,
89
- ) -> Result < ( ) , SpaceViewSystemExecutionError > {
86
+ ) {
90
87
re_tracing:: profile_function!( ) ;
91
- let resolver = ctx. recording ( ) . resolver ( ) ;
92
88
93
- let results = range_with_blueprint_resolved_data (
89
+ let results = range_with_blueprint_resolved_data2 (
94
90
ctx,
95
91
None ,
96
92
query,
97
93
data_result,
98
94
[ Text :: name ( ) , TextLogLevel :: name ( ) , Color :: name ( ) ] ,
99
95
) ;
100
96
101
- let Some ( all_texts) = results
102
- . get_required_component_dense :: < Text > ( resolver)
103
- . transpose ( ) ?
104
- else {
105
- return Ok ( ( ) ) ;
97
+ let Some ( all_text_chunks) = results. get_required_chunks ( & Text :: name ( ) ) else {
98
+ return ;
106
99
} ;
107
100
108
- let all_levels = results. get_or_empty_dense :: < TextLogLevel > ( resolver) ?;
109
- let all_colors = results. get_or_empty_dense :: < Color > ( resolver) ?;
101
+ // TODO(cmc): It would be more efficient (both space and compute) to do this lazily as
102
+ // we're rendering the table by indexing back into the original chunk etc.
103
+ // Let's keep it simple for now, until we have data suggested we need the extra perf.
104
+ let all_timepoints = all_text_chunks
105
+ . iter ( )
106
+ . flat_map ( |chunk| chunk. iter_component_timepoints ( & Text :: name ( ) ) ) ;
107
+
108
+ let timeline = query. timeline ( ) ;
109
+ let all_texts = results. iter_as ( timeline, Text :: name ( ) ) ;
110
+ let all_levels = results. iter_as ( timeline, TextLogLevel :: name ( ) ) ;
111
+ let all_colors = results. iter_as ( timeline, Color :: name ( ) ) ;
112
+
110
113
let all_frames = range_zip_1x2 (
111
- all_texts. range_indexed ( ) ,
112
- all_levels. range_indexed ( ) ,
113
- all_colors. range_indexed ( ) ,
114
+ all_texts. string ( ) ,
115
+ all_levels. component ( ) ,
116
+ all_colors. primitive :: < u32 > ( ) ,
114
117
) ;
115
118
116
- for ( & ( data_time, row_id) , bodies, levels, colors) in all_frames {
117
- let levels = levels. unwrap_or ( & [ ] ) . iter ( ) . cloned ( ) . map ( Some ) ;
118
- let colors = colors. unwrap_or ( & [ ] ) . iter ( ) . copied ( ) . map ( Some ) ;
119
+ let all_frames = izip ! ( all_timepoints, all_frames) ;
120
+
121
+ for ( timepoint, ( ( data_time, row_id) , bodies, levels, colors) ) in all_frames {
122
+ let levels = levels. as_deref ( ) . unwrap_or ( & [ ] ) . iter ( ) . cloned ( ) . map ( Some ) ;
123
+ let colors = colors
124
+ . unwrap_or ( & [ ] )
125
+ . iter ( )
126
+ . copied ( )
127
+ . map ( Into :: into)
128
+ . map ( Some ) ;
119
129
120
130
let level_default_fn = || None ;
121
131
let color_default_fn = || None ;
@@ -128,14 +138,13 @@ impl TextLogSystem {
128
138
row_id,
129
139
entity_path : data_result. entity_path . clone ( ) ,
130
140
time : data_time,
141
+ timepoint : timepoint. clone ( ) ,
131
142
color,
132
- body : text. clone ( ) ,
143
+ body : text. clone ( ) . into ( ) ,
133
144
level,
134
145
} ) ;
135
146
}
136
147
}
137
-
138
- Ok ( ( ) )
139
148
}
140
149
}
141
150
0 commit comments