Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for visible time range to the dataframe view #6869

Merged
merged 18 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4829,6 +4829,7 @@ dependencies = [
"re_log_types",
"re_query",
"re_space_view",
"re_space_view_dataframe",
"re_space_view_spatial",
"re_space_view_time_series",
"re_tracing",
Expand Down Expand Up @@ -4902,10 +4903,13 @@ dependencies = [
"re_entity_db",
"re_log_types",
"re_renderer",
"re_space_view",
"re_tracing",
"re_types",
"re_types_core",
"re_ui",
"re_viewer_context",
"re_viewport_blueprint",
]

[[package]]
Expand Down
3 changes: 3 additions & 0 deletions crates/store/re_types/definitions/rerun/blueprint.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ include "./blueprint/components/panel_state.fbs";
include "./blueprint/components/query_expression.fbs";
include "./blueprint/components/root_container.fbs";
include "./blueprint/components/row_share.fbs";
include "./blueprint/components/sort_order.fbs";
include "./blueprint/components/space_view_class.fbs";
include "./blueprint/components/space_view_maximized.fbs";
include "./blueprint/components/space_view_origin.fbs";
include "./blueprint/components/table_group_by.fbs";
include "./blueprint/components/tensor_dimension_index_slider.fbs";
include "./blueprint/components/view_fit.fbs";
include "./blueprint/components/viewer_recommendation_hash.fbs";
Expand All @@ -41,6 +43,7 @@ include "./blueprint/archetypes/visible_time_ranges.fbs";
include "./blueprint/archetypes/visual_bounds2d.fbs";

include "./blueprint/archetypes/plot_legend.fbs";
include "./blueprint/archetypes/range_table_settings.fbs";
include "./blueprint/archetypes/scalar_axis.fbs";

include "./blueprint/views/bar_chart.fbs";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include "arrow/attributes.fbs";
include "python/attributes.fbs";
include "rust/attributes.fbs";

include "rerun/attributes.fbs";

namespace rerun.blueprint.archetypes;


/// Configuration for the sorting of the rows of a time range table.
table TableRowOrder (
"attr.rerun.scope": "blueprint",
"attr.rust.derive": "Copy",
"attr.rust.generate_field_info"
) {
// --- Optional ---

/// The type of the background.
abey79 marked this conversation as resolved.
Show resolved Hide resolved
group_by: rerun.blueprint.components.TableGroupBy ("attr.rerun.component_optional", nullable, order: 1000);

/// Color used for the `SolidColor` background type.
abey79 marked this conversation as resolved.
Show resolved Hide resolved
sort_order: rerun.blueprint.components.SortOrder ("attr.rerun.component_optional", nullable, order: 2000);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include "arrow/attributes.fbs";
include "python/attributes.fbs";
include "rust/attributes.fbs";

include "rerun/datatypes.fbs";
include "rerun/attributes.fbs";

namespace rerun.blueprint.components;


/// Sort order for data table.
enum SortOrder: byte (
"attr.rerun.scope": "blueprint"
) {
/// Ascending
Ascending (default),

/// Descending
Descending,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include "arrow/attributes.fbs";
include "python/attributes.fbs";
include "rust/attributes.fbs";

include "rerun/datatypes.fbs";
include "rerun/attributes.fbs";

namespace rerun.blueprint.components;


/// Primary element by which to group by in a temporal data table.
enum TableGroupBy: byte (
abey79 marked this conversation as resolved.
Show resolved Hide resolved
"attr.rerun.scope": "blueprint"
) {
/// Group by entity.
Entity (default),

/// Group by instance.
Time,
}

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

2 changes: 2 additions & 0 deletions crates/store/re_types/src/blueprint/archetypes/mod.rs

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

201 changes: 201 additions & 0 deletions crates/store/re_types/src/blueprint/archetypes/table_row_order.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs
// Based on "crates/store/re_types/definitions/rerun/blueprint/archetypes/range_table_settings.fbs".

#![allow(unused_imports)]
#![allow(unused_parens)]
#![allow(clippy::clone_on_copy)]
#![allow(clippy::cloned_instead_of_copied)]
#![allow(clippy::map_flatten)]
#![allow(clippy::needless_question_mark)]
#![allow(clippy::new_without_default)]
#![allow(clippy::redundant_closure)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::too_many_lines)]

use ::re_types_core::external::arrow2;
use ::re_types_core::ComponentName;
use ::re_types_core::SerializationResult;
use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch};
use ::re_types_core::{DeserializationError, DeserializationResult};

/// **Archetype**: Configuration for the sorting of the rows of a time range table.
#[derive(Clone, Debug, Copy)]
pub struct TableRowOrder {
/// The type of the background.
pub group_by: Option<crate::blueprint::components::TableGroupBy>,

/// Color used for the `SolidColor` background type.
pub sort_order: Option<crate::blueprint::components::SortOrder>,
}

impl ::re_types_core::SizeBytes for TableRowOrder {
#[inline]
fn heap_size_bytes(&self) -> u64 {
self.group_by.heap_size_bytes() + self.sort_order.heap_size_bytes()
}

#[inline]
fn is_pod() -> bool {
<Option<crate::blueprint::components::TableGroupBy>>::is_pod()
&& <Option<crate::blueprint::components::SortOrder>>::is_pod()
}
}

static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 0usize]> =
once_cell::sync::Lazy::new(|| []);

static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 1usize]> =
once_cell::sync::Lazy::new(|| ["rerun.blueprint.components.TableRowOrderIndicator".into()]);

