5
5
use itertools:: Itertools as _;
6
6
7
7
use re_data_store:: { DataStore , LatestAtQuery } ;
8
- use re_log_types:: { build_frame_nr, DataRow , EntityPath , RowId , TimePoint } ;
9
- use re_query_cache:: query_archetype_pov1_comp1;
10
- use re_types:: {
11
- archetypes:: Points2D ,
12
- components:: { Color , InstanceKey , Position2D } ,
8
+ use re_log_types:: {
9
+ build_frame_nr,
10
+ example_components:: { MyColor , MyPoint , MyPoints } ,
11
+ DataRow , EntityPath , RowId , TimePoint ,
13
12
} ;
14
- use re_types_core:: Loggable as _;
13
+ use re_query_cache:: query_archetype_pov1_comp1;
14
+ use re_types_core:: { components:: InstanceKey , Loggable as _} ;
15
15
16
16
// ---
17
17
@@ -27,13 +27,13 @@ fn simple_query() {
27
27
let timepoint = [ build_frame_nr ( 123 . into ( ) ) ] ;
28
28
29
29
// Create some positions with implicit instances
30
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
30
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
31
31
let row = DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timepoint, 2 , positions) . unwrap ( ) ;
32
32
store. insert_row ( & row) . unwrap ( ) ;
33
33
34
34
// Assign one of them a color with an explicit instance
35
35
let color_instances = vec ! [ InstanceKey ( 1 ) ] ;
36
- let colors = vec ! [ Color :: from_rgb( 255 , 0 , 0 ) ] ;
36
+ let colors = vec ! [ MyColor :: from_rgb( 255 , 0 , 0 ) ] ;
37
37
let row = DataRow :: from_cells2_sized (
38
38
RowId :: new ( ) ,
39
39
ent_path,
@@ -44,7 +44,6 @@ fn simple_query() {
44
44
. unwrap ( ) ;
45
45
store. insert_row ( & row) . unwrap ( ) ;
46
46
47
- // Retrieve the view
48
47
let query = re_data_store:: LatestAtQuery :: new ( timepoint[ 0 ] . 0 , timepoint[ 0 ] . 1 ) ;
49
48
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
50
49
}
@@ -61,18 +60,17 @@ fn timeless_query() {
61
60
let timepoint = [ build_frame_nr ( 123 . into ( ) ) ] ;
62
61
63
62
// Create some positions with implicit instances
64
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
63
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
65
64
let row = DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timepoint, 2 , positions) . unwrap ( ) ;
66
65
store. insert_row ( & row) . unwrap ( ) ;
67
66
68
67
// Assign one of them a color with an explicit instance.. timelessly!
69
68
let color_instances = vec ! [ InstanceKey ( 1 ) ] ;
70
- let colors = vec ! [ Color :: from_rgb( 255 , 0 , 0 ) ] ;
69
+ let colors = vec ! [ MyColor :: from_rgb( 255 , 0 , 0 ) ] ;
71
70
let row = DataRow :: from_cells2_sized ( RowId :: new ( ) , ent_path, [ ] , 1 , ( color_instances, colors) )
72
71
. unwrap ( ) ;
73
72
store. insert_row ( & row) . unwrap ( ) ;
74
73
75
- // Retrieve the view
76
74
let query = re_data_store:: LatestAtQuery :: new ( timepoint[ 0 ] . 0 , timepoint[ 0 ] . 1 ) ;
77
75
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
78
76
}
@@ -89,16 +87,15 @@ fn no_instance_join_query() {
89
87
let timepoint = [ build_frame_nr ( 123 . into ( ) ) ] ;
90
88
91
89
// Create some positions with an implicit instance
92
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
90
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
93
91
let row = DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timepoint, 2 , positions) . unwrap ( ) ;
94
92
store. insert_row ( & row) . unwrap ( ) ;
95
93
96
94
// Assign them colors with explicit instances
97
- let colors = vec ! [ Color :: from_rgb( 255 , 0 , 0 ) , Color :: from_rgb( 0 , 255 , 0 ) ] ;
95
+ let colors = vec ! [ MyColor :: from_rgb( 255 , 0 , 0 ) , MyColor :: from_rgb( 0 , 255 , 0 ) ] ;
98
96
let row = DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timepoint, 2 , colors) . unwrap ( ) ;
99
97
store. insert_row ( & row) . unwrap ( ) ;
100
98
101
- // Retrieve the view
102
99
let query = re_data_store:: LatestAtQuery :: new ( timepoint[ 0 ] . 0 , timepoint[ 0 ] . 1 ) ;
103
100
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
104
101
}
@@ -115,11 +112,10 @@ fn missing_column_join_query() {
115
112
let timepoint = [ build_frame_nr ( 123 . into ( ) ) ] ;
116
113
117
114
// Create some positions with an implicit instance
118
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
115
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
119
116
let row = DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timepoint, 2 , positions) . unwrap ( ) ;
120
117
store. insert_row ( & row) . unwrap ( ) ;
121
118
122
- // Retrieve the view
123
119
let query = re_data_store:: LatestAtQuery :: new ( timepoint[ 0 ] . 0 , timepoint[ 0 ] . 1 ) ;
124
120
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
125
121
}
@@ -136,13 +132,13 @@ fn splatted_query() {
136
132
let timepoint = [ build_frame_nr ( 123 . into ( ) ) ] ;
137
133
138
134
// Create some positions with implicit instances
139
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
135
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
140
136
let row = DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timepoint, 2 , positions) . unwrap ( ) ;
141
137
store. insert_row ( & row) . unwrap ( ) ;
142
138
143
139
// Assign all of them a color via splat
144
140
let color_instances = vec ! [ InstanceKey :: SPLAT ] ;
145
- let colors = vec ! [ Color :: from_rgb( 255 , 0 , 0 ) ] ;
141
+ let colors = vec ! [ MyColor :: from_rgb( 255 , 0 , 0 ) ] ;
146
142
let row = DataRow :: from_cells2_sized (
147
143
RowId :: new ( ) ,
148
144
ent_path,
@@ -153,7 +149,6 @@ fn splatted_query() {
153
149
. unwrap ( ) ;
154
150
store. insert_row ( & row) . unwrap ( ) ;
155
151
156
- // Retrieve the view
157
152
let query = re_data_store:: LatestAtQuery :: new ( timepoint[ 0 ] . 0 , timepoint[ 0 ] . 1 ) ;
158
153
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
159
154
}
@@ -173,7 +168,7 @@ fn invalidation() {
173
168
) ;
174
169
175
170
// Create some positions with implicit instances
176
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
171
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
177
172
let row = DataRow :: from_cells1_sized (
178
173
RowId :: new ( ) ,
179
174
ent_path,
@@ -186,7 +181,7 @@ fn invalidation() {
186
181
187
182
// Assign one of them a color with an explicit instance
188
183
let color_instances = vec ! [ InstanceKey ( 1 ) ] ;
189
- let colors = vec ! [ Color :: from_rgb( 1 , 2 , 3 ) ] ;
184
+ let colors = vec ! [ MyColor :: from_rgb( 1 , 2 , 3 ) ] ;
190
185
let row = DataRow :: from_cells2_sized (
191
186
RowId :: new ( ) ,
192
187
ent_path,
@@ -202,7 +197,7 @@ fn invalidation() {
202
197
// --- Modify present ---
203
198
204
199
// Modify the PoV component
205
- let positions = vec ! [ Position2D :: new( 10.0 , 20.0 ) , Position2D :: new( 30.0 , 40.0 ) ] ;
200
+ let positions = vec ! [ MyPoint :: new( 10.0 , 20.0 ) , MyPoint :: new( 30.0 , 40.0 ) ] ;
206
201
let row = DataRow :: from_cells1_sized (
207
202
RowId :: new ( ) ,
208
203
ent_path,
@@ -216,7 +211,7 @@ fn invalidation() {
216
211
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
217
212
218
213
// Modify the optional component
219
- let colors = vec ! [ Color :: from_rgb( 4 , 5 , 6 ) , Color :: from_rgb( 7 , 8 , 9 ) ] ;
214
+ let colors = vec ! [ MyColor :: from_rgb( 4 , 5 , 6 ) , MyColor :: from_rgb( 7 , 8 , 9 ) ] ;
220
215
let row =
221
216
DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, present_data_timepoint, 2 , colors)
222
217
. unwrap ( ) ;
@@ -227,7 +222,7 @@ fn invalidation() {
227
222
// --- Modify past ---
228
223
229
224
// Modify the PoV component
230
- let positions = vec ! [ Position2D :: new( 100.0 , 200.0 ) , Position2D :: new( 300.0 , 400.0 ) ] ;
225
+ let positions = vec ! [ MyPoint :: new( 100.0 , 200.0 ) , MyPoint :: new( 300.0 , 400.0 ) ] ;
231
226
let row = DataRow :: from_cells1_sized (
232
227
RowId :: new ( ) ,
233
228
ent_path,
@@ -241,7 +236,7 @@ fn invalidation() {
241
236
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
242
237
243
238
// Modify the optional component
244
- let colors = vec ! [ Color :: from_rgb( 10 , 11 , 12 ) , Color :: from_rgb( 13 , 14 , 15 ) ] ;
239
+ let colors = vec ! [ MyColor :: from_rgb( 10 , 11 , 12 ) , MyColor :: from_rgb( 13 , 14 , 15 ) ] ;
245
240
let row =
246
241
DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, past_data_timepoint, 2 , colors)
247
242
. unwrap ( ) ;
@@ -252,10 +247,7 @@ fn invalidation() {
252
247
// --- Modify future ---
253
248
254
249
// Modify the PoV component
255
- let positions = vec ! [
256
- Position2D :: new( 1000.0 , 2000.0 ) ,
257
- Position2D :: new( 3000.0 , 4000.0 ) ,
258
- ] ;
250
+ let positions = vec ! [ MyPoint :: new( 1000.0 , 2000.0 ) , MyPoint :: new( 3000.0 , 4000.0 ) ] ;
259
251
let row = DataRow :: from_cells1_sized (
260
252
RowId :: new ( ) ,
261
253
ent_path,
@@ -269,7 +261,7 @@ fn invalidation() {
269
261
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
270
262
271
263
// Modify the optional component
272
- let colors = vec ! [ Color :: from_rgb( 16 , 17 , 18 ) ] ;
264
+ let colors = vec ! [ MyColor :: from_rgb( 16 , 17 , 18 ) ] ;
273
265
let row =
274
266
DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, future_data_timepoint, 1 , colors)
275
267
. unwrap ( ) ;
@@ -312,19 +304,19 @@ fn invalidation() {
312
304
// # Expected: points=[[1,2,3]] colors=[]
313
305
//
314
306
// rr.set_time(2)
315
- // rr.log_components("points", rr.components.Color (0xFF0000))
307
+ // rr.log_components("points", rr.components.MyColor (0xFF0000))
316
308
//
317
309
// # Do second query here: LatestAt(+inf)
318
310
// # Expected: points=[[1,2,3]] colors=[0xFF0000]
319
311
//
320
312
// rr.set_time(3)
321
- // rr.log_components("points", rr.components.Color (0x0000FF))
313
+ // rr.log_components("points", rr.components.MyColor (0x0000FF))
322
314
//
323
315
// # Do third query here: LatestAt(+inf)
324
316
// # Expected: points=[[1,2,3]] colors=[0x0000FF]
325
317
//
326
318
// rr.set_time(3)
327
- // rr.log_components("points", rr.components.Color (0x00FF00))
319
+ // rr.log_components("points", rr.components.MyColor (0x00FF00))
328
320
//
329
321
// # Do fourth query here: LatestAt(+inf)
330
322
// # Expected: points=[[1,2,3]] colors=[0x00FF00]
@@ -345,15 +337,15 @@ fn invalidation_of_future_optionals() {
345
337
346
338
let query_time = [ build_frame_nr ( 9999 . into ( ) ) ] ;
347
339
348
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
340
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
349
341
let row = DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timeless, 2 , positions) . unwrap ( ) ;
350
342
store. insert_row ( & row) . unwrap ( ) ;
351
343
352
344
let query = re_data_store:: LatestAtQuery :: new ( query_time[ 0 ] . 0 , query_time[ 0 ] . 1 ) ;
353
345
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
354
346
355
347
let color_instances = vec ! [ InstanceKey :: SPLAT ] ;
356
- let colors = vec ! [ Color :: from_rgb( 255 , 0 , 0 ) ] ;
348
+ let colors = vec ! [ MyColor :: from_rgb( 255 , 0 , 0 ) ] ;
357
349
let row =
358
350
DataRow :: from_cells2_sized ( RowId :: new ( ) , ent_path, frame2, 1 , ( color_instances, colors) )
359
351
. unwrap ( ) ;
@@ -363,7 +355,7 @@ fn invalidation_of_future_optionals() {
363
355
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
364
356
365
357
let color_instances = vec ! [ InstanceKey :: SPLAT ] ;
366
- let colors = vec ! [ Color :: from_rgb( 0 , 0 , 255 ) ] ;
358
+ let colors = vec ! [ MyColor :: from_rgb( 0 , 0 , 255 ) ] ;
367
359
let row =
368
360
DataRow :: from_cells2_sized ( RowId :: new ( ) , ent_path, frame3, 1 , ( color_instances, colors) )
369
361
. unwrap ( ) ;
@@ -373,7 +365,7 @@ fn invalidation_of_future_optionals() {
373
365
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
374
366
375
367
let color_instances = vec ! [ InstanceKey :: SPLAT ] ;
376
- let colors = vec ! [ Color :: from_rgb( 0 , 255 , 0 ) ] ;
368
+ let colors = vec ! [ MyColor :: from_rgb( 0 , 255 , 0 ) ] ;
377
369
let row =
378
370
DataRow :: from_cells2_sized ( RowId :: new ( ) , ent_path, frame3, 1 , ( color_instances, colors) )
379
371
. unwrap ( ) ;
@@ -397,7 +389,7 @@ fn invalidation_timeless() {
397
389
398
390
let query_time = [ build_frame_nr ( 9999 . into ( ) ) ] ;
399
391
400
- let positions = vec ! [ Position2D :: new( 1.0 , 2.0 ) , Position2D :: new( 3.0 , 4.0 ) ] ;
392
+ let positions = vec ! [ MyPoint :: new( 1.0 , 2.0 ) , MyPoint :: new( 3.0 , 4.0 ) ] ;
401
393
let row =
402
394
DataRow :: from_cells1_sized ( RowId :: new ( ) , ent_path, timeless. clone ( ) , 2 , positions) . unwrap ( ) ;
403
395
store. insert_row ( & row) . unwrap ( ) ;
@@ -406,7 +398,7 @@ fn invalidation_timeless() {
406
398
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
407
399
408
400
let color_instances = vec ! [ InstanceKey :: SPLAT ] ;
409
- let colors = vec ! [ Color :: from_rgb( 255 , 0 , 0 ) ] ;
401
+ let colors = vec ! [ MyColor :: from_rgb( 255 , 0 , 0 ) ] ;
410
402
let row = DataRow :: from_cells2_sized (
411
403
RowId :: new ( ) ,
412
404
ent_path,
@@ -421,7 +413,7 @@ fn invalidation_timeless() {
421
413
query_and_compare ( & store, & query, & ent_path. into ( ) ) ;
422
414
423
415
let color_instances = vec ! [ InstanceKey :: SPLAT ] ;
424
- let colors = vec ! [ Color :: from_rgb( 0 , 0 , 255 ) ] ;
416
+ let colors = vec ! [ MyColor :: from_rgb( 0 , 0 , 255 ) ] ;
425
417
let row = DataRow :: from_cells2_sized (
426
418
RowId :: new ( ) ,
427
419
ent_path,
@@ -444,7 +436,7 @@ fn query_and_compare(store: &DataStore, query: &LatestAtQuery, ent_path: &Entity
444
436
let mut uncached_instance_keys = Vec :: new ( ) ;
445
437
let mut uncached_positions = Vec :: new ( ) ;
446
438
let mut uncached_colors = Vec :: new ( ) ;
447
- query_archetype_pov1_comp1 :: < Points2D , Position2D , Color , _ > (
439
+ query_archetype_pov1_comp1 :: < MyPoints , MyPoint , MyColor , _ > (
448
440
false , // cached?
449
441
store,
450
442
& query. clone ( ) . into ( ) ,
@@ -462,7 +454,7 @@ fn query_and_compare(store: &DataStore, query: &LatestAtQuery, ent_path: &Entity
462
454
let mut cached_instance_keys = Vec :: new ( ) ;
463
455
let mut cached_positions = Vec :: new ( ) ;
464
456
let mut cached_colors = Vec :: new ( ) ;
465
- query_archetype_pov1_comp1 :: < Points2D , Position2D , Color , _ > (
457
+ query_archetype_pov1_comp1 :: < MyPoints , MyPoint , MyColor , _ > (
466
458
true , // cached?
467
459
store,
468
460
& query. clone ( ) . into ( ) ,
@@ -477,14 +469,14 @@ fn query_and_compare(store: &DataStore, query: &LatestAtQuery, ent_path: &Entity
477
469
. unwrap ( ) ;
478
470
479
471
let ( expected_data_time, expected) =
480
- re_query:: query_archetype :: < Points2D > ( store, query, ent_path) . unwrap ( ) ;
472
+ re_query:: query_archetype :: < MyPoints > ( store, query, ent_path) . unwrap ( ) ;
481
473
let expected_instance_keys = expected. iter_instance_keys ( ) . collect_vec ( ) ;
482
474
let expected_positions = expected
483
- . iter_required_component :: < Position2D > ( )
475
+ . iter_required_component :: < MyPoint > ( )
484
476
. unwrap ( )
485
477
. collect_vec ( ) ;
486
478
let expected_colors = expected
487
- . iter_optional_component :: < Color > ( )
479
+ . iter_optional_component :: < MyColor > ( )
488
480
. unwrap ( )
489
481
. collect_vec ( ) ;
490
482
0 commit comments