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_strips2d_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_strip2d_ui_radius");
62 /// rec.spawn().exit_on_failure();
63 ///
64 /// // A blue line with a scene unit radii of 0.01.
65 /// rerun::LineStrip2D linestrip_blue({{0.f, 0.f}, {0.f, 1.f}, {1.f, 0.f}, {1.f, 1.f}});
66 /// rec.log(
67 /// "scene_unit_line",
68 /// rerun::LineStrips2D(linestrip_blue)
69 /// // By default, radii are interpreted as world-space units.
70 /// .with_radii(0.01f)
71 /// .with_colors(rerun::Color(0, 0, 255))
72 /// );
73 ///
74 /// // A red line with a ui point radii of 5.
75 /// // UI points are independent of zooming in Views, but are sensitive to the application UI scaling.
76 /// // For 100 % ui scaling, UI points are equal to pixels.
77 /// rerun::LineStrip2D linestrip_red({{3.f, 0.f}, {3.f, 1.f}, {4.f, 0.f}, {4.f, 1.f}});
78 /// rec.log(
79 /// "ui_points_line",
80 /// rerun::LineStrips2D(linestrip_red)
81 /// // By default, radii are interpreted as world-space units.
82 /// .with_radii(rerun::Radius::ui_points(5.0f))
83 /// .with_colors(rerun::Color(255, 0, 0))
84 /// );
85 ///
86 /// // TODO(#5520): log VisualBounds2D
87 /// }
88 /// ```
89 struct LineStrips2D {
90 /// All the actual 2D line strips that make up the batch.
92
93 /// Optional radii for the line strips.
94 std::optional<Collection<rerun::components::Radius>> radii;
95
96 /// Optional colors for the line strips.
97 std::optional<Collection<rerun::components::Color>> colors;
98
99 /// Optional text labels for the line strips.
100 ///
101 /// If there's a single label present, it will be placed at the center of the entity.
102 /// Otherwise, each instance will have its own label.
103 std::optional<Collection<rerun::components::Text>> labels;
104
105 /// Optional choice of whether the text labels should be shown by default.
106 std::optional<rerun::components::ShowLabels> show_labels;
107
108 /// An optional floating point value that specifies the 2D drawing order of each line strip.
109 ///
110 /// Objects with higher values are drawn on top of those with lower values.
111 std::optional<rerun::components::DrawOrder> draw_order;
112
113 /// Optional `components::ClassId`s for the lines.
114 ///
115 /// The `components::ClassId` provides colors and labels if not specified explicitly.
116 std::optional<Collection<rerun::components::ClassId>> class_ids;
117
118 public:
119 static constexpr const char IndicatorComponentName[] =
120 "rerun.components.LineStrips2DIndicator";
121
122 /// Indicator component, used to identify the archetype when converting to a list of components.
124
125 public:
126 LineStrips2D() = default;
127 LineStrips2D(LineStrips2D&& other) = default;
128
130 : strips(std::move(_strips)) {}
131
132 /// Optional radii for the line strips.
134 radii = std::move(_radii);
135 // See: https://github.com/rerun-io/rerun/issues/4027
136 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
137 }
138
139 /// Optional colors for the line strips.
141 colors = std::move(_colors);
142 // See: https://github.com/rerun-io/rerun/issues/4027
143 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
144 }
145
146 /// Optional text labels for the line strips.
147 ///
148 /// If there's a single label present, it will be placed at the center of the entity.
149 /// Otherwise, each instance will have its own label.
151 labels = std::move(_labels);
152 // See: https://github.com/rerun-io/rerun/issues/4027
153 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
154 }
155
156 /// Optional choice of whether the text labels should be shown by default.
158 show_labels = std::move(_show_labels);
159 // See: https://github.com/rerun-io/rerun/issues/4027
160 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
161 }
162
163 /// An optional floating point value that specifies the 2D drawing order of each line strip.
164 ///
165 /// Objects with higher values are drawn on top of those with lower values.
167 draw_order = std::move(_draw_order);
168 // See: https://github.com/rerun-io/rerun/issues/4027
169 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
170 }
171
172 /// Optional `components::ClassId`s for the lines.
173 ///
174 /// The `components::ClassId` provides colors and labels if not specified explicitly.
176 class_ids = std::move(_class_ids);
177 // See: https://github.com/rerun-io/rerun/issues/4027
178 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
179 }
180 };
181
182} // namespace rerun::archetypes
183
184namespace rerun {
185 /// \private
186 template <typename T>
187 struct AsComponents;
188
189 /// \private
190 template <>
191 struct AsComponents<archetypes::LineStrips2D> {
192 /// Serialize all set component batches.
193 static Result<std::vector<ComponentBatch>> serialize(
194 const archetypes::LineStrips2D& archetype
195 );
196 };
197} // 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:77
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Archetype: 2D line strips with positions and optional colors, radii, labels, etc.
Definition line_strips2d.hpp:89
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:166
LineStrips2D with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the line strips.
Definition line_strips2d.hpp:150
LineStrips2D with_radii(Collection< rerun::components::Radius > _radii) &&
Optional radii for the line strips.
Definition line_strips2d.hpp:133
LineStrips2D with_class_ids(Collection< rerun::components::ClassId > _class_ids) &&
Optional components::ClassIds for the lines.
Definition line_strips2d.hpp:175
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:111
std::optional< Collection< rerun::components::ClassId > > class_ids
Optional components::ClassIds for the lines.
Definition line_strips2d.hpp:116
LineStrips2D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the line strips.
Definition line_strips2d.hpp:140
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:157
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the line strips.
Definition line_strips2d.hpp:103
std::optional< Collection< rerun::components::Radius > > radii
Optional radii for the line strips.
Definition line_strips2d.hpp:94
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the line strips.
Definition line_strips2d.hpp:97
Collection< rerun::components::LineStrip2D > strips
All the actual 2D line strips that make up the batch.
Definition line_strips2d.hpp:91
std::optional< rerun::components::ShowLabels > show_labels
Optional choice of whether the text labels should be shown by default.
Definition line_strips2d.hpp:106
Component: Draw order of 2D elements.
Definition draw_order.hpp:20
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: Whether the entity's components::Text label is shown.
Definition show_labels.hpp:19