static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 2usize]> =
once_cell::sync::Lazy::new(|| {
[
"rerun.blueprint.components.TableGroupBy".into(),
"rerun.blueprint.components.SortOrder".into(),
]
});

static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentName; 3usize]> =
once_cell::sync::Lazy::new(|| {
[
"rerun.blueprint.components.TableRowOrderIndicator".into(),
"rerun.blueprint.components.TableGroupBy".into(),
"rerun.blueprint.components.SortOrder".into(),
]
});

impl TableRowOrder {
/// The total number of components in the archetype: 0 required, 1 recommended, 2 optional
pub const NUM_COMPONENTS: usize = 3usize;
}

/// Indicator component for the [`TableRowOrder`] [`::re_types_core::Archetype`]
pub type TableRowOrderIndicator = ::re_types_core::GenericIndicatorComponent<TableRowOrder>;

impl ::re_types_core::Archetype for TableRowOrder {
type Indicator = TableRowOrderIndicator;

#[inline]
fn name() -> ::re_types_core::ArchetypeName {
"rerun.blueprint.archetypes.TableRowOrder".into()
}

#[inline]
fn display_name() -> &'static str {
"Table row order"
}

#[inline]
fn indicator() -> MaybeOwnedComponentBatch<'static> {
static INDICATOR: TableRowOrderIndicator = TableRowOrderIndicator::DEFAULT;
MaybeOwnedComponentBatch::Ref(&INDICATOR)
}

#[inline]
fn required_components() -> ::std::borrow::Cow<'static, [ComponentName]> {
REQUIRED_COMPONENTS.as_slice().into()
}

#[inline]
fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentName]> {
RECOMMENDED_COMPONENTS.as_slice().into()
}

#[inline]
fn optional_components() -> ::std::borrow::Cow<'static, [ComponentName]> {
OPTIONAL_COMPONENTS.as_slice().into()
}

#[inline]
fn all_components() -> ::std::borrow::Cow<'static, [ComponentName]> {
ALL_COMPONENTS.as_slice().into()
}

#[inline]
fn from_arrow_components(
arrow_data: impl IntoIterator<Item = (ComponentName, Box<dyn arrow2::array::Array>)>,
) -> DeserializationResult<Self> {
re_tracing::profile_function!();
use ::re_types_core::{Loggable as _, ResultExt as _};
let arrays_by_name: ::std::collections::HashMap<_, _> = arrow_data
.into_iter()
.map(|(name, array)| (name.full_name(), array))
.collect();
let group_by =
if let Some(array) = arrays_by_name.get("rerun.blueprint.components.TableGroupBy") {
<crate::blueprint::components::TableGroupBy>::from_arrow_opt(&**array)
.with_context("rerun.blueprint.archetypes.TableRowOrder#group_by")?
.into_iter()
.next()
.flatten()
} else {
None
};
let sort_order =
if let Some(array) = arrays_by_name.get("rerun.blueprint.components.SortOrder") {
<crate::blueprint::components::SortOrder>::from_arrow_opt(&**array)
.with_context("rerun.blueprint.archetypes.TableRowOrder#sort_order")?
.into_iter()
.next()
.flatten()
} else {
None
};
Ok(Self {
group_by,
sort_order,
})
}
}

impl ::re_types_core::AsComponents for TableRowOrder {
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>> {
re_tracing::profile_function!();
use ::re_types_core::Archetype as _;
[
Some(Self::indicator()),
self.group_by
.as_ref()
.map(|comp| (comp as &dyn ComponentBatch).into()),
self.sort_order
.as_ref()
.map(|comp| (comp as &dyn ComponentBatch).into()),
]
.into_iter()
.flatten()
.collect()
}
}

impl ::re_types_core::ArchetypeReflectionMarker for TableRowOrder {}

impl TableRowOrder {
/// Create a new `TableRowOrder`.
#[inline]
pub fn new() -> Self {
Self {
group_by: None,
sort_order: None,
}
}

/// The type of the background.
#[inline]
pub fn with_group_by(
mut self,
group_by: impl Into<crate::blueprint::components::TableGroupBy>,
) -> Self {
self.group_by = Some(group_by.into());
self
}

/// Color used for the `SolidColor` background type.
#[inline]
pub fn with_sort_order(
mut self,
sort_order: impl Into<crate::blueprint::components::SortOrder>,
) -> Self {
self.sort_order = Some(sort_order.into());
self
}
}
2 changes: 2 additions & 0 deletions crates/store/re_types/src/blueprint/components/.gitattributes

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

4 changes: 4 additions & 0 deletions crates/store/re_types/src/blueprint/components/mod.rs

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

Loading
Loading