Rerun C++ SDK
Loading...
Searching...
No Matches
line_strips2d.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/line_strips2d.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/line_strip2d.hpp"
13#include "../components/radius.hpp"
14#include "../components/show_labels.hpp"
15#include "../components/text.hpp"
16#include "../indicator_component.hpp"
17#include "../result.hpp"
18
19#include <cstdint>
20#include <optional>
21#include <utility>
22#include <vector>
23
24namespace rerun::archetypes {
25 /// **Archetype**: 2D line strips with positions and optional colors, radii, labels, etc.
26 ///
27 /// ## Examples
28 ///
29 /// ### line_strip2d_batch:
30 /// ![image](https://static.rerun.io/line_strip2d_batch/c6f4062bcf510462d298a5dfe9fdbe87c754acee/full.png)
31 ///
32 /// ```cpp
33 /// #include <rerun.hpp>
34 ///
35 /// #include <vector>
36 ///
37 /// int main() {
38 /// const auto rec = rerun::RecordingStream("rerun_example_line_strip2d_batch");
39 /// rec.spawn().exit_on_failure();
40 ///
41 /// rerun::Collection<rerun::Vec2D> strip1 = {{0.f, 0.f}, {2.f, 1.f}, {4.f, -1.f}, {6.f, 0.f}};
42 /// rerun::Collection<rerun::Vec2D> strip2 =
43 /// {{0.f, 3.f}, {1.f, 4.f}, {2.f, 2.f}, {3.f, 4.f}, {4.f, 2.f}, {5.f, 4.f}, {6.f, 3.f}};
44 /// rec.log(
45 /// "strips",
46 /// rerun::LineStrips2D({strip1, strip2})
47 /// .with_colors({0xFF0000FF, 0x00FF00FF})
48 /// .with_radii({0.025f, 0.005f})
49 /// .with_labels({"one strip here", "and one strip there"})
50 /// );
51 ///
52 /// // TODO(#5520): log VisualBounds2D
53 /// }
54 /// ```
55 ///
56 /// ### Lines with scene & UI radius each
57 /// ```cpp
58 /// #include <rerun.hpp>
59 ///
60 /// int main() {
61 /// const auto rec = rerun::RecordingStream("rerun_example_line_strip3d_ui_radius");
62 /// rec.spawn().exit_on_failure();
63 ///
64 /// // A blue line with a scene unit radii of 0.01.
65 /// rerun::LineStrip3D linestrip_blue(
66 /// {{0.f, 0.f, 0.f}, {0.f, 0.f, 1.f}, {1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}}
67 /// );
68 /// rec.log(
69 /// "scene_unit_line",
70 /// rerun::LineStrips3D(linestrip_blue)
71 /// // By default, radii are interpreted as world-space units.
72 /// .with_radii(0.01f)
73 /// .with_colors(rerun::Color(0, 0, 255))
74 /// );
75 ///
76 /// // A red line with a ui point radii of 5.
77 /// // UI points are independent of zooming in Views, but are sensitive to the application UI scaling.
78 /// // For 100 % ui scaling, UI points are equal to pixels.
79 /// rerun::LineStrip3D linestrip_red(
80 /// {{3.f, 0.f, 0.f}, {3.f, 0.f, 1.f}, {4.f, 0.f, 0.f}, {4.f, 0.f, 1.f}}
81 /// );
82 /// rec.log(
83 /// "ui_points_line",
84 /// rerun::LineStrips3D(linestrip_red)
85 /// // By default, radii are interpreted as world-space units.
86 /// .with_radii(rerun::Radius::ui_points(5.0f))
87 /// .with_colors(rerun::Color(255, 0, 0))
88 /// );
89 /// }
90 /// ```
91 struct LineStrips2D {
92 /// All the actual 2D line strips that make up the batch.
94
95 /// Optional radii for the line strips.
96 std::optional<Collection<rerun::components::Radius>> radii;
97
98 /// Optional colors for the line strips.
99 std::optional<Collection<rerun::components::Color>> colors;
100
101 /// Optional text labels for the line strips.
102 ///
103 /// If there's a single label present, it will be placed at the center of the entity.
104 /// Otherwise, each instance will have its own label.
105 std::optional<Collection<rerun::components::Text>> labels;
106
107 /// Optional choice of whether the text labels should be shown by default.
108 std::optional<rerun::components::ShowLabels> show_labels;
109
110 /// An optional floating point value that specifies the 2D drawing order of each line strip.
111 ///
112 /// Objects with higher values are drawn on top of those with lower values.
113 std::optional<rerun::components::DrawOrder> draw_order;
114
115 /// Optional `components::ClassId`s for the lines.
116 ///
117 /// The `components::ClassId` provides colors and labels if not specified explicitly.
118 std::optional<Collection<rerun::components::ClassId>> class_ids;
119
120 public:
121 static constexpr const char IndicatorComponentName[] =
122 "rerun.components.LineStrips2DIndicator";
123
124 /// Indicator component, used to identify the archetype when converting to a list of components.
126
127 public:
128 LineStrips2D() = default;
129 LineStrips2D(LineStrips2D&& other) = default;
130
132 : strips(std::move(_strips)) {}
133
134 /// Optional radii for the line strips.
136 radii = std::move(_radii);
137 // See: https://github.com/rerun-io/rerun/issues/4027
138 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
139 }
140
141 /// Optional colors for the line strips.
143 colors = std::move(_colors);
144 // See: https://github.com/rerun-io/rerun/issues/4027
145 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
146 }
147
148 /// Optional text labels for the line strips.
149 ///
150 /// If there's a single label present, it will be placed at the center of the entity.
151 /// Otherwise, each instance will have its own label.
153 labels = std::move(_labels);
154 // See: https://github.com/rerun-io/rerun/issues/4027
155 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
156 }
157
158 /// Optional choice of whether the text labels should be shown by default.
160 show_labels = std::move(_show_labels);
161 // See: https://github.com/rerun-io/rerun/issues/4027
162 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
163 }
164
165 /// An optional floating point value that specifies the 2D drawing order of each line strip.
166 ///
167 /// Objects with higher values are drawn on top of those with lower values.
169 draw_order = std::move(_draw_order);
170 // See: https://github.com/rerun-io/rerun/issues/4027
171 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
172 }
173
174 /// Optional `components::ClassId`s for the lines.
175 ///
176 /// The `components::ClassId` provides colors and labels if not specified explicitly.
178 class_ids = std::move(_class_ids);
179 // See: https://github.com/rerun-io/rerun/issues/4027
180 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
181 }
182 };
183
184} // namespace rerun::archetypes
185
186namespace rerun {
187 /// \private
188 template <typename T>
189 struct AsComponents;
190
191 /// \private
192 template <>
193 struct AsComponents<archetypes::LineStrips2D> {
194 /// Serialize all set component batches.
195 static Result<std::vector<ComponentBatch>> serialize(
196 const archetypes::LineStrips2D& archetype
197 );
198 };
199} // 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 line strips with positions and optional colors, radii, labels, etc.
Definition line_strips2d.hpp:91
LineStrips2D with_draw_order(rerun::components::DrawOrder _draw_order) &&
An optional floating point value that specifies the 2D drawing order of each line strip.
Definition line_strips2d.hpp:168
LineStrips2D with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the line strips.
Definition line_strips2d.hpp:152
LineStrips2D with_radii(Collection< rerun::components::Radius > _radii) &&
Optional radii for the line strips.
Definition line_strips2d.hpp:135
LineStrips2D with_class_ids(Collection< rerun::components::ClassId > _class_ids) &&
Optional components::ClassIds for the lines.
Definition line_strips2d.hpp:177
std::optional< rerun::components::DrawOrder > draw_order
An optional floating point value that specifies the 2D drawing order of each line strip.
Definition line_strips2d.hpp:113
std::optional< Collection< rerun::components::ClassId > > class_ids
Optional components::ClassIds for the lines.
Definition line_strips2d.hpp:118
LineStrips2D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the line strips.
Definition line_strips2d.hpp:142
LineStrips2D with_show_labels(rerun::components::ShowLabels _show_labels) &&
Optional choice of whether the text labels should be shown by default.
Definition line_strips2d.hpp:159
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the line strips.
Definition line_strips2d.hpp:105
std::optional< Collection< rerun::components::Radius > > radii
Optional radii for the line strips.
Definition line_strips2d.hpp:96
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the line strips.
Definition line_strips2d.hpp:99
Collection< rerun::components::LineStrip2D > strips
All the actual 2D line strips that make up the batch.
Definition line_strips2d.hpp:93
std::optional< rerun::components::ShowLabels > show_labels
Optional choice of whether the text labels should be shown by default.
Definition line_strips2d.hpp:108
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