Trait rerun::external::re_viewer_context::SpaceViewClass
source · pub trait SpaceViewClass: Send + Sync {
Show 17 methods
// Required methods
fn identifier() -> SpaceViewClassIdentifier
where Self: Sized;
fn display_name(&self) -> &'static str;
fn help_text(&self, re_ui: &ReUi) -> WidgetText;
fn on_register(
&self,
system_registry: &mut SpaceViewSystemRegistrator<'_>
) -> Result<(), SpaceViewClassRegistryError>;
fn new_state(&self) -> Box<dyn SpaceViewState>;
fn layout_priority(&self) -> SpaceViewClassLayoutPriority;
fn spawn_heuristics(
&self,
ctx: &ViewerContext<'_>
) -> SpaceViewSpawnHeuristics;
fn ui(
&self,
ctx: &ViewerContext<'_>,
ui: &mut Ui,
state: &mut (dyn SpaceViewState + 'static),
root_entity_properties: &EntityProperties,
query: &ViewQuery<'_>,
system_output: SystemExecutionOutput
) -> Result<(), SpaceViewSystemExecutionError>;
// Provided methods
fn icon(&self) -> &'static Icon { ... }
fn blueprint_archetype(&self) -> Option<Vec<ComponentName>> { ... }
fn preferred_tile_aspect_ratio(
&self,
_state: &(dyn SpaceViewState + 'static)
) -> Option<f32> { ... }
fn default_visible_time_range(&self) -> VisibleTimeRange { ... }
fn recommended_root_for_entities(
&self,
_entities: &HashSet<EntityPath, BuildHasherDefault<NoHashHasher<EntityPath>>>,
_entity_db: &EntityDb
) -> Option<EntityPath> { ... }
fn visualizable_filter_context(
&self,
_space_origin: &EntityPath,
_entity_db: &EntityDb
) -> Box<dyn VisualizableFilterContext> { ... }
fn choose_default_visualizers(
&self,
entity_path: &EntityPath,
visualizable_entities_per_visualizer: &PerVisualizer<VisualizableEntities>,
indicated_entities_per_visualizer: &PerVisualizer<IndicatedEntities>
) -> SmallVec<[ViewSystemIdentifier; 4]> { ... }
fn on_frame_start(
&self,
_ctx: &ViewerContext<'_>,
_state: &mut (dyn SpaceViewState + 'static),
_ent_paths: &BTreeMap<ViewSystemIdentifier, BTreeSet<EntityPath>>,
_entity_properties: &mut EntityPropertyMap
) { ... }
fn selection_ui(
&self,
_ctx: &ViewerContext<'_>,
_ui: &mut Ui,
_state: &mut (dyn SpaceViewState + 'static),
_space_origin: &EntityPath,
_space_view_id: BlueprintId<SpaceViewIdRegistry>,
_root_entity_properties: &mut EntityProperties
) -> Result<(), SpaceViewSystemExecutionError> { ... }
}
Expand description
Defines a class of space view without any concrete types making it suitable for storage and interfacing.
Each Space View in the viewer’s viewport has a single class assigned immutable at its creation time. The class defines all aspects of its behavior. It determines which entities are queried, how they are rendered, and how the user can interact with them.
TODO(andreas): Consider formulating a space view instance context object that is passed to all methods that operate on concrete space views as opposed to be about general information on the class.
Required Methods§
sourcefn identifier() -> SpaceViewClassIdentifierwhere
Self: Sized,
fn identifier() -> SpaceViewClassIdentifierwhere
Self: Sized,
Identifier string of this space view class.
By convention we use PascalCase
.
sourcefn display_name(&self) -> &'static str
fn display_name(&self) -> &'static str
User-facing name of this space view class.
Used for UI display.
sourcefn help_text(&self, re_ui: &ReUi) -> WidgetText
fn help_text(&self, re_ui: &ReUi) -> WidgetText
Help text describing how to interact with this space view in the ui.
sourcefn on_register(
&self,
system_registry: &mut SpaceViewSystemRegistrator<'_>
) -> Result<(), SpaceViewClassRegistryError>
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
Called once upon registration of the class
This can be used to register all built-in crate::ViewContextSystem
and crate::VisualizerSystem
.
sourcefn new_state(&self) -> Box<dyn SpaceViewState>
fn new_state(&self) -> Box<dyn SpaceViewState>
Called once for every new space view instance of this class.
The state is not persisted across viewer sessions, only shared frame-to-frame.
sourcefn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
Controls how likely this space view will get a large tile in the ui.
sourcefn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
Determines which space views should be spawned by default for this class.
sourcefn ui(
&self,
ctx: &ViewerContext<'_>,
ui: &mut Ui,
state: &mut (dyn SpaceViewState + 'static),
root_entity_properties: &EntityProperties,
query: &ViewQuery<'_>,
system_output: SystemExecutionOutput
) -> Result<(), SpaceViewSystemExecutionError>
fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), root_entity_properties: &EntityProperties, query: &ViewQuery<'_>, system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
Draws the ui for this space view class and handles ui events.
The passed state is kept frame-to-frame.
TODO(wumpf): Right now the ui methods control when and how to create re_renderer::ViewBuilder
s.
In the future, we likely want to move view builder handling to re_viewport
with
minimal configuration options exposed via crate::SpaceViewClass
.
Provided Methods§
sourcefn blueprint_archetype(&self) -> Option<Vec<ComponentName>>
fn blueprint_archetype(&self) -> Option<Vec<ComponentName>>
Optional archetype of the Space View’s blueprint properties.
Blueprint components that only apply to the space view itself, not to the entities it displays.
sourcefn preferred_tile_aspect_ratio(
&self,
_state: &(dyn SpaceViewState + 'static)
) -> Option<f32>
fn preferred_tile_aspect_ratio( &self, _state: &(dyn SpaceViewState + 'static) ) -> Option<f32>
Preferred aspect ratio for the ui tiles of this space view.
sourcefn default_visible_time_range(&self) -> VisibleTimeRange
fn default_visible_time_range(&self) -> VisibleTimeRange
Determines the default time range for this space view class.
sourcefn recommended_root_for_entities(
&self,
_entities: &HashSet<EntityPath, BuildHasherDefault<NoHashHasher<EntityPath>>>,
_entity_db: &EntityDb
) -> Option<EntityPath>
fn recommended_root_for_entities( &self, _entities: &HashSet<EntityPath, BuildHasherDefault<NoHashHasher<EntityPath>>>, _entity_db: &EntityDb ) -> Option<EntityPath>
Determines a suitable origin given the provided set of entities.
This function only considers the transform topology, disregarding the actual visualizability
of the entities (for this, use Self::visualizable_filter_context
).
sourcefn visualizable_filter_context(
&self,
_space_origin: &EntityPath,
_entity_db: &EntityDb
) -> Box<dyn VisualizableFilterContext>
fn visualizable_filter_context( &self, _space_origin: &EntityPath, _entity_db: &EntityDb ) -> Box<dyn VisualizableFilterContext>
Create context object that is passed to all of this classes visualizers to determine whether they can be visualized
sourcefn choose_default_visualizers(
&self,
entity_path: &EntityPath,
visualizable_entities_per_visualizer: &PerVisualizer<VisualizableEntities>,
indicated_entities_per_visualizer: &PerVisualizer<IndicatedEntities>
) -> SmallVec<[ViewSystemIdentifier; 4]>
fn choose_default_visualizers( &self, entity_path: &EntityPath, visualizable_entities_per_visualizer: &PerVisualizer<VisualizableEntities>, indicated_entities_per_visualizer: &PerVisualizer<IndicatedEntities> ) -> SmallVec<[ViewSystemIdentifier; 4]>
Choose the default visualizers to enable for this entity.
Helpful for customizing fallback behavior for types that are insufficient to determine indicated on their own.
Will only be called for entities where the selected visualizers have not been overridden by the blueprint.
This interface provides a default implementation which will return all visualizers which are both visualizable and indicated for the given entity.
sourcefn on_frame_start(
&self,
_ctx: &ViewerContext<'_>,
_state: &mut (dyn SpaceViewState + 'static),
_ent_paths: &BTreeMap<ViewSystemIdentifier, BTreeSet<EntityPath>>,
_entity_properties: &mut EntityPropertyMap
)
fn on_frame_start( &self, _ctx: &ViewerContext<'_>, _state: &mut (dyn SpaceViewState + 'static), _ent_paths: &BTreeMap<ViewSystemIdentifier, BTreeSet<EntityPath>>, _entity_properties: &mut EntityPropertyMap )
Executed for all active space views on frame start (before any ui is drawn), can be use for heuristic & state updates before populating the scene.
Is only allowed to access archetypes defined by Self::blueprint_archetype
Passed entity properties are individual properties without propagated values.
sourcefn selection_ui(
&self,
_ctx: &ViewerContext<'_>,
_ui: &mut Ui,
_state: &mut (dyn SpaceViewState + 'static),
_space_origin: &EntityPath,
_space_view_id: BlueprintId<SpaceViewIdRegistry>,
_root_entity_properties: &mut EntityProperties
) -> Result<(), SpaceViewSystemExecutionError>
fn selection_ui( &self, _ctx: &ViewerContext<'_>, _ui: &mut Ui, _state: &mut (dyn SpaceViewState + 'static), _space_origin: &EntityPath, _space_view_id: BlueprintId<SpaceViewIdRegistry>, _root_entity_properties: &mut EntityProperties ) -> Result<(), SpaceViewSystemExecutionError>
Ui shown when the user selects a space view of this class.
Implementations on Foreign Types§
source§impl SpaceViewClass for BarChartSpaceView
impl SpaceViewClass for BarChartSpaceView
fn identifier() -> SpaceViewClassIdentifier
fn display_name(&self) -> &'static str
fn icon(&self) -> &'static Icon
fn new_state(&self) -> Box<dyn SpaceViewState>
fn help_text(&self, re_ui: &ReUi) -> WidgetText
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
fn preferred_tile_aspect_ratio( &self, _state: &(dyn SpaceViewState + 'static) ) -> Option<f32>
fn choose_default_visualizers( &self, entity_path: &EntityPath, visualizable_entities_per_visualizer: &PerVisualizer<VisualizableEntities>, _indicated_entities_per_visualizer: &PerVisualizer<IndicatedEntities> ) -> SmallVec<[ViewSystemIdentifier; 4]>
fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, _state: &mut (dyn SpaceViewState + 'static), _space_origin: &EntityPath, _space_view_id: BlueprintId<SpaceViewIdRegistry>, root_entity_properties: &mut EntityProperties ) -> Result<(), SpaceViewSystemExecutionError>
fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, _state: &mut (dyn SpaceViewState + 'static), root_entity_properties: &EntityProperties, query: &ViewQuery<'_>, system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
source§impl SpaceViewClass for DataframeSpaceView
impl SpaceViewClass for DataframeSpaceView
fn identifier() -> SpaceViewClassIdentifier
fn display_name(&self) -> &'static str
fn icon(&self) -> &'static Icon
fn help_text(&self, _re_ui: &ReUi) -> WidgetText
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
fn new_state(&self) -> Box<dyn SpaceViewState>
fn preferred_tile_aspect_ratio( &self, _state: &(dyn SpaceViewState + 'static) ) -> Option<f32>
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn spawn_heuristics(&self, _ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, _state: &mut (dyn SpaceViewState + 'static), _root_entity_properties: &EntityProperties, query: &ViewQuery<'_>, _system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
source§impl SpaceViewClass for SpatialSpaceView2D
impl SpaceViewClass for SpatialSpaceView2D
fn identifier() -> SpaceViewClassIdentifier
fn display_name(&self) -> &'static str
fn icon(&self) -> &'static Icon
fn help_text(&self, re_ui: &ReUi) -> WidgetText
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
fn new_state(&self) -> Box<dyn SpaceViewState>
fn preferred_tile_aspect_ratio( &self, state: &(dyn SpaceViewState + 'static) ) -> Option<f32>
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn recommended_root_for_entities( &self, entities: &HashSet<EntityPath, BuildHasherDefault<NoHashHasher<EntityPath>>>, entity_db: &EntityDb ) -> Option<EntityPath>
fn visualizable_filter_context( &self, space_origin: &EntityPath, entity_db: &EntityDb ) -> Box<dyn VisualizableFilterContext>
fn on_frame_start( &self, ctx: &ViewerContext<'_>, state: &mut (dyn SpaceViewState + 'static), ent_paths: &BTreeMap<ViewSystemIdentifier, BTreeSet<EntityPath>>, entity_properties: &mut EntityPropertyMap )
fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _space_origin: &EntityPath, _space_view_id: BlueprintId<SpaceViewIdRegistry>, _root_entity_properties: &mut EntityProperties ) -> Result<(), SpaceViewSystemExecutionError>
fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _root_entity_properties: &EntityProperties, query: &ViewQuery<'_>, system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
source§impl SpaceViewClass for SpatialSpaceView3D
impl SpaceViewClass for SpatialSpaceView3D
fn identifier() -> SpaceViewClassIdentifier
fn display_name(&self) -> &'static str
fn icon(&self) -> &'static Icon
fn help_text(&self, re_ui: &ReUi) -> WidgetText
fn new_state(&self) -> Box<dyn SpaceViewState>
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
fn preferred_tile_aspect_ratio( &self, _state: &(dyn SpaceViewState + 'static) ) -> Option<f32>
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn recommended_root_for_entities( &self, entities: &HashSet<EntityPath, BuildHasherDefault<NoHashHasher<EntityPath>>>, entity_db: &EntityDb ) -> Option<EntityPath>
fn visualizable_filter_context( &self, space_origin: &EntityPath, entity_db: &EntityDb ) -> Box<dyn VisualizableFilterContext>
fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn on_frame_start( &self, ctx: &ViewerContext<'_>, state: &mut (dyn SpaceViewState + 'static), ent_paths: &BTreeMap<ViewSystemIdentifier, BTreeSet<EntityPath>>, entity_properties: &mut EntityPropertyMap )
fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), space_origin: &EntityPath, space_view_id: BlueprintId<SpaceViewIdRegistry>, _root_entity_properties: &mut EntityProperties ) -> Result<(), SpaceViewSystemExecutionError>
fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _root_entity_properties: &EntityProperties, query: &ViewQuery<'_>, system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
source§impl SpaceViewClass for TensorSpaceView
impl SpaceViewClass for TensorSpaceView
fn identifier() -> SpaceViewClassIdentifier
fn display_name(&self) -> &'static str
fn icon(&self) -> &'static Icon
fn help_text(&self, _re_ui: &ReUi) -> WidgetText
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
fn preferred_tile_aspect_ratio( &self, _state: &(dyn SpaceViewState + 'static) ) -> Option<f32>
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn new_state(&self) -> Box<dyn SpaceViewState>
fn choose_default_visualizers( &self, entity_path: &EntityPath, visualizable_entities_per_visualizer: &PerVisualizer<VisualizableEntities>, _indicated_entities_per_visualizer: &PerVisualizer<IndicatedEntities> ) -> SmallVec<[ViewSystemIdentifier; 4]>
fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _space_origin: &EntityPath, _space_view_id: BlueprintId<SpaceViewIdRegistry>, _root_entity_properties: &mut EntityProperties ) -> Result<(), SpaceViewSystemExecutionError>
fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _root_entity_properties: &EntityProperties, _query: &ViewQuery<'_>, system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
source§impl SpaceViewClass for TextDocumentSpaceView
impl SpaceViewClass for TextDocumentSpaceView
fn identifier() -> SpaceViewClassIdentifier
fn display_name(&self) -> &'static str
fn icon(&self) -> &'static Icon
fn help_text(&self, _re_ui: &ReUi) -> WidgetText
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
fn new_state(&self) -> Box<dyn SpaceViewState>
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _space_origin: &EntityPath, _space_view_id: BlueprintId<SpaceViewIdRegistry>, _root_entity_properties: &mut EntityProperties ) -> Result<(), SpaceViewSystemExecutionError>
fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn ui( &self, _ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _root_entity_properties: &EntityProperties, _query: &ViewQuery<'_>, system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
source§impl SpaceViewClass for TextSpaceView
impl SpaceViewClass for TextSpaceView
fn identifier() -> SpaceViewClassIdentifier
fn display_name(&self) -> &'static str
fn icon(&self) -> &'static Icon
fn help_text(&self, _re_ui: &ReUi) -> WidgetText
fn on_register( &self, system_registry: &mut SpaceViewSystemRegistrator<'_> ) -> Result<(), SpaceViewClassRegistryError>
fn new_state(&self) -> Box<dyn SpaceViewState>
fn preferred_tile_aspect_ratio( &self, _state: &(dyn SpaceViewState + 'static) ) -> Option<f32>
fn layout_priority(&self) -> SpaceViewClassLayoutPriority
fn spawn_heuristics(&self, ctx: &ViewerContext<'_>) -> SpaceViewSpawnHeuristics
fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _space_origin: &EntityPath, _space_view_id: BlueprintId<SpaceViewIdRegistry>, _root_entity_properties: &mut EntityProperties ) -> Result<(), SpaceViewSystemExecutionError>
fn ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn SpaceViewState + 'static), _root_entity_properties: &EntityProperties, _query: &ViewQuery<'_>, system_output: SystemExecutionOutput ) -> Result<(), SpaceViewSystemExecutionError>
source§impl SpaceViewClass for TimeSeriesSpaceView
impl SpaceViewClass for TimeSeriesSpaceView
source§fn choose_default_visualizers(
&self,
entity_path: &EntityPath,
visualizable_entities_per_visualizer: &PerVisualizer<VisualizableEntities>,
indicated_entities_per_visualizer: &PerVisualizer<IndicatedEntities>
) -> SmallVec<[ViewSystemIdentifier; 4]>
fn choose_default_visualizers( &self, entity_path: &EntityPath, visualizable_entities_per_visualizer: &PerVisualizer<VisualizableEntities>, indicated_entities_per_visualizer: &PerVisualizer<IndicatedEntities> ) -> SmallVec<[ViewSystemIdentifier; 4]>
Choose the default visualizers to enable for this entity.