pub trait VisualizerSystem: Send + Sync + 'static {
// Required methods
fn visualizer_query_info(&self) -> VisualizerQueryInfo;
fn execute(
&mut self,
ctx: &ViewContext<'_>,
query: &ViewQuery<'_>,
context_systems: &ViewContextCollection
) -> Result<Vec<QueueableDrawData>, SpaceViewSystemExecutionError>;
fn as_any(&self) -> &dyn Any;
fn fallback_provider(&self) -> &dyn ComponentFallbackProvider;
// Provided methods
fn filter_visualizable_entities(
&self,
entities: ApplicableEntities,
_context: &dyn VisualizableFilterContext
) -> VisualizableEntities { ... }
fn applicability_filter(
&self
) -> Option<Box<dyn VisualizerAdditionalApplicabilityFilter>> { ... }
fn data(&self) -> Option<&dyn Any> { ... }
}
Expand description
Element of a scene derived from a single archetype query.
Is populated after scene contexts and has access to them.
All visualizers are expected to be able to provide a fallback value for any component they’re using
via the ComponentFallbackProvider
trait.
Required Methods§
sourcefn visualizer_query_info(&self) -> VisualizerQueryInfo
fn visualizer_query_info(&self) -> VisualizerQueryInfo
Information about which components are queried by the visualizer.
sourcefn execute(
&mut self,
ctx: &ViewContext<'_>,
query: &ViewQuery<'_>,
context_systems: &ViewContextCollection
) -> Result<Vec<QueueableDrawData>, SpaceViewSystemExecutionError>
fn execute( &mut self, ctx: &ViewContext<'_>, query: &ViewQuery<'_>, context_systems: &ViewContextCollection ) -> Result<Vec<QueueableDrawData>, SpaceViewSystemExecutionError>
Queries the chunk store and performs data conversions to make it ready for display.
Mustn’t query any data outside of the archetype.
fn as_any(&self) -> &dyn Any
sourcefn fallback_provider(&self) -> &dyn ComponentFallbackProvider
fn fallback_provider(&self) -> &dyn ComponentFallbackProvider
Returns the fallback provider for this visualizer.
Visualizers should use this to report the fallback values they use when there is no data. The Rerun viewer will display these fallback values to the user to convey what the visualizer is doing.
Provided Methods§
sourcefn filter_visualizable_entities(
&self,
entities: ApplicableEntities,
_context: &dyn VisualizableFilterContext
) -> VisualizableEntities
fn filter_visualizable_entities( &self, entities: ApplicableEntities, _context: &dyn VisualizableFilterContext ) -> VisualizableEntities
Filters a set of applicable entities (entities that have all required components), into to a set of visualizable entities.
The context passed in here is generated by crate::SpaceViewClass::visualizable_filter_context
.
sourcefn applicability_filter(
&self
) -> Option<Box<dyn VisualizerAdditionalApplicabilityFilter>>
fn applicability_filter( &self ) -> Option<Box<dyn VisualizerAdditionalApplicabilityFilter>>
Additional filter for applicability.
If none is specified, applicability is solely determined by required components.
sourcefn data(&self) -> Option<&dyn Any>
fn data(&self) -> Option<&dyn Any>
Optionally retrieves a chunk store reference from the scene element.
This is useful for retrieving data that is common to several visualizers of a crate::SpaceViewClass
.
For example, if most visualizers produce ui elements, a concrete crate::SpaceViewClass
can pick those up in its crate::SpaceViewClass::ui
method by iterating over all visualizers.