Skip to main content

ViewClass

Trait ViewClass 

Source
pub trait ViewClass: Send + Sync {
Show 18 methods // Required methods fn identifier() -> ViewClassIdentifier where Self: Sized; fn display_name(&self) -> &'static str; fn help(&self, os: OperatingSystem) -> Help; fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>; fn new_state(&self) -> Box<dyn ViewState>; fn layout_priority(&self) -> ViewClassLayoutPriority; fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics; fn ui( &self, ctx: &ViewerContext<'_>, missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>; // Provided methods fn recommendation_order(&self) -> i32 { ... } fn icon(&self) -> &'static Icon { ... } fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32> { ... } fn supports_visible_time_range(&self) -> bool { ... } fn default_query_range( &self, _state: &(dyn ViewState + 'static), ) -> QueryRange { ... } fn recommended_origin_for_entities( &self, entities: &HashSet<EntityPath, BuildHasherDefault<NoHashHasher<EntityPath>>>, _entity_db: &EntityDb, ) -> Option<EntityPath> { ... } fn recommended_visualizers_for_entity( &self, entity_path: &EntityPath, visualizers_with_reason: &[(ViewSystemIdentifier, &VisualizableReason)], indicated_entities_per_visualizer: &PerVisualizerType<&IndicatedEntities>, ) -> RecommendedVisualizers { ... } fn visualizers_section<'a>( &'a self, _ctx: &'a ViewContext<'a>, ) -> Option<VisualizersSectionOutput<'a>> { ... } fn selection_ui( &self, _ctx: &ViewerContext<'_>, _ui: &mut Ui, _state: &mut (dyn ViewState + 'static), _space_origin: &EntityPath, _view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError> { ... } fn extra_title_bar_ui( &self, _ctx: &ViewerContext<'_>, _ui: &mut Ui, _state: &mut (dyn ViewState + 'static), _space_origin: &EntityPath, _view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError> { ... }
}
Expand description

Defines a class of view without any concrete types making it suitable for storage and interfacing.

Each 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.

Required Methods§

Source

fn identifier() -> ViewClassIdentifier
where Self: Sized,

Identifier string of this view class.

By convention we use PascalCase.

Source

fn display_name(&self) -> &'static str

User-facing name of this view class.

Used for UI display.

Source

fn help(&self, os: OperatingSystem) -> Help

Source

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Called once upon registration of the class

This can be used to register all built-in crate::ViewContextSystem and crate::VisualizerSystem.

Source

fn new_state(&self) -> Box<dyn ViewState>

Called once for every new view instance of this class.

The state is not persisted across viewer sessions, only shared frame-to-frame.

Source

fn layout_priority(&self) -> ViewClassLayoutPriority

Controls how likely this view will get a large tile in the ui.

Source

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Determines which views should be spawned by default for this class.

Only entities matching include_entity should be considered, though this is only a suggestion and may be overwritten if a view decides to display more data.

Source

