Rerun C++ SDK
Loading...
Searching...
No Matches
arrows2d.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/store/re_types/definitions/rerun/archetypes/arrows2d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/class_id.hpp"
10#include "../components/color.hpp"
11#include "../components/draw_order.hpp"
12#include "../components/position2d.hpp"
13#include "../components/radius.hpp"
14#include "../components/show_labels.hpp"
15#include "../components/text.hpp"
16#include "../components/vector2d.hpp"
17#include "../indicator_component.hpp"
18#include "../result.hpp"
19
20#include <cstdint>
21#include <optional>
22#include <utility>
23#include <vector>
24
25namespace rerun::archetypes {
26 /// **Archetype**: 2D arrows with optional colors, radii, labels, etc.
27 ///
28 /// ## Example
29 ///
30 /// ### Simple batch of 2D arrows
31 /// ![image](https://static.rerun.io/arrow2d_simple/59f044ccc03f7bc66ee802288f75706618b29a6e/full.png)
32 ///
33 /// ```cpp
34 /// #include <rerun.hpp>
35 ///
36 /// int main() {
37 /// const auto rec = rerun::RecordingStream("rerun_example_arrow2d");
38 /// rec.spawn().exit_on_failure();
39 ///
40 /// rec.log(
41 /// "arrows",
42 /// rerun::Arrows2D::from_vectors({{1.0f, 0.0f}, {0.0f, -1.0f}, {-0.7f, 0.7f}})
43 /// .with_radii(0.025f)
44 /// .with_origins({{0.25f, 0.0f}, {0.25f, 0.0f}, {-0.1f, -0.1f}})
45 /// .with_colors({{255, 0, 0}, {0, 255, 0}, {127, 0, 255}})
46 /// .with_labels({"right", "up", "left-down"})
47 /// );
48 /// }
49 /// ```
50 struct Arrows2D {
51 /// All the vectors for each arrow in the batch.
53
54 /// All the origin (base) positions for each arrow in the batch.
55 ///
56 /// If no origins are set, (0, 0) is used as the origin for each arrow.
57 std::optional<Collection<rerun::components::Position2D>> origins;
58
59 /// Optional radii for the arrows.
60 ///
61 /// The shaft is rendered as a line with `radius = 0.5 * radius`.
62 /// The tip is rendered with `height = 2.0 * radius` and `radius = 1.0 * radius`.
63 std::optional<Collection<rerun::components::Radius>> radii;
64
65 /// Optional colors for the points.
66 std::optional<Collection<rerun::components::Color>> colors;
67
68 /// Optional text labels for the arrows.
69 ///
70 /// If there's a single label present, it will be placed at the center of the entity.
71 /// Otherwise, each instance will have its own label.
72 std::optional<Collection<rerun::components::Text>> labels;
73
74 /// Optional choice of whether the text labels should be shown by default.
75 std::optional<rerun::components::ShowLabels> show_labels;
76
77 /// An optional floating point value that specifies the 2D drawing order.
78 ///
79 /// Objects with higher values are drawn on top of those with lower values.
80 std::optional<rerun::components::DrawOrder> draw_order;
81
82 /// Optional class Ids for the points.
83 ///
84 /// The `components::ClassId` provides colors and labels if not specified explicitly.
85 std::optional<Collection<rerun::components::ClassId>> class_ids;
86
87 public:
88 static constexpr const char IndicatorComponentName[] = "rerun.components.Arrows2DIndicator";
89
90 /// Indicator component, used to identify the archetype when converting to a list of components.
92
93 public: // START of extensions from arrows2d_ext.cpp:
94 /// Creates new 2D arrows pointing in the given directions, with a base at the origin (0, 0).
96 Arrows2D arrows;
97 arrows.vectors = std::move(vectors_);
98 return arrows;
99 }
100
101 // END of extensions from arrows2d_ext.cpp, start of generated code:
102
103 public:
104 Arrows2D() = default;
105 Arrows2D(Arrows2D&& other) = default;
106
107 /// All the origin (base) positions for each arrow in the batch.
108 ///
109 /// If no origins are set, (0, 0) is used as the origin for each arrow.
111 origins = std::move(_origins);
112 // See: https://github.com/rerun-io/rerun/issues/4027
113 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
114 }
115
116 /// Optional radii for the arrows.
117 ///
118 /// The shaft is rendered as a line with `radius = 0.5 * radius`.
119 /// The tip is rendered with `height = 2.0 * radius` and `radius = 1.0 * radius`.
121 radii = std::move(_radii);
122 // See: https://github.com/rerun-io/rerun/issues/4027
123 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
124 }
125
126 /// Optional colors for the points.
128 colors = std::move(_colors);
129 // See: https://github.com/rerun-io/rerun/issues/4027
130 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
131 }
132
133 /// Optional text labels for the arrows.
134 ///
135 /// If there's a single label present, it will be placed at the center of the entity.
136 /// Otherwise, each instance will have its own label.
138 labels = std::move(_labels);
139 // See: https://github.com/rerun-io/rerun/issues/4027
140 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
141 }
142
143 /// Optional choice of whether the text labels should be shown by default.
145 show_labels = std::move(_show_labels);
146 // See: https://github.com/rerun-io/rerun/issues/4027
147 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
148 }
149
150 /// An optional floating point value that specifies the 2D drawing order.
151 ///
152 /// Objects with higher values are drawn on top of those with lower values.
154 draw_order = std::move(_draw_order);
155 // See: https://github.com/rerun-io/rerun/issues/4027
156 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
157 }
158
159 /// Optional class Ids for the points.
160 ///
161 /// The `components::ClassId` provides colors and labels if not specified explicitly.
163 class_ids = std::move(_class_ids);
164 // See: https://github.com/rerun-io/rerun/issues/4027
165 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
166 }
167 };
168
169} // namespace rerun::archetypes
170
171namespace rerun {
172 /// \private
173 template <typename T>
174 struct AsComponents;
175
176 /// \private
177 template <>
178 struct AsComponents<archetypes::Arrows2D> {
179 /// Serialize all set component batches.
180 static Result<std::vector<ComponentBatch>> serialize(const archetypes::Arrows2D& archetype);
181 };
182} // namespace rerun
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:76
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Archetype: 2D arrows with optional colors, radii, labels, etc.
Definition arrows2d.hpp:50
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the arrows.
Definition arrows2d.hpp:72
std::optional< Collection< rerun::components::Position2D > > origins
All the origin (base) positions for each arrow in the batch.
Definition arrows2d.hpp:57
Arrows2D with_radii(Collection< rerun::components::Radius > _radii) &&
Optional radii for the arrows.
Definition arrows2d.hpp:120
static Arrows2D from_vectors(Collection< components::Vector2D > vectors_)
Creates new 2D arrows pointing in the given directions, with a base at the origin (0,...
Definition arrows2d.hpp:95
Arrows2D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the points.
Definition arrows2d.hpp:127
std::optional< rerun::components::DrawOrder > draw_order
An optional floating point value that specifies the 2D drawing order.
Definition arrows2d.hpp:80
std::optional< Collection< rerun::components::ClassId > > class_ids
Optional class Ids for the points.
Definition arrows2d.hpp:85
Arrows2D with_draw_order(rerun::components::DrawOrder _draw_order) &&
An optional floating point value that specifies the 2D drawing order.
Definition arrows2d.hpp:153
std::optional< Collection< rerun::components::Radius > > radii
Optional radii for the arrows.
Definition arrows2d.hpp:63
std::optional< rerun::components::ShowLabels > show_labels
Optional choice of whether the text labels should be shown by default.
Definition arrows2d.hpp:75
Arrows2D with_show_labels(rerun::components::ShowLabels _show_labels) &&
Optional choice of whether the text labels should be shown by default.
Definition arrows2d.hpp:144
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the points.
Definition arrows2d.hpp:66
Arrows2D with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the arrows.
Definition arrows2d.hpp:137
Arrows2D with_origins(Collection< rerun::components::Position2D > _origins) &&
All the origin (base) positions for each arrow in the batch.
Definition arrows2d.hpp:110
Collection< rerun::components::Vector2D > vectors
All the vectors for each arrow in the batch.
Definition arrows2d.hpp:52
Arrows2D with_class_ids(Collection< rerun::components::ClassId > _class_ids) &&
Optional class Ids for the points.
Definition arrows2d.hpp:162
Component: Draw order of 2D elements.
Definition draw_order.hpp:19
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30
Component: Whether the entity's components::Text label is shown.
Definition show_labels.hpp:18