use re_types::{archetypes::AnnotationContext, Archetype, ComponentNameSet};
use re_viewer_context::{
AnnotationMap, IdentifiedViewSystem, ViewContextSystem, ViewSystemIdentifier,
};
#[derive(Default)]
pub struct AnnotationSceneContext(pub AnnotationMap);
impl IdentifiedViewSystem for AnnotationSceneContext {
fn identifier() -> ViewSystemIdentifier {
"AnnotationSceneContext".into()
}
}
impl ViewContextSystem for AnnotationSceneContext {
fn compatible_component_sets(&self) -> Vec<ComponentNameSet> {
vec![
AnnotationContext::required_components()
.iter()
.map(ToOwned::to_owned)
.collect(), ]
}
fn execute(
&mut self,
ctx: &re_viewer_context::ViewContext<'_>,
query: &re_viewer_context::ViewQuery<'_>,
) {
re_tracing::profile_function!();
self.0.load(
ctx.viewer_ctx,
&query.latest_at_query(),
query.iter_all_entities(),
);
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
}