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