Skip to content

Commit

Permalink
Add point-of-view entity and component to the dataframe view's UI (#7331
Browse files Browse the repository at this point in the history
)

### What

- Part of: #7279

This PR updates the dataframe query override UI as per design in #7279,
in particular adding PoV entity and component.
- updated UI layout
- time boundaries default to `+∞`/`–∞` button which, when clicked, turn
into editable time drag value
- reset buttons to go back to the `∞` state
- auto-selection of PoV component based on PoV entity (picks a required
component for one of the entity archetypes)

**Note**:
- This is a pure UI PR. The PoV entity/component are not yet used at all
for the dataframe's content (that will be addressed in a follow-up PR
currently blocked on #7284).
- Ignore the ugly "Time range table order" part, this will be cleaned up
later (#7070)


https://github.com/user-attachments/assets/32151a1f-b0ca-4e99-99df-ea730451d4dc

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7331?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7331?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7331)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
abey79 authored Sep 4, 2024
1 parent e4ac1b9 commit fed60d4
Show file tree
Hide file tree
Showing 16 changed files with 835 additions and 286 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5449,6 +5449,7 @@ version = "0.19.0-alpha.1+dev"
dependencies = [
"egui",
"egui_extras",
"itertools 0.13.0",
"re_chunk_store",
"re_data_ui",
"re_entity_db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@ table TimeRangeQuery (
/// Name of the timeline this applies to.
timeline: rerun.datatypes.Utf8 (order: 100);

/// Point-of-view entity.
///
/// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row
/// in the results returned by the range query.
pov_entity: rerun.datatypes.EntityPath (order: 200);

/// Point-of-view component.
///
/// Each non-null value of the point-of-view column (as defined by an entity and a component name) will generate a row
/// in the results returned by the range query.
pov_component: rerun.datatypes.Utf8 (order: 300);

/// Beginning of the time range.
start: rerun.datatypes.TimeInt (order: 200);
start: rerun.datatypes.TimeInt (order: 400);

/// End of the time range (inclusive).
end: rerun.datatypes.TimeInt (order: 300);
end: rerun.datatypes.TimeInt (order: 500);
}
229 changes: 226 additions & 3 deletions crates/store/re_types/src/blueprint/datatypes/time_range_query.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ impl Default for TimeRangeQuery {
fn default() -> Self {
Self {
timeline: Utf8::from("log_time"),
pov_entity: Default::default(),
pov_component: Default::default(),
start: TimeInt::MIN,
end: TimeInt::MAX,
}
Expand Down
39 changes: 39 additions & 0 deletions crates/store/re_types_core/src/reflection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@ pub struct Reflection {
pub archetypes: ArchetypeReflectionMap,
}

impl Reflection {
/// Find an [`ArchetypeReflection`] based on its short name.
///
/// Useful when the only information available is the short name, e.g. when inferring archetype
/// names from an indicator component.
//TODO( #6889): tagged component will contain a fully qualified archetype name, so this function
// will be unnecessary.
pub fn archetype_reflection_from_short_name(
&self,
short_name: &str,
) -> Option<&ArchetypeReflection> {
// note: this mirrors `ArchetypeName::short_name`'s implementation
self.archetypes
.get(&ArchetypeName::from(short_name))
.or_else(|| {
self.archetypes.get(&ArchetypeName::from(format!(
"rerun.archetypes.{short_name}"
)))
})
.or_else(|| {
self.archetypes.get(&ArchetypeName::from(format!(
"rerun.blueprint.archetypes.{short_name}"
)))
})
.or_else(|| {
self.archetypes
.get(&ArchetypeName::from(format!("rerun.{short_name}")))
})
}
}

/// Runtime reflection about components.
pub type ComponentReflectionMap = nohash_hasher::IntMap<ComponentName, ComponentReflection>;

Expand Down Expand Up @@ -50,6 +81,14 @@ pub struct ArchetypeReflection {
pub fields: Vec<ArchetypeFieldReflection>,
}

impl ArchetypeReflection {
/// Iterate over this archetype's required fields.
#[inline]
pub fn required_fields(&self) -> impl Iterator<Item = &ArchetypeFieldReflection> {
self.fields.iter().filter(|field| field.is_required)
}
}

/// Additional information about an archetype's field.
#[derive(Clone, Debug)]
pub struct ArchetypeFieldReflection {
Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_space_view_dataframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ re_viewport_blueprint.workspace = true

egui_extras.workspace = true
egui.workspace = true
itertools.workspace = true
2 changes: 1 addition & 1 deletion crates/viewer/re_space_view_dataframe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! A Space View that shows the data contained in entities in a table.
mod latest_at_table;
mod query_kind_ui;
mod query_kind;
mod space_view_class;
mod table_ui;
mod time_range_table;
Expand Down
Loading

0 comments on commit fed60d4

Please sign in to comment.