Rerun C++ SDK
Loading...
Searching...
No Matches
line_strips2d.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/archetypes/line_strips2d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../components/class_id.hpp"
9#include "../components/color.hpp"
10#include "../components/draw_order.hpp"
11#include "../components/instance_key.hpp"
12#include "../components/line_strip2d.hpp"
13#include "../components/radius.hpp"
14#include "../components/text.hpp"
15#include "../data_cell.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 /// ## Example
28 ///
29 /// ### line_strip2d_batch:
30 /// ![image](https://static.rerun.io/line_strip2d_batch/d8aae7ca3d6c3b0e3b636de60b8067fa2f0b6db9/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");
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 /// // Log an extra rect to set the view bounds
53 /// rec.log("bounds", rerun::Boxes2D::from_centers_and_sizes({{3.0f, 1.5f}}, {{8.0f, 9.0f}}));
54 /// }
55 /// ```
56 struct LineStrips2D {
57 /// All the actual 2D line strips that make up the batch.
59
60 /// Optional radii for the line strips.
61 std::optional<Collection<rerun::components::Radius>> radii;
62
63 /// Optional colors for the line strips.
64 std::optional<Collection<rerun::components::Color>> colors;
65
66 /// Optional text labels for the line strips.
67 std::optional<Collection<rerun::components::Text>> labels;
68
69 /// An optional floating point value that specifies the 2D drawing order of each line strip.
70 ///
71 /// Objects with higher values are drawn on top of those with lower values.
72 std::optional<rerun::components::DrawOrder> draw_order;
73
74 /// Optional `ClassId`s for the lines.
75 ///
76 /// The class ID provides colors and labels if not specified explicitly.
77 std::optional<Collection<rerun::components::ClassId>> class_ids;
78
79 /// Unique identifiers for each individual line strip in the batch.
80 std::optional<Collection<rerun::components::InstanceKey>> instance_keys;
81
82 public:
83 static constexpr const char IndicatorComponentName[] =
84 "rerun.components.LineStrips2DIndicator";
85
86 /// Indicator component, used to identify the archetype when converting to a list of components.
88
89 public:
90 LineStrips2D() = default;
91 LineStrips2D(LineStrips2D&& other) = default;
92
94 : strips(std::move(_strips)) {}
95
96 /// Optional radii for the line strips.
98 radii = std::move(_radii);
99 // See: https://github.com/rerun-io/rerun/issues/4027
100 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
101 }
102
103 /// Optional colors for the line strips.
105 colors = std::move(_colors);
106 // See: https://github.com/rerun-io/rerun/issues/4027
107 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
108 }
109
110 /// Optional text labels for the line strips.
112 labels = std::move(_labels);
113 // See: https://github.com/rerun-io/rerun/issues/4027
114 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
115 }
116
117 /// An optional floating point value that specifies the 2D drawing order of each line strip.
118 ///
119 /// Objects with higher values are drawn on top of those with lower values.
121 draw_order = std::move(_draw_order);
122 // See: https://github.com/rerun-io/rerun/issues/4027
123 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
124 }
125
126 /// Optional `ClassId`s for the lines.
127 ///
128 /// The class ID provides colors and labels if not specified explicitly.
130 class_ids = std::move(_class_ids);
131 // See: https://github.com/rerun-io/rerun/issues/4027
132 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
133 }
134
135 /// Unique identifiers for each individual line strip in the batch.
137 ) && {
138 instance_keys = std::move(_instance_keys);
139 // See: https://github.com/rerun-io/rerun/issues/4027
140 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
141 }
142
143 /// Returns the number of primary instances of this archetype.
144 size_t num_instances() const {
145 return strips.size();
146 }
147 };
148
149} // namespace rerun::archetypes
150
151namespace rerun {
152 /// \private
153 template <typename T>
154 struct AsComponents;
155
156 /// \private
157 template <>
158 struct AsComponents<archetypes::LineStrips2D> {
159 /// Serialize all set component batches.
160 static Result<std::vector<DataCell>> serialize(const archetypes::LineStrips2D& archetype);
161 };
162} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:47
size_t size() const
Returns the number of instances in this collection.
Definition collection.hpp:254
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:66
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Archetype: 2D line strips with positions and optional colors, radii, labels, etc.
Definition line_strips2d.hpp:56
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:120
LineStrips2D with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the line strips.
Definition line_strips2d.hpp:111
std::optional< Collection< rerun::components::InstanceKey > > instance_keys
Unique identifiers for each individual line strip in the batch.
Definition line_strips2d.hpp:80
LineStrips2D with_radii(Collection< rerun::components::Radius > _radii) &&
Optional radii for the line strips.
Definition line_strips2d.hpp:97
LineStrips2D with_class_ids(Collection< rerun::components::ClassId > _class_ids) &&
Optional ClassIds for the lines.
Definition line_strips2d.hpp:129
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:72
std::optional< Collection< rerun::components::ClassId > > class_ids
Optional ClassIds for the lines.
Definition line_strips2d.hpp:77
LineStrips2D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the line strips.
Definition line_strips2d.hpp:104
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the line strips.
Definition line_strips2d.hpp:67
std::optional< Collection< rerun::components::Radius > > radii
Optional radii for the line strips.
Definition line_strips2d.hpp:61
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the line strips.
Definition line_strips2d.hpp:64
Collection< rerun::components::LineStrip2D > strips
All the actual 2D line strips that make up the batch.
Definition line_strips2d.hpp:58
LineStrips2D with_instance_keys(Collection< rerun::components::InstanceKey > _instance_keys) &&
Unique identifiers for each individual line strip in the batch.
Definition line_strips2d.hpp:136
size_t num_instances() const
Returns the number of primary instances of this archetype.
Definition line_strips2d.hpp:144
Component: Draw order used for the display order of 2D elements.
Definition draw_order.hpp:30
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:23