#![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::try_serialize_field;
use ::re_types_core::SerializationResult;
use ::re_types_core::{ComponentBatch, SerializedComponentBatch};
use ::re_types_core::{ComponentDescriptor, ComponentName};
use ::re_types_core::{DeserializationError, DeserializationResult};
#[derive(Clone, Debug, PartialEq, Default)]
pub struct Boxes3D {
pub half_sizes: Option<SerializedComponentBatch>,
pub centers: Option<SerializedComponentBatch>,
pub rotation_axis_angles: Option<SerializedComponentBatch>,
pub quaternions: Option<SerializedComponentBatch>,
pub colors: Option<SerializedComponentBatch>,
pub radii: Option<SerializedComponentBatch>,
pub fill_mode: Option<SerializedComponentBatch>,
pub labels: Option<SerializedComponentBatch>,
pub show_labels: Option<SerializedComponentBatch>,
pub class_ids: Option<SerializedComponentBatch>,
}
impl Boxes3D {
#[inline]
pub fn descriptor_half_sizes() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.HalfSize3D".into(),
archetype_field_name: Some("half_sizes".into()),
}
}
#[inline]
pub fn descriptor_centers() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.PoseTranslation3D".into(),
archetype_field_name: Some("centers".into()),
}
}
#[inline]
pub fn descriptor_rotation_axis_angles() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.PoseRotationAxisAngle".into(),
archetype_field_name: Some("rotation_axis_angles".into()),
}
}
#[inline]
pub fn descriptor_quaternions() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.PoseRotationQuat".into(),
archetype_field_name: Some("quaternions".into()),
}
}
#[inline]
pub fn descriptor_colors() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.Color".into(),
archetype_field_name: Some("colors".into()),
}
}
#[inline]
pub fn descriptor_radii() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.Radius".into(),
archetype_field_name: Some("radii".into()),
}
}
#[inline]
pub fn descriptor_fill_mode() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.FillMode".into(),
archetype_field_name: Some("fill_mode".into()),
}
}
#[inline]
pub fn descriptor_labels() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.Text".into(),
archetype_field_name: Some("labels".into()),
}
}
#[inline]
pub fn descriptor_show_labels() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.ShowLabels".into(),
archetype_field_name: Some("show_labels".into()),
}
}
#[inline]
pub fn descriptor_class_ids() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.ClassId".into(),
archetype_field_name: Some("class_ids".into()),
}
}
#[inline]
pub fn descriptor_indicator() -> ComponentDescriptor {
ComponentDescriptor {
archetype_name: Some("rerun.archetypes.Boxes3D".into()),
component_name: "rerun.components.Boxes3DIndicator".into(),
archetype_field_name: None,
}
}
}
static REQUIRED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 1usize]> =
once_cell::sync::Lazy::new(|| [Boxes3D::descriptor_half_sizes()]);
static RECOMMENDED_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 3usize]> =
once_cell::sync::Lazy::new(|| {
[
Boxes3D::descriptor_centers(),
Boxes3D::descriptor_colors(),
Boxes3D::descriptor_indicator(),
]
});
static OPTIONAL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 7usize]> =
once_cell::sync::Lazy::new(|| {
[
Boxes3D::descriptor_rotation_axis_angles(),
Boxes3D::descriptor_quaternions(),
Boxes3D::descriptor_radii(),
Boxes3D::descriptor_fill_mode(),
Boxes3D::descriptor_labels(),
Boxes3D::descriptor_show_labels(),
Boxes3D::descriptor_class_ids(),
]
});
static ALL_COMPONENTS: once_cell::sync::Lazy<[ComponentDescriptor; 11usize]> =
once_cell::sync::Lazy::new(|| {
[
Boxes3D::descriptor_half_sizes(),
Boxes3D::descriptor_centers(),
Boxes3D::descriptor_colors(),
Boxes3D::descriptor_indicator(),
Boxes3D::descriptor_rotation_axis_angles(),
Boxes3D::descriptor_quaternions(),
Boxes3D::descriptor_radii(),
Boxes3D::descriptor_fill_mode(),
Boxes3D::descriptor_labels(),
Boxes3D::descriptor_show_labels(),
Boxes3D::descriptor_class_ids(),
]
});
impl Boxes3D {
pub const NUM_COMPONENTS: usize = 11usize;
}
pub type Boxes3DIndicator = ::re_types_core::GenericIndicatorComponent<Boxes3D>;
impl ::re_types_core::Archetype for Boxes3D {
type Indicator = Boxes3DIndicator;
#[inline]
fn name() -> ::re_types_core::ArchetypeName {
"rerun.archetypes.Boxes3D".into()
}
#[inline]
fn display_name() -> &'static str {
"Boxes 3D"
}
#[inline]
fn indicator() -> SerializedComponentBatch {
#[allow(clippy::unwrap_used)]
Boxes3DIndicator::DEFAULT.serialized().unwrap()
}
#[inline]
fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
REQUIRED_COMPONENTS.as_slice().into()
}
#[inline]
fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
RECOMMENDED_COMPONENTS.as_slice().into()
}
#[inline]
fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
OPTIONAL_COMPONENTS.as_slice().into()
}
#[inline]
fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
ALL_COMPONENTS.as_slice().into()
}
#[inline]
fn from_arrow_components(
arrow_data: impl IntoIterator<Item = (ComponentDescriptor, arrow::array::ArrayRef)>,
) -> DeserializationResult<Self> {
re_tracing::profile_function!();
use ::re_types_core::{Loggable as _, ResultExt as _};
let arrays_by_descr: ::nohash_hasher::IntMap<_, _> = arrow_data.into_iter().collect();
let half_sizes = arrays_by_descr
.get(&Self::descriptor_half_sizes())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_half_sizes())
});
let centers = arrays_by_descr
.get(&Self::descriptor_centers())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_centers()));
let rotation_axis_angles = arrays_by_descr
.get(&Self::descriptor_rotation_axis_angles())
.map(|array| {
SerializedComponentBatch::new(
array.clone(),
Self::descriptor_rotation_axis_angles(),
)
});
let quaternions = arrays_by_descr
.get(&Self::descriptor_quaternions())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_quaternions())
});
let colors = arrays_by_descr
.get(&Self::descriptor_colors())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_colors()));
let radii = arrays_by_descr
.get(&Self::descriptor_radii())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_radii()));
let fill_mode = arrays_by_descr
.get(&Self::descriptor_fill_mode())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_fill_mode())
});
let labels = arrays_by_descr
.get(&Self::descriptor_labels())
.map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_labels()));
let show_labels = arrays_by_descr
.get(&Self::descriptor_show_labels())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_show_labels())
});
let class_ids = arrays_by_descr
.get(&Self::descriptor_class_ids())
.map(|array| {
SerializedComponentBatch::new(array.clone(), Self::descriptor_class_ids())
});
Ok(Self {
half_sizes,
centers,
rotation_axis_angles,
quaternions,
colors,
radii,
fill_mode,
labels,
show_labels,
class_ids,
})
}
}
impl ::re_types_core::AsComponents for Boxes3D {
#[inline]
fn as_serialized_batches(&self) -> Vec<SerializedComponentBatch> {
use ::re_types_core::Archetype as _;
[
Some(Self::indicator()),
self.half_sizes.clone(),
self.centers.clone(),
self.rotation_axis_angles.clone(),
self.quaternions.clone(),
self.colors.clone(),
self.radii.clone(),
self.fill_mode.clone(),
self.labels.clone(),
self.show_labels.clone(),
self.class_ids.clone(),
]
.into_iter()
.flatten()
.collect()
}
}
impl ::re_types_core::ArchetypeReflectionMarker for Boxes3D {}
impl Boxes3D {
#[inline]
pub(crate) fn new(
half_sizes: impl IntoIterator<Item = impl Into<crate::components::HalfSize3D>>,
) -> Self {
Self {
half_sizes: try_serialize_field(Self::descriptor_half_sizes(), half_sizes),
centers: None,
rotation_axis_angles: None,
quaternions: None,
colors: None,
radii: None,
fill_mode: None,
labels: None,
show_labels: None,
class_ids: None,
}
}
#[inline]
pub fn update_fields() -> Self {
Self::default()
}
#[inline]
pub fn clear_fields() -> Self {
use ::re_types_core::Loggable as _;
Self {
half_sizes: Some(SerializedComponentBatch::new(
crate::components::HalfSize3D::arrow_empty(),
Self::descriptor_half_sizes(),
)),
centers: Some(SerializedComponentBatch::new(
crate::components::PoseTranslation3D::arrow_empty(),
Self::descriptor_centers(),
)),
rotation_axis_angles: Some(SerializedComponentBatch::new(
crate::components::PoseRotationAxisAngle::arrow_empty(),
Self::descriptor_rotation_axis_angles(),
)),
quaternions: Some(SerializedComponentBatch::new(
crate::components::PoseRotationQuat::arrow_empty(),
Self::descriptor_quaternions(),
)),
colors: Some(SerializedComponentBatch::new(
crate::components::Color::arrow_empty(),
Self::descriptor_colors(),
)),
radii: Some(SerializedComponentBatch::new(
crate::components::Radius::arrow_empty(),
Self::descriptor_radii(),
)),
fill_mode: Some(SerializedComponentBatch::new(
crate::components::FillMode::arrow_empty(),
Self::descriptor_fill_mode(),
)),
labels: Some(SerializedComponentBatch::new(
crate::components::Text::arrow_empty(),
Self::descriptor_labels(),
)),
show_labels: Some(SerializedComponentBatch::new(
crate::components::ShowLabels::arrow_empty(),
Self::descriptor_show_labels(),
)),
class_ids: Some(SerializedComponentBatch::new(
crate::components::ClassId::arrow_empty(),
Self::descriptor_class_ids(),
)),
}
}
#[inline]
pub fn columns<I>(
self,
_lengths: I,
) -> SerializationResult<impl Iterator<Item = ::re_types_core::SerializedComponentColumn>>
where
I: IntoIterator<Item = usize> + Clone,
{
let columns = [
self.half_sizes
.map(|half_sizes| half_sizes.partitioned(_lengths.clone()))
.transpose()?,
self.centers
.map(|centers| centers.partitioned(_lengths.clone()))
.transpose()?,
self.rotation_axis_angles
.map(|rotation_axis_angles| rotation_axis_angles.partitioned(_lengths.clone()))
.transpose()?,
self.quaternions
.map(|quaternions| quaternions.partitioned(_lengths.clone()))
.transpose()?,
self.colors
.map(|colors| colors.partitioned(_lengths.clone()))
.transpose()?,
self.radii
.map(|radii| radii.partitioned(_lengths.clone()))
.transpose()?,
self.fill_mode
.map(|fill_mode| fill_mode.partitioned(_lengths.clone()))
.transpose()?,
self.labels
.map(|labels| labels.partitioned(_lengths.clone()))
.transpose()?,
self.show_labels
.map(|show_labels| show_labels.partitioned(_lengths.clone()))
.transpose()?,
self.class_ids
.map(|class_ids| class_ids.partitioned(_lengths.clone()))
.transpose()?,
];
Ok(columns
.into_iter()
.flatten()
.chain([::re_types_core::indicator_column::<Self>(
_lengths.into_iter().count(),
)?]))
}
#[inline]
pub fn columns_of_unit_batches(
self,
) -> SerializationResult<impl Iterator<Item = ::re_types_core::SerializedComponentColumn>> {
let len_half_sizes = self.half_sizes.as_ref().map(|b| b.array.len());
let len_centers = self.centers.as_ref().map(|b| b.array.len());
let len_rotation_axis_angles = self.rotation_axis_angles.as_ref().map(|b| b.array.len());
let len_quaternions = self.quaternions.as_ref().map(|b| b.array.len());
let len_colors = self.colors.as_ref().map(|b| b.array.len());
let len_radii = self.radii.as_ref().map(|b| b.array.len());
let len_fill_mode = self.fill_mode.as_ref().map(|b| b.array.len());
let len_labels = self.labels.as_ref().map(|b| b.array.len());
let len_show_labels = self.show_labels.as_ref().map(|b| b.array.len());
let len_class_ids = self.class_ids.as_ref().map(|b| b.array.len());
let len = None
.or(len_half_sizes)
.or(len_centers)
.or(len_rotation_axis_angles)
.or(len_quaternions)
.or(len_colors)
.or(len_radii)
.or(len_fill_mode)
.or(len_labels)
.or(len_show_labels)
.or(len_class_ids)
.unwrap_or(0);
self.columns(std::iter::repeat(1).take(len))
}
#[inline]
pub fn with_half_sizes(
mut self,
half_sizes: impl IntoIterator<Item = impl Into<crate::components::HalfSize3D>>,
) -> Self {
self.half_sizes = try_serialize_field(Self::descriptor_half_sizes(), half_sizes);
self
}
#[inline]
pub fn with_centers(
mut self,
centers: impl IntoIterator<Item = impl Into<crate::components::PoseTranslation3D>>,
) -> Self {
self.centers = try_serialize_field(Self::descriptor_centers(), centers);
self
}
#[inline]
pub fn with_rotation_axis_angles(
mut self,
rotation_axis_angles: impl IntoIterator<
Item = impl Into<crate::components::PoseRotationAxisAngle>,
>,
) -> Self {
self.rotation_axis_angles = try_serialize_field(
Self::descriptor_rotation_axis_angles(),
rotation_axis_angles,
);
self
}
#[inline]
pub fn with_quaternions(
mut self,
quaternions: impl IntoIterator<Item = impl Into<crate::components::PoseRotationQuat>>,
) -> Self {
self.quaternions = try_serialize_field(Self::descriptor_quaternions(), quaternions);
self
}
#[inline]
pub fn with_colors(
mut self,
colors: impl IntoIterator<Item = impl Into<crate::components::Color>>,
) -> Self {
self.colors = try_serialize_field(Self::descriptor_colors(), colors);
self
}
#[inline]
pub fn with_radii(
mut self,
radii: impl IntoIterator<Item = impl Into<crate::components::Radius>>,
) -> Self {
self.radii = try_serialize_field(Self::descriptor_radii(), radii);
self
}
#[inline]
pub fn with_fill_mode(mut self, fill_mode: impl Into<crate::components::FillMode>) -> Self {
self.fill_mode = try_serialize_field(Self::descriptor_fill_mode(), [fill_mode]);
self
}
#[inline]
pub fn with_many_fill_mode(
mut self,
fill_mode: impl IntoIterator<Item = impl Into<crate::components::FillMode>>,
) -> Self {
self.fill_mode = try_serialize_field(Self::descriptor_fill_mode(), fill_mode);
self
}
#[inline]
pub fn with_labels(
mut self,
labels: impl IntoIterator<Item = impl Into<crate::components::Text>>,
) -> Self {
self.labels = try_serialize_field(Self::descriptor_labels(), labels);
self
}
#[inline]
pub fn with_show_labels(
mut self,
show_labels: impl Into<crate::components::ShowLabels>,
) -> Self {
self.show_labels = try_serialize_field(Self::descriptor_show_labels(), [show_labels]);
self
}
#[inline]
pub fn with_many_show_labels(
mut self,
show_labels: impl IntoIterator<Item = impl Into<crate::components::ShowLabels>>,
) -> Self {
self.show_labels = try_serialize_field(Self::descriptor_show_labels(), show_labels);
self
}
#[inline]
pub fn with_class_ids(
mut self,
class_ids: impl IntoIterator<Item = impl Into<crate::components::ClassId>>,
) -> Self {
self.class_ids = try_serialize_field(Self::descriptor_class_ids(), class_ids);
self
}
}
impl ::re_byte_size::SizeBytes for Boxes3D {
#[inline]
fn heap_size_bytes(&self) -> u64 {
self.half_sizes.heap_size_bytes()
+ self.centers.heap_size_bytes()
+ self.rotation_axis_angles.heap_size_bytes()
+ self.quaternions.heap_size_bytes()
+ self.colors.heap_size_bytes()
+ self.radii.heap_size_bytes()
+ self.fill_mode.heap_size_bytes()
+ self.labels.heap_size_bytes()
+ self.show_labels.heap_size_bytes()
+ self.class_ids.heap_size_bytes()
}
}