Rerun C++ SDK
Loading...
Searching...
No Matches
spatial_information.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/build/re_type_definitions/rerun/blueprint/archetypes/spatial_information.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/enabled.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../components/transform_frame_id.hpp"
12#include "../../components/view_coordinates.hpp"
13#include "../../result.hpp"
14
15#include <cstdint>
16#include <optional>
17#include <utility>
18#include <vector>
19
20namespace rerun::blueprint::archetypes {
21 /// **Archetype**: Configures spatial view properties.
22 ///
23 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
24 ///
26 /// The target reference frame for all transformations.
27 ///
28 /// Defaults to the coordinate frame used by the space origin entity.
29 std::optional<ComponentBatch> target_frame;
30
31 /// Whether the bounding box should be shown.
32 std::optional<ComponentBatch> show_bounding_box;
33
34 /// Whether axes should be shown at the origin.
35 std::optional<ComponentBatch> show_axes;
36
37 /// Controls the orientation of the axes in a 3D view; it has no effect in a 2D view.
38 ///
39 /// This determines the 3D eye orientation, navigation, and default grid plane.
40 ///
41 /// The three directions are always ordered as [x, y, z] and specify where each positive axis points.
42 /// For example, [Right, Down, Forward] means that +X points right, +Y points down, and +Z points forward.
43 ///
44 /// When this property is unset, a 3D view first uses `archetypes::ViewCoordinates` logged at its origin entity or the closest ancestor.
45 /// If none is found, it uses the camera orientation from the closest ancestor `archetypes::Pinhole`.
46 /// If neither is found, the fallback is RFU.
47 ///
48 /// This property is hidden from the selection panel for 2D views.
49 ///
50 /// ⚠ [Rerun does not yet support left-handed coordinate systems](https://github.com/rerun-io/rerun/issues/5032).
51 std::optional<ComponentBatch> axes;
52
53 public:
54 /// The name of the archetype as used in `ComponentDescriptor`s.
55 static constexpr const char ArchetypeName[] =
56 "rerun.blueprint.archetypes.SpatialInformation";
57
58 /// `ComponentDescriptor` for the `target_frame` field.
60 ArchetypeName, "SpatialInformation:target_frame",
62 );
63 /// `ComponentDescriptor` for the `show_bounding_box` field.
65 ArchetypeName, "SpatialInformation:show_bounding_box",
67 );
68 /// `ComponentDescriptor` for the `show_axes` field.
70 ArchetypeName, "SpatialInformation:show_axes",
72 );
73 /// `ComponentDescriptor` for the `axes` field.
74 static constexpr auto Descriptor_axes = ComponentDescriptor(
75 ArchetypeName, "SpatialInformation:axes",
77 );
78
79 public:
80 SpatialInformation() = default;
81 SpatialInformation(SpatialInformation&& other) = default;
82 SpatialInformation(const SpatialInformation& other) = default;
83 SpatialInformation& operator=(const SpatialInformation& other) = default;
84 SpatialInformation& operator=(SpatialInformation&& other) = default;
85
88 ComponentBatch::from_loggable(std::move(_target_frame), Descriptor_target_frame)
89 .value_or_throw()
90 ) {}
91
92 /// Update only some specific fields of a `SpatialInformation`.
94 return SpatialInformation();
95 }
96
97 /// Clear all the fields of a `SpatialInformation`.
99
100 /// The target reference frame for all transformations.
101 ///
102 /// Defaults to the coordinate frame used by the space origin entity.
104 const rerun::components::TransformFrameId& _target_frame
105 ) && {
107 .value_or_throw();
108 return std::move(*this);
109 }
110
111 /// Whether the bounding box should be shown.
113 const rerun::blueprint::components::Enabled& _show_bounding_box
114 ) && {
117 .value_or_throw();
118 return std::move(*this);
119 }
120
121 /// Whether axes should be shown at the origin.
123 ) && {
124 show_axes =
125 ComponentBatch::from_loggable(_show_axes, Descriptor_show_axes).value_or_throw();
126 return std::move(*this);
127 }
128
129 /// Controls the orientation of the axes in a 3D view; it has no effect in a 2D view.
130 ///
131 /// This determines the 3D eye orientation, navigation, and default grid plane.
132 ///
133 /// The three directions are always ordered as [x, y, z] and specify where each positive axis points.
134 /// For example, [Right, Down, Forward] means that +X points right, +Y points down, and +Z points forward.
135 ///
136 /// When this property is unset, a 3D view first uses `archetypes::ViewCoordinates` logged at its origin entity or the closest ancestor.
137 /// If none is found, it uses the camera orientation from the closest ancestor `archetypes::Pinhole`.
138 /// If neither is found, the fallback is RFU.
139 ///
140 /// This property is hidden from the selection panel for 2D views.
141 ///
142 /// ⚠ [Rerun does not yet support left-handed coordinate systems](https://github.com/rerun-io/rerun/issues/5032).
144 axes = ComponentBatch::from_loggable(_axes, Descriptor_axes).value_or_throw();
145 return std::move(*this);
146 }
147
148 /// Partitions the component data into multiple sub-batches.
149 ///
150 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
151 /// instead, via `ComponentBatch::partitioned`.
152 ///
153 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
154 ///
155 /// The specified `lengths` must sum to the total length of the component batch.
157 return detail::partition_batches(
159 lengths_
160 )
161 .value_or_throw();
162 }
163
164 /// Partitions the component data into unit-length sub-batches.
165 ///
166 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
167 /// where `n` is automatically guessed.
169 return detail::partition_batches_of_unit_length(
171 )
172 .value_or_throw();
173 }
174 };
175
176} // namespace rerun::blueprint::archetypes
177
178namespace rerun {
179 /// \private
180 template <typename T>
181 struct AsComponents;
182
183 /// \private
184 template <>
185 struct AsComponents<blueprint::archetypes::SpatialInformation> {
186 /// Serialize all set component batches.
187 static Result<Collection<ComponentBatch>> as_batches(
189 ) {
190 return detail::collect_batches(
191 {&archetype.target_frame,
192 &archetype.show_bounding_box,
193 &archetype.show_axes,
194 &archetype.axes}
195 );
196 }
197 };
198} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
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: Configures spatial view properties.
Definition spatial_information.hpp:25
static SpatialInformation update_fields()
Update only some specific fields of a SpatialInformation.
Definition spatial_information.hpp:93
static constexpr auto Descriptor_show_axes
ComponentDescriptor for the show_axes field.
Definition spatial_information.hpp:69
static constexpr auto Descriptor_axes
ComponentDescriptor for the axes field.
Definition spatial_information.hpp:74
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition spatial_information.hpp:55
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition spatial_information.hpp:168
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition spatial_information.hpp:156
static constexpr auto Descriptor_show_bounding_box
ComponentDescriptor for the show_bounding_box field.
Definition spatial_information.hpp:64
SpatialInformation with_show_bounding_box(const rerun::blueprint::components::Enabled &_show_bounding_box) &&
Whether the bounding box should be shown.
Definition spatial_information.hpp:112
static SpatialInformation clear_fields()
Clear all the fields of a SpatialInformation.
std::optional< ComponentBatch > show_axes
Whether axes should be shown at the origin.
Definition spatial_information.hpp:35
std::optional< ComponentBatch > show_bounding_box
Whether the bounding box should be shown.
Definition spatial_information.hpp:32
std::optional< ComponentBatch > target_frame
The target reference frame for all transformations.
Definition spatial_information.hpp:29
SpatialInformation with_target_frame(const rerun::components::TransformFrameId &_target_frame) &&
The target reference frame for all transformations.
Definition spatial_information.hpp:103
static constexpr auto Descriptor_target_frame
ComponentDescriptor for the target_frame field.
Definition spatial_information.hpp:59
SpatialInformation with_axes(const rerun::components::ViewCoordinates &_axes) &&
Controls the orientation of the axes in a 3D view; it has no effect in a 2D view.
Definition spatial_information.hpp:143
SpatialInformation with_show_axes(const rerun::blueprint::components::Enabled &_show_axes) &&
Whether axes should be shown at the origin.
Definition spatial_information.hpp:122
std::optional< ComponentBatch > axes
Controls the orientation of the axes in a 3D view; it has no effect in a 2D view.
Definition spatial_information.hpp:51
Component: Whether a procedure is enabled.
Definition enabled.hpp:17
Component: A string identifier for a transform frame.
Definition transform_frame_id.hpp:24
Component: An orientation convention for a camera or 3D view.
Definition view_coordinates.hpp:28