re_view/
annotation_scene_context.rs1use std::sync::Arc;
2
3use re_viewer_context::{
4 AnnotationMap, IdentifiedViewSystem, ViewContextSystem, ViewContextSystemOncePerFrameResult,
5 ViewSystemIdentifier,
6};
7
8#[derive(Default)]
9pub struct AnnotationSceneContext(pub Arc<AnnotationMap>);
10
11impl IdentifiedViewSystem for AnnotationSceneContext {
12 fn identifier() -> ViewSystemIdentifier {
13 "AnnotationSceneContext".into()
14 }
15}
16
17impl ViewContextSystem for AnnotationSceneContext {
18 fn execute_once_per_frame(
19 ctx: &re_viewer_context::ViewerContext<'_>,
20 ) -> ViewContextSystemOncePerFrameResult {
21 let mut annotation_map = AnnotationMap::default();
25 annotation_map.load(ctx.recording(), &ctx.current_query());
26
27 Box::new(Self(Arc::new(annotation_map)))
28 }
29
30 fn execute(
31 &mut self,
32 _ctx: &re_viewer_context::ViewContext<'_>,
33 _missing_chunk_reporter: &re_viewer_context::MissingChunkReporter,
34 _query: &re_viewer_context::ViewQuery<'_>,
35 once_per_frame_result: &ViewContextSystemOncePerFrameResult,
36 ) {
37 self.0 = once_per_frame_result
39 .downcast_ref::<Self>()
40 .expect("Unexpected static execution result type")
41 .0
42 .clone();
43 }
44}