fn ui( &self, ctx: &ViewerContext<'_>, missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Draws the ui for this 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::ViewBuilders. In the future, we likely want to move view builder handling to re_viewport with minimal configuration options exposed via crate::ViewClass.

Provided Methods§

Source

fn recommendation_order(&self) -> i32

Ordering hint for view class recommendations. Lower values are recommended more.

If tied, the display name is used as a tiebreaker in lexicographical order.

Source

fn icon(&self) -> &'static Icon

Icon used to identify this view class.

Source

fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32>

Preferred aspect ratio for the ui tiles of this view.

Source

fn supports_visible_time_range(&self) -> bool

Controls whether the visible time range UI should be displayed for this view.

Source

fn default_query_range(&self, _state: &(dyn ViewState + 'static)) -> QueryRange

Default query range for this view.

Source

fn recommended_origin_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.

Source

fn recommended_visualizers_for_entity( &self, entity_path: &EntityPath, visualizers_with_reason: &[(ViewSystemIdentifier, &VisualizableReason)], indicated_entities_per_visualizer: &PerVisualizerType<&IndicatedEntities>, ) -> RecommendedVisualizers

Auto picked visualizers for an entity if there was not explicit selection.

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.

visualizers_with_reason contains the visualizers that are visualizable for this entity, along with the reason why they are visualizable.

This interface provides a default implementation which will return all visualizers which are both visualizable and indicated for the given entity.

Source

fn visualizers_section<'a>( &'a self, _ctx: &'a ViewContext<'a>, ) -> Option<VisualizersSectionOutput<'a>>

Custom UI and add-visualizer options for the “Visualizers” section in the selection panel.

Returns None if the view doesn’t provide a custom visualizers section (the default).

Source

fn selection_ui( &self, _ctx: &ViewerContext<'_>, _ui: &mut Ui, _state: &mut (dyn ViewState + 'static), _space_origin: &EntityPath, _view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Ui shown when the user selects a view of this class.

Source

fn extra_title_bar_ui( &self, _ctx: &ViewerContext<'_>, _ui: &mut Ui, _state: &mut (dyn ViewState + 'static), _space_origin: &EntityPath, _view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Additional UI displayed in the tab title bar, between the “maximize” and “help” buttons.

Note: this is a right-to-left layout.

Implementations on Foreign Types§

Source§

impl ViewClass for BarChartView

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn help(&self, os: OperatingSystem) -> Help

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Source§

fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32>

Source§

fn recommended_visualizers_for_entity( &self, _entity_path: &EntityPath, visualizers_with_reason: &[(ViewSystemIdentifier, &VisualizableReason)], _indicated_entities_per_visualizer: &PerVisualizerType<&IndicatedEntities>, ) -> RecommendedVisualizers

Source§

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), space_origin: &EntityPath, view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Source§

impl ViewClass for DataframeView

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn recommendation_order(&self) -> i32

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn help(&self, _os: OperatingSystem) -> Help

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32>

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn spawn_heuristics( &self, _ctx: &ViewerContext<'_>, _include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), _space_origin: &EntityPath, view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, _system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Source§

impl ViewClass for GraphView

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Register all systems (contexts & parts) that the view needs.

Source§

fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), space_origin: &EntityPath, view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Additional UI displayed when the view is selected.

In this sample we show a combo box to select the color coordinates mode.

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

The contents of the View window and all interaction within it.

This is called with freshly created & executed context & part systems.

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn help(&self, os: OperatingSystem) -> Help

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn preferred_tile_aspect_ratio( &self, state: &(dyn ViewState + 'static), ) -> Option<f32>

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

impl ViewClass for MapView

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn help(&self, os: OperatingSystem) -> Help

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32>

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn supports_visible_time_range(&self) -> bool

Source§

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), space_origin: &EntityPath, view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Source§

impl ViewClass for TensorView

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn help(&self, _os: OperatingSystem) -> Help

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Source§

fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32>

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn recommended_visualizers_for_entity( &self, _entity_path: &EntityPath, visualizers_with_reason: &[(ViewSystemIdentifier, &VisualizableReason)], _indicated_entities_per_visualizer: &PerVisualizerType<&IndicatedEntities>, ) -> RecommendedVisualizers

Source§

fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), space_origin: &EntityPath, view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Source§

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Source§

impl ViewClass for TextDocumentView

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn help(&self, _os: OperatingSystem) -> Help

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn selection_ui( &self, _ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), _space_origin: &EntityPath, _view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Source§

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Source§

impl ViewClass for TextView

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn help(&self, _os: OperatingSystem) -> Help

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32>

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

fn selection_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), space_origin: &EntityPath, view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Source§

impl ViewClass for TimeSeriesView

Source§

fn recommended_visualizers_for_entity( &self, entity_path: &EntityPath, visualizers_with_reason: &[(ViewSystemIdentifier, &VisualizableReason)], indicated_entities_per_visualizer: &PerVisualizerType<&IndicatedEntities>, ) -> RecommendedVisualizers

Auto picked visualizers for an entity if there was not explicit selection.

Source§

fn identifier() -> ViewClassIdentifier

Source§

fn display_name(&self) -> &'static str

Source§

fn icon(&self) -> &'static Icon

Source§

fn help(&self, os: OperatingSystem) -> Help

Source§

fn on_register( &self, system_registry: &mut ViewSystemRegistrator<'_>, ) -> Result<(), ViewClassRegistryError>

Source§

fn new_state(&self) -> Box<dyn ViewState>

Source§

fn preferred_tile_aspect_ratio( &self, _state: &(dyn ViewState + 'static), ) -> Option<f32>

Source§

fn layout_priority(&self) -> ViewClassLayoutPriority

Source§

fn supports_visible_time_range(&self) -> bool

Source§

fn default_query_range( &self, _view_state: &(dyn ViewState + 'static), ) -> QueryRange

Source§

fn selection_ui( &self, viewer_ctx: &ViewerContext<'_>, ui: &mut Ui, state: &mut (dyn ViewState + 'static), space_origin: &EntityPath, view_id: BlueprintId<ViewIdRegistry>, ) -> Result<(), ViewSystemExecutionError>

Source§

fn spawn_heuristics( &self, ctx: &ViewerContext<'_>, include_entity: &dyn Fn(&EntityPath) -> bool, ) -> ViewSpawnHeuristics

Source§

fn visualizers_section<'a>( &'a self, ctx: &'a ViewContext<'a>, ) -> Option<VisualizersSectionOutput<'a>>

Source§

fn ui( &self, ctx: &ViewerContext<'_>, _missing_chunk_reporter: &MissingChunkReporter, ui: &mut Ui, state: &mut (dyn ViewState + 'static), query: &ViewQuery<'_>, system_output: SystemExecutionOutput, ) -> Result<(), ViewSystemExecutionError>

Implementors§