1#![allow(unused_braces)]
5#![allow(unused_imports)]
6#![allow(unused_parens)]
7#![allow(clippy::allow_attributes)]
8#![allow(clippy::clone_on_copy)]
9#![allow(clippy::cloned_instead_of_copied)]
10#![allow(clippy::map_flatten)]
11#![allow(clippy::needless_question_mark)]
12#![allow(clippy::new_without_default)]
13#![allow(clippy::redundant_closure)]
14#![allow(clippy::too_many_arguments)]
15#![allow(clippy::too_many_lines)]
16#![allow(clippy::wildcard_imports)]
17
18use ::re_types_core::SerializationResult;
19use ::re_types_core::try_serialize_field;
20use ::re_types_core::{ComponentBatch as _, SerializedComponentBatch};
21use ::re_types_core::{ComponentDescriptor, ComponentType};
22use ::re_types_core::{DeserializationError, DeserializationResult};
23
24#[derive(Clone, Debug, PartialEq, Default)]
85pub struct Ellipsoids3D {
86 pub half_sizes: Option<SerializedComponentBatch>,
90
91 pub centers: Option<SerializedComponentBatch>,
95
96 pub rotation_axis_angles: Option<SerializedComponentBatch>,
100
101 pub quaternions: Option<SerializedComponentBatch>,
105
106 pub colors: Option<SerializedComponentBatch>,
110
111 pub line_radii: Option<SerializedComponentBatch>,
113
114 pub fill_mode: Option<SerializedComponentBatch>,
116
117 pub labels: Option<SerializedComponentBatch>,
119
120 pub show_labels: Option<SerializedComponentBatch>,
125
126 pub class_ids: Option<SerializedComponentBatch>,
130}
131
132impl Ellipsoids3D {
133 #[inline]
137 pub fn descriptor_half_sizes() -> ComponentDescriptor {
138 ComponentDescriptor {
139 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
140 component: "Ellipsoids3D:half_sizes".into(),
141 component_type: Some("rerun.components.HalfSize3D".into()),
142 }
143 }
144
145 #[inline]
149 pub fn descriptor_centers() -> ComponentDescriptor {
150 ComponentDescriptor {
151 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
152 component: "Ellipsoids3D:centers".into(),
153 component_type: Some("rerun.components.PoseTranslation3D".into()),
154 }
155 }
156
157 #[inline]
161 pub fn descriptor_rotation_axis_angles() -> ComponentDescriptor {
162 ComponentDescriptor {
163 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
164 component: "Ellipsoids3D:rotation_axis_angles".into(),
165 component_type: Some("rerun.components.PoseRotationAxisAngle".into()),
166 }
167 }
168
169 #[inline]
173 pub fn descriptor_quaternions() -> ComponentDescriptor {
174 ComponentDescriptor {
175 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
176 component: "Ellipsoids3D:quaternions".into(),
177 component_type: Some("rerun.components.PoseRotationQuat".into()),
178 }
179 }
180
181 #[inline]
185 pub fn descriptor_colors() -> ComponentDescriptor {
186 ComponentDescriptor {
187 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
188 component: "Ellipsoids3D:colors".into(),
189 component_type: Some("rerun.components.Color".into()),
190 }
191 }
192
193 #[inline]
197 pub fn descriptor_line_radii() -> ComponentDescriptor {
198 ComponentDescriptor {
199 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
200 component: "Ellipsoids3D:line_radii".into(),
201 component_type: Some("rerun.components.Radius".into()),
202 }
203 }
204
205 #[inline]
209 pub fn descriptor_fill_mode() -> ComponentDescriptor {
210 ComponentDescriptor {
211 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
212 component: "Ellipsoids3D:fill_mode".into(),
213 component_type: Some("rerun.components.FillMode".into()),
214 }
215 }
216
217 #[inline]
221 pub fn descriptor_labels() -> ComponentDescriptor {
222 ComponentDescriptor {
223 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
224 component: "Ellipsoids3D:labels".into(),
225 component_type: Some("rerun.components.Text".into()),
226 }
227 }
228
229 #[inline]
233 pub fn descriptor_show_labels() -> ComponentDescriptor {
234 ComponentDescriptor {
235 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
236 component: "Ellipsoids3D:show_labels".into(),
237 component_type: Some("rerun.components.ShowLabels".into()),
238 }
239 }
240
241 #[inline]
245 pub fn descriptor_class_ids() -> ComponentDescriptor {
246 ComponentDescriptor {
247 archetype: Some("rerun.archetypes.Ellipsoids3D".into()),
248 component: "Ellipsoids3D:class_ids".into(),
249 component_type: Some("rerun.components.ClassId".into()),
250 }
251 }
252}
253
254static REQUIRED_COMPONENTS: std::sync::LazyLock<[ComponentDescriptor; 1usize]> =
255 std::sync::LazyLock::new(|| [Ellipsoids3D::descriptor_half_sizes()]);
256
257static RECOMMENDED_COMPONENTS: std::sync::LazyLock<[ComponentDescriptor; 2usize]> =
258 std::sync::LazyLock::new(|| {
259 [
260 Ellipsoids3D::descriptor_centers(),
261 Ellipsoids3D::descriptor_colors(),
262 ]
263 });
264
265static OPTIONAL_COMPONENTS: std::sync::LazyLock<[ComponentDescriptor; 7usize]> =
266 std::sync::LazyLock::new(|| {
267 [
268 Ellipsoids3D::descriptor_rotation_axis_angles(),
269 Ellipsoids3D::descriptor_quaternions(),
270 Ellipsoids3D::descriptor_line_radii(),
271 Ellipsoids3D::descriptor_fill_mode(),
272 Ellipsoids3D::descriptor_labels(),
273 Ellipsoids3D::descriptor_show_labels(),
274 Ellipsoids3D::descriptor_class_ids(),
275 ]
276 });
277
278static ALL_COMPONENTS: std::sync::LazyLock<[ComponentDescriptor; 10usize]> =
279 std::sync::LazyLock::new(|| {
280 [
281 Ellipsoids3D::descriptor_half_sizes(),
282 Ellipsoids3D::descriptor_centers(),
283 Ellipsoids3D::descriptor_colors(),
284 Ellipsoids3D::descriptor_rotation_axis_angles(),
285 Ellipsoids3D::descriptor_quaternions(),
286 Ellipsoids3D::descriptor_line_radii(),
287 Ellipsoids3D::descriptor_fill_mode(),
288 Ellipsoids3D::descriptor_labels(),
289 Ellipsoids3D::descriptor_show_labels(),
290 Ellipsoids3D::descriptor_class_ids(),
291 ]
292 });
293
294impl Ellipsoids3D {
295 pub const NUM_COMPONENTS: usize = 10usize;
297}
298
299impl ::re_types_core::Archetype for Ellipsoids3D {
300 #[inline]
301 fn name() -> ::re_types_core::ArchetypeName {
302 "rerun.archetypes.Ellipsoids3D".into()
303 }
304
305 #[inline]
306 fn display_name() -> &'static str {
307 "Ellipsoids 3D"
308 }
309
310 #[inline]
311 fn required_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
312 REQUIRED_COMPONENTS.as_slice().into()
313 }
314
315 #[inline]
316 fn recommended_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
317 RECOMMENDED_COMPONENTS.as_slice().into()
318 }
319
320 #[inline]
321 fn optional_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
322 OPTIONAL_COMPONENTS.as_slice().into()
323 }
324
325 #[inline]
326 fn all_components() -> ::std::borrow::Cow<'static, [ComponentDescriptor]> {
327 ALL_COMPONENTS.as_slice().into()
328 }
329
330 #[inline]
331 fn from_arrow_components(
332 arrow_data: impl IntoIterator<Item = (ComponentDescriptor, arrow::array::ArrayRef)>,
333 ) -> DeserializationResult<Self> {
334 re_tracing::profile_function!();
335 use ::re_types_core::{Loggable as _, ResultExt as _};
336 let arrays_by_descr: ::nohash_hasher::IntMap<_, _> = arrow_data.into_iter().collect();
337 let half_sizes = arrays_by_descr
338 .get(&Self::descriptor_half_sizes())
339 .map(|array| {
340 SerializedComponentBatch::new(array.clone(), Self::descriptor_half_sizes())
341 });
342 let centers = arrays_by_descr
343 .get(&Self::descriptor_centers())
344 .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_centers()));
345 let rotation_axis_angles = arrays_by_descr
346 .get(&Self::descriptor_rotation_axis_angles())
347 .map(|array| {
348 SerializedComponentBatch::new(
349 array.clone(),
350 Self::descriptor_rotation_axis_angles(),
351 )
352 });
353 let quaternions = arrays_by_descr
354 .get(&Self::descriptor_quaternions())
355 .map(|array| {
356 SerializedComponentBatch::new(array.clone(), Self::descriptor_quaternions())
357 });
358 let colors = arrays_by_descr
359 .get(&Self::descriptor_colors())
360 .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_colors()));
361 let line_radii = arrays_by_descr
362 .get(&Self::descriptor_line_radii())
363 .map(|array| {
364 SerializedComponentBatch::new(array.clone(), Self::descriptor_line_radii())
365 });
366 let fill_mode = arrays_by_descr
367 .get(&Self::descriptor_fill_mode())
368 .map(|array| {
369 SerializedComponentBatch::new(array.clone(), Self::descriptor_fill_mode())
370 });
371 let labels = arrays_by_descr
372 .get(&Self::descriptor_labels())
373 .map(|array| SerializedComponentBatch::new(array.clone(), Self::descriptor_labels()));
374 let show_labels = arrays_by_descr
375 .get(&Self::descriptor_show_labels())
376 .map(|array| {
377 SerializedComponentBatch::new(array.clone(), Self::descriptor_show_labels())
378 });
379 let class_ids = arrays_by_descr
380 .get(&Self::descriptor_class_ids())
381 .map(|array| {
382 SerializedComponentBatch::new(array.clone(), Self::descriptor_class_ids())
383 });
384 Ok(Self {
385 half_sizes,
386 centers,
387 rotation_axis_angles,
388 quaternions,
389 colors,
390 line_radii,
391 fill_mode,
392 labels,
393 show_labels,
394 class_ids,
395 })
396 }
397}
398
399impl ::re_types_core::AsComponents for Ellipsoids3D {
400 #[inline]
401 fn as_serialized_batches(&self) -> Vec<SerializedComponentBatch> {
402 use ::re_types_core::Archetype as _;
403 [
404 self.half_sizes.clone(),
405 self.centers.clone(),
406 self.rotation_axis_angles.clone(),
407 self.quaternions.clone(),
408 self.colors.clone(),
409 self.line_radii.clone(),
410 self.fill_mode.clone(),
411 self.labels.clone(),
412 self.show_labels.clone(),
413 self.class_ids.clone(),
414 ]
415 .into_iter()
416 .flatten()
417 .collect()
418 }
419}
420
421impl ::re_types_core::ArchetypeReflectionMarker for Ellipsoids3D {}
422
423impl Ellipsoids3D {
424 #[inline]
426 pub(crate) fn new(
427 half_sizes: impl IntoIterator<Item = impl Into<crate::components::HalfSize3D>>,
428 ) -> Self {
429 Self {
430 half_sizes: try_serialize_field(Self::descriptor_half_sizes(), half_sizes),
431 centers: None,
432 rotation_axis_angles: None,
433 quaternions: None,
434 colors: None,
435 line_radii: None,
436 fill_mode: None,
437 labels: None,
438 show_labels: None,
439 class_ids: None,
440 }
441 }
442
443 #[inline]
445 pub fn update_fields() -> Self {
446 Self::default()
447 }
448
449 #[inline]
451 pub fn clear_fields() -> Self {
452 use ::re_types_core::Loggable as _;
453 Self {
454 half_sizes: Some(SerializedComponentBatch::new(
455 crate::components::HalfSize3D::arrow_empty(),
456 Self::descriptor_half_sizes(),
457 )),
458 centers: Some(SerializedComponentBatch::new(
459 crate::components::PoseTranslation3D::arrow_empty(),
460 Self::descriptor_centers(),
461 )),
462 rotation_axis_angles: Some(SerializedComponentBatch::new(
463 crate::components::PoseRotationAxisAngle::arrow_empty(),
464 Self::descriptor_rotation_axis_angles(),
465 )),
466 quaternions: Some(SerializedComponentBatch::new(
467 crate::components::PoseRotationQuat::arrow_empty(),
468 Self::descriptor_quaternions(),
469 )),
470 colors: Some(SerializedComponentBatch::new(
471 crate::components::Color::arrow_empty(),
472 Self::descriptor_colors(),
473 )),
474 line_radii: Some(SerializedComponentBatch::new(
475 crate::components::Radius::arrow_empty(),
476 Self::descriptor_line_radii(),
477 )),
478 fill_mode: Some(SerializedComponentBatch::new(
479 crate::components::FillMode::arrow_empty(),
480 Self::descriptor_fill_mode(),
481 )),
482 labels: Some(SerializedComponentBatch::new(
483 crate::components::Text::arrow_empty(),
484 Self::descriptor_labels(),
485 )),
486 show_labels: Some(SerializedComponentBatch::new(
487 crate::components::ShowLabels::arrow_empty(),
488 Self::descriptor_show_labels(),
489 )),
490 class_ids: Some(SerializedComponentBatch::new(
491 crate::components::ClassId::arrow_empty(),
492 Self::descriptor_class_ids(),
493 )),
494 }
495 }
496
497 #[inline]
508 pub fn columns<I>(
509 self,
510 _lengths: I,
511 ) -> SerializationResult<impl Iterator<Item = ::re_types_core::SerializedComponentColumn>>
512 where
513 I: IntoIterator<Item = usize> + Clone,
514 {
515 let columns = [
516 self.half_sizes
517 .map(|half_sizes| half_sizes.partitioned(_lengths.clone()))
518 .transpose()?,
519 self.centers
520 .map(|centers| centers.partitioned(_lengths.clone()))
521 .transpose()?,
522 self.rotation_axis_angles
523 .map(|rotation_axis_angles| rotation_axis_angles.partitioned(_lengths.clone()))
524 .transpose()?,
525 self.quaternions
526 .map(|quaternions| quaternions.partitioned(_lengths.clone()))
527 .transpose()?,
528 self.colors
529 .map(|colors| colors.partitioned(_lengths.clone()))
530 .transpose()?,
531 self.line_radii
532 .map(|line_radii| line_radii.partitioned(_lengths.clone()))
533 .transpose()?,
534 self.fill_mode
535 .map(|fill_mode| fill_mode.partitioned(_lengths.clone()))
536 .transpose()?,
537 self.labels
538 .map(|labels| labels.partitioned(_lengths.clone()))
539 .transpose()?,
540 self.show_labels
541 .map(|show_labels| show_labels.partitioned(_lengths.clone()))
542 .transpose()?,
543 self.class_ids
544 .map(|class_ids| class_ids.partitioned(_lengths.clone()))
545 .transpose()?,
546 ];
547 Ok(columns.into_iter().flatten())
548 }
549
550 #[inline]
555 pub fn columns_of_unit_batches(
556 self,
557 ) -> SerializationResult<impl Iterator<Item = ::re_types_core::SerializedComponentColumn>> {
558 let len_half_sizes = self.half_sizes.as_ref().map(|b| b.array.len());
559 let len_centers = self.centers.as_ref().map(|b| b.array.len());
560 let len_rotation_axis_angles = self.rotation_axis_angles.as_ref().map(|b| b.array.len());
561 let len_quaternions = self.quaternions.as_ref().map(|b| b.array.len());
562 let len_colors = self.colors.as_ref().map(|b| b.array.len());
563 let len_line_radii = self.line_radii.as_ref().map(|b| b.array.len());
564 let len_fill_mode = self.fill_mode.as_ref().map(|b| b.array.len());
565 let len_labels = self.labels.as_ref().map(|b| b.array.len());
566 let len_show_labels = self.show_labels.as_ref().map(|b| b.array.len());
567 let len_class_ids = self.class_ids.as_ref().map(|b| b.array.len());
568 let len = None
569 .or(len_half_sizes)
570 .or(len_centers)
571 .or(len_rotation_axis_angles)
572 .or(len_quaternions)
573 .or(len_colors)
574 .or(len_line_radii)
575 .or(len_fill_mode)
576 .or(len_labels)
577 .or(len_show_labels)
578 .or(len_class_ids)
579 .unwrap_or(0);
580 self.columns(std::iter::repeat_n(1, len))
581 }
582
583 #[inline]
587 pub fn with_half_sizes(
588 mut self,
589 half_sizes: impl IntoIterator<Item = impl Into<crate::components::HalfSize3D>>,
590 ) -> Self {
591 self.half_sizes = try_serialize_field(Self::descriptor_half_sizes(), half_sizes);
592 self
593 }
594
595 #[inline]
599 pub fn with_centers(
600 mut self,
601 centers: impl IntoIterator<Item = impl Into<crate::components::PoseTranslation3D>>,
602 ) -> Self {
603 self.centers = try_serialize_field(Self::descriptor_centers(), centers);
604 self
605 }
606
607 #[inline]
611 pub fn with_rotation_axis_angles(
612 mut self,
613 rotation_axis_angles: impl IntoIterator<
614 Item = impl Into<crate::components::PoseRotationAxisAngle>,
615 >,
616 ) -> Self {
617 self.rotation_axis_angles = try_serialize_field(
618 Self::descriptor_rotation_axis_angles(),
619 rotation_axis_angles,
620 );
621 self
622 }
623
624 #[inline]
628 pub fn with_quaternions(
629 mut self,
630 quaternions: impl IntoIterator<Item = impl Into<crate::components::PoseRotationQuat>>,
631 ) -> Self {
632 self.quaternions = try_serialize_field(Self::descriptor_quaternions(), quaternions);
633 self
634 }
635
636 #[inline]
640 pub fn with_colors(
641 mut self,
642 colors: impl IntoIterator<Item = impl Into<crate::components::Color>>,
643 ) -> Self {
644 self.colors = try_serialize_field(Self::descriptor_colors(), colors);
645 self
646 }
647
648 #[inline]
650 pub fn with_line_radii(
651 mut self,
652 line_radii: impl IntoIterator<Item = impl Into<crate::components::Radius>>,
653 ) -> Self {
654 self.line_radii = try_serialize_field(Self::descriptor_line_radii(), line_radii);
655 self
656 }
657
658 #[inline]
660 pub fn with_fill_mode(mut self, fill_mode: impl Into<crate::components::FillMode>) -> Self {
661 self.fill_mode = try_serialize_field(Self::descriptor_fill_mode(), [fill_mode]);
662 self
663 }
664
665 #[inline]
670 pub fn with_many_fill_mode(
671 mut self,
672 fill_mode: impl IntoIterator<Item = impl Into<crate::components::FillMode>>,
673 ) -> Self {
674 self.fill_mode = try_serialize_field(Self::descriptor_fill_mode(), fill_mode);
675 self
676 }
677
678 #[inline]
680 pub fn with_labels(
681 mut self,
682 labels: impl IntoIterator<Item = impl Into<crate::components::Text>>,
683 ) -> Self {
684 self.labels = try_serialize_field(Self::descriptor_labels(), labels);
685 self
686 }
687
688 #[inline]
693 pub fn with_show_labels(
694 mut self,
695 show_labels: impl Into<crate::components::ShowLabels>,
696 ) -> Self {
697 self.show_labels = try_serialize_field(Self::descriptor_show_labels(), [show_labels]);
698 self
699 }
700
701 #[inline]
706 pub fn with_many_show_labels(
707 mut self,
708 show_labels: impl IntoIterator<Item = impl Into<crate::components::ShowLabels>>,
709 ) -> Self {
710 self.show_labels = try_serialize_field(Self::descriptor_show_labels(), show_labels);
711 self
712 }
713
714 #[inline]
718 pub fn with_class_ids(
719 mut self,
720 class_ids: impl IntoIterator<Item = impl Into<crate::components::ClassId>>,
721 ) -> Self {
722 self.class_ids = try_serialize_field(Self::descriptor_class_ids(), class_ids);
723 self
724 }
725}
726
727impl ::re_byte_size::SizeBytes for Ellipsoids3D {
728 #[inline]
729 fn heap_size_bytes(&self) -> u64 {
730 self.half_sizes.heap_size_bytes()
731 + self.centers.heap_size_bytes()
732 + self.rotation_axis_angles.heap_size_bytes()
733 + self.quaternions.heap_size_bytes()
734 + self.colors.heap_size_bytes()
735 + self.line_radii.heap_size_bytes()
736 + self.fill_mode.heap_size_bytes()
737 + self.labels.heap_size_bytes()
738 + self.show_labels.heap_size_bytes()
739 + self.class_ids.heap_size_bytes()
740 }
741}