6#include "../archetype_utils.hpp"
7#include "../collection.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/class_id.hpp"
11#include "../components/color.hpp"
12#include "../components/draw_order.hpp"
13#include "../components/half_size2d.hpp"
14#include "../components/position2d.hpp"
15#include "../components/radius.hpp"
16#include "../components/show_labels.hpp"
17#include "../components/text.hpp"
18#include "../result.hpp"
54 std::optional<ComponentBatch>
colors;
57 std::optional<ComponentBatch>
radii;
63 std::optional<ComponentBatch>
labels;
84 static constexpr const char ArchetypeName[] =
"rerun.archetypes.Boxes2D";
161 const std::vector<encodings::Vec2D>& mins,
const std::vector<encodings::Vec2D>& sizes
185 return std::move(*
this);
191 return std::move(*
this);
197 return std::move(*
this);
203 return std::move(*
this);
212 return std::move(*
this);
222 return std::move(*
this);
233 return std::move(*
this);
243 return std::move(*
this);
254 return std::move(*
this);
263 return std::move(*
this);
275 return detail::partition_batches(
294 return detail::partition_batches_of_unit_length({&
half_sizes,
310 template <
typename T>
315 struct AsComponents<archetypes::Boxes2D> {
317 static Result<Collection<ComponentBatch>> as_batches(
const archetypes::Boxes2D& archetype) {
318 return detail::collect_batches(
319 {&archetype.half_sizes,
324 &archetype.show_labels,
325 &archetype.draw_order,
326 &archetype.class_ids}
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:90
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: 2D boxes with half-extents and optional center, colors etc.
Definition boxes2d.hpp:46
static Boxes2D clear_fields()
Clear all the fields of a Boxes2D.
Boxes2D with_class_ids(const Collection< rerun::components::ClassId > &_class_ids) &&
Optional components::ClassIds for the boxes.
Definition boxes2d.hpp:260
static constexpr auto Descriptor_show_labels
ComponentDescriptor for the show_labels field.
Definition boxes2d.hpp:108
std::optional< ComponentBatch > centers
Optional center positions of the boxes.
Definition boxes2d.hpp:51
static Boxes2D update_fields()
Update only some specific fields of a Boxes2D.
Definition boxes2d.hpp:174
std::optional< ComponentBatch > draw_order
An optional floating point value that specifies the 2D drawing order.
Definition boxes2d.hpp:75
std::optional< ComponentBatch > show_labels
Whether the text labels should be shown.
Definition boxes2d.hpp:69
Boxes2D with_draw_order(const rerun::components::DrawOrder &_draw_order) &&
An optional floating point value that specifies the 2D drawing order.
Definition boxes2d.hpp:240
std::optional< ComponentBatch > radii
Optional radii for the lines that make up the boxes.
Definition boxes2d.hpp:57
std::optional< ComponentBatch > half_sizes
All half-extents that make up the batch of boxes.
Definition boxes2d.hpp:48
Boxes2D with_labels(const Collection< rerun::components::Text > &_labels) &&
Optional text labels for the boxes.
Definition boxes2d.hpp:210
Boxes2D with_colors(const Collection< rerun::components::Color > &_colors) &&
Optional colors for the boxes.
Definition boxes2d.hpp:195
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition boxes2d.hpp:84
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition boxes2d.hpp:293
Boxes2D with_half_sizes(const Collection< rerun::components::HalfSize2D > &_half_sizes) &&
All half-extents that make up the batch of boxes.
Definition boxes2d.hpp:182
static constexpr auto Descriptor_class_ids
ComponentDescriptor for the class_ids field.
Definition boxes2d.hpp:118
static constexpr auto Descriptor_radii
ComponentDescriptor for the radii field.
Definition boxes2d.hpp:100
static constexpr auto Descriptor_colors
ComponentDescriptor for the colors field.
Definition boxes2d.hpp:96
Boxes2D with_centers(const Collection< rerun::components::Position2D > &_centers) &&
Optional center positions of the boxes.
Definition boxes2d.hpp:189
static constexpr auto Descriptor_draw_order
ComponentDescriptor for the draw_order field.
Definition boxes2d.hpp:113
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition boxes2d.hpp:274
Boxes2D with_many_show_labels(const Collection< rerun::components::ShowLabels > &_show_labels) &&
This method makes it possible to pack multiple show_labels in a single component batch.
Definition boxes2d.hpp:229
static Boxes2D from_centers_and_half_sizes(Collection< components::Position2D > centers, Collection< components::HalfSize2D > half_sizes)
Creates new Boxes2D with centers and half_sizes.
Definition boxes2d.hpp:129
static Boxes2D from_sizes(const std::vector< encodings::Vec2D > &sizes)
Creates new Boxes2D with half_sizes created from (full) sizes.
static Boxes2D from_centers_and_sizes(Collection< components::Position2D > centers, const std::vector< encodings::Vec2D > &sizes)
Creates new Boxes2D with centers and half_sizes created from centers and (full) sizes.
Definition boxes2d.hpp:149
static constexpr auto Descriptor_labels
ComponentDescriptor for the labels field.
Definition boxes2d.hpp:104
static constexpr auto Descriptor_half_sizes
ComponentDescriptor for the half_sizes field.
Definition boxes2d.hpp:87
Boxes2D with_many_draw_order(const Collection< rerun::components::DrawOrder > &_draw_order) &&
This method makes it possible to pack multiple draw_order in a single component batch.
Definition boxes2d.hpp:250
std::optional< ComponentBatch > labels
Optional text labels for the boxes.
Definition boxes2d.hpp:63
std::optional< ComponentBatch > colors
Optional colors for the boxes.
Definition boxes2d.hpp:54
Boxes2D with_radii(const Collection< rerun::components::Radius > &_radii) &&
Optional radii for the lines that make up the boxes.
Definition boxes2d.hpp:201
static constexpr auto Descriptor_centers
ComponentDescriptor for the centers field.
Definition boxes2d.hpp:92
static Boxes2D from_mins_and_sizes(const std::vector< encodings::Vec2D > &mins, const std::vector< encodings::Vec2D > &sizes)
Creates new Boxes2D with half_sizes and centers created from minimums and (full) sizes.
static Boxes2D from_half_sizes(Collection< components::HalfSize2D > half_sizes)
Creates new Boxes2D with half_sizes centered around the local origin.
Definition boxes2d.hpp:124
Boxes2D with_show_labels(const rerun::components::ShowLabels &_show_labels) &&
Whether the text labels should be shown.
Definition boxes2d.hpp:219
std::optional< ComponentBatch > class_ids
Optional components::ClassIds for the boxes.
Definition boxes2d.hpp:80
Component: Draw order of 2D elements.
Definition draw_order.hpp:30
Component: Whether the entity's components::Text label is shown.
Definition show_labels.hpp:18