Rerun C++ SDK
Loading...
Searching...
No Matches
series_point.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/series_point.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/color.hpp"
11#include "../components/marker_shape.hpp"
12#include "../components/marker_size.hpp"
13#include "../components/name.hpp"
14#include "../components/series_visible.hpp"
15#include "../indicator_component.hpp"
16#include "../result.hpp"
17
18#include <cstdint>
19#include <optional>
20#include <utility>
21#include <vector>
22
23RR_PUSH_WARNINGS
24RR_DISABLE_DEPRECATION_WARNING
25
26namespace rerun::archetypes {
27 /// **Archetype**: Define the style properties for a point series in a chart.
28 ///
29 /// This archetype only provides styling information and should be logged as static
30 /// when possible. The underlying data needs to be logged to the same entity-path using
31 /// `archetypes::Scalars`.
32 ///
33 /// ## Example
34 ///
35 /// ### Point series
36 /// ![image](https://static.rerun.io/series_point_style/82207a705da6c086b28ce161db1db9e8b12258b7/full.png)
37 ///
38 /// ```cpp
39 /// #include <rerun.hpp>
40 ///
41 /// #include <cmath>
42 ///
43 /// constexpr float TAU = 6.28318530717958647692528676655900577f;
44 ///
45 /// int main() {
46 /// const auto rec = rerun::RecordingStream("rerun_example_series_point_style");
47 /// rec.spawn().exit_on_failure();
48 ///
49 /// // Set up plot styling:
50 /// // They are logged static as they don't change over time and apply to all timelines.
51 /// // Log two point series under a shared root so that they show in the same plot by default.
52 /// rec.log_static(
53 /// "trig/sin",
54 /// rerun::SeriesPoints()
55 /// .with_colors(rerun::Rgba32{255, 0, 0})
56 /// .with_names("sin(0.01t)")
57 /// .with_markers(rerun::components::MarkerShape::Circle)
58 /// .with_marker_sizes(4.0f)
59 /// );
60 /// rec.log_static(
61 /// "trig/cos",
62 /// rerun::SeriesPoints()
63 /// .with_colors(rerun::Rgba32{0, 255, 0})
64 /// .with_names("cos(0.01t)")
65 /// .with_markers(rerun::components::MarkerShape::Cross)
66 /// .with_marker_sizes(2.0f)
67 /// );
68 ///
69 /// // Log the data on a timeline called "step".
70 /// for (int t = 0; t <static_cast<int>(TAU * 2.0 * 10.0); ++t) {
71 /// rec.set_time_sequence("step", t);
72 ///
73 /// rec.log("trig/sin", rerun::Scalars(sin(static_cast<double>(t) / 10.0)));
74 /// rec.log("trig/cos", rerun::Scalars(cos(static_cast<double>(t) / 10.0)));
75 /// }
76 /// }
77 /// ```
78 ///
79 /// ⚠ **Deprecated since 0.23.0**: Use `SeriesPoints` instead.
80 ///
81 struct [[deprecated("since 0.23.0: Use `SeriesPoints` instead.")]] SeriesPoint {
82 /// Color for the corresponding series.
83 std::optional<ComponentBatch> color;
84
85 /// What shape to use to represent the point
86 std::optional<ComponentBatch> marker;
87
88 /// Display name of the series.
89 ///
90 /// Used in the legend.
91 std::optional<ComponentBatch> name;
92
93 /// Which point series are visible.
94 ///
95 /// If not set, all point series on this entity are visible.
96 /// Unlike with the regular visibility property of the entire entity, any series that is hidden
97 /// via this property will still be visible in the legend.
98 std::optional<ComponentBatch> visible_series;
99
100 /// Size of the marker.
101 std::optional<ComponentBatch> marker_size;
102
103 public:
104 static constexpr const char IndicatorComponentName[] =
105 "rerun.components.SeriesPointIndicator";
106
107 /// Indicator component, used to identify the archetype when converting to a list of components.
109 /// The name of the archetype as used in `ComponentDescriptor`s.
110 static constexpr const char ArchetypeName[] = "rerun.archetypes.SeriesPoint";
111
112 /// `ComponentDescriptor` for the `color` field.
113 static constexpr auto Descriptor_color = ComponentDescriptor(
114 ArchetypeName, "color", Loggable<rerun::components::Color>::Descriptor.component_name
115 );
116 /// `ComponentDescriptor` for the `marker` field.
117 static constexpr auto Descriptor_marker = ComponentDescriptor(
118 ArchetypeName, "marker",
120 );
121 /// `ComponentDescriptor` for the `name` field.
122 static constexpr auto Descriptor_name = ComponentDescriptor(
123 ArchetypeName, "name", Loggable<rerun::components::Name>::Descriptor.component_name
124 );
125 /// `ComponentDescriptor` for the `visible_series` field.
126 static constexpr auto Descriptor_visible_series = ComponentDescriptor(
127 ArchetypeName, "visible_series",
129 );
130 /// `ComponentDescriptor` for the `marker_size` field.
131 static constexpr auto Descriptor_marker_size = ComponentDescriptor(
132 ArchetypeName, "marker_size",
134 );
135
136 public:
137 SeriesPoint() = default;
138 SeriesPoint(SeriesPoint&& other) = default;
139 SeriesPoint(const SeriesPoint& other) = default;
140 SeriesPoint& operator=(const SeriesPoint& other) = default;
141 SeriesPoint& operator=(SeriesPoint&& other) = default;
142
143 /// Update only some specific fields of a `SeriesPoint`.
145 return SeriesPoint();
146 }
147
148 /// Clear all the fields of a `SeriesPoint`.
150
151 /// Color for the corresponding series.
153 color = ComponentBatch::from_loggable(_color, Descriptor_color).value_or_throw();
154 return std::move(*this);
155 }
156
157 /// This method makes it possible to pack multiple `color` in a single component batch.
158 ///
159 /// This only makes sense when used in conjunction with `columns`. `with_color` should
160 /// be used when logging a single row's worth of data.
162 color = ComponentBatch::from_loggable(_color, Descriptor_color).value_or_throw();
163 return std::move(*this);
164 }
165
166 /// What shape to use to represent the point
168 marker = ComponentBatch::from_loggable(_marker, Descriptor_marker).value_or_throw();
169 return std::move(*this);
170 }
171
172 /// This method makes it possible to pack multiple `marker` in a single component batch.
173 ///
174 /// This only makes sense when used in conjunction with `columns`. `with_marker` should
175 /// be used when logging a single row's worth of data.
177 marker = ComponentBatch::from_loggable(_marker, Descriptor_marker).value_or_throw();
178 return std::move(*this);
179 }
180
181 /// Display name of the series.
182 ///
183 /// Used in the legend.
185 name = ComponentBatch::from_loggable(_name, Descriptor_name).value_or_throw();
186 return std::move(*this);
187 }
188
189 /// This method makes it possible to pack multiple `name` in a single component batch.
190 ///
191 /// This only makes sense when used in conjunction with `columns`. `with_name` should
192 /// be used when logging a single row's worth of data.
194 name = ComponentBatch::from_loggable(_name, Descriptor_name).value_or_throw();
195 return std::move(*this);
196 }
197
198 /// Which point series are visible.
199 ///
200 /// If not set, all point series on this entity are visible.
201 /// Unlike with the regular visibility property of the entire entity, any series that is hidden
202 /// via this property will still be visible in the legend.
205 ) && {
206 visible_series =
207 ComponentBatch::from_loggable(_visible_series, Descriptor_visible_series)
208 .value_or_throw();
209 return std::move(*this);
210 }
211
212 /// Size of the marker.
214 marker_size = ComponentBatch::from_loggable(_marker_size, Descriptor_marker_size)
215 .value_or_throw();
216 return std::move(*this);
217 }
218
219 /// This method makes it possible to pack multiple `marker_size` in a single component batch.
220 ///
221 /// This only makes sense when used in conjunction with `columns`. `with_marker_size` should
222 /// be used when logging a single row's worth of data.
225 ) && {
226 marker_size = ComponentBatch::from_loggable(_marker_size, Descriptor_marker_size)
227 .value_or_throw();
228 return std::move(*this);
229 }
230
231 /// Partitions the component data into multiple sub-batches.
232 ///
233 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
234 /// instead, via `ComponentBatch::partitioned`.
235 ///
236 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
237 ///
238 /// The specified `lengths` must sum to the total length of the component batch.
240
241 /// Partitions the component data into unit-length sub-batches.
242 ///
243 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
244 /// where `n` is automatically guessed.
246 };
247
248} // namespace rerun::archetypes
249
250namespace rerun {
251 /// \private
252 template <typename T>
253 struct AsComponents;
254 RR_PUSH_WARNINGS
255 RR_DISABLE_DEPRECATION_WARNING
256
257 /// \private
258 template <>
259 struct AsComponents<archetypes::SeriesPoint> {
260 /// Serialize all set component batches.
261 static Result<Collection<ComponentBatch>> as_batches(
262 const archetypes::SeriesPoint& archetype
263 );
264 };
265} // namespace rerun
266
267RR_POP_WARNINGS
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
MarkerShape
Component: The visual appearance of a point in e.g. a 2D plot.
Definition marker_shape.hpp:25
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:14
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Define the style properties for a point series in a chart.
Definition series_point.hpp:81
std::optional< ComponentBatch > name
Display name of the series.
Definition series_point.hpp:91
static SeriesPoint update_fields()
Update only some specific fields of a SeriesPoint.
Definition series_point.hpp:144
SeriesPoint with_marker_size(const rerun::components::MarkerSize &_marker_size) &&
Size of the marker.
Definition series_point.hpp:213
std::optional< ComponentBatch > marker_size
Size of the marker.
Definition series_point.hpp:101
std::optional< ComponentBatch > marker
What shape to use to represent the point.
Definition series_point.hpp:86
SeriesPoint with_many_marker(const Collection< rerun::components::MarkerShape > &_marker) &&
This method makes it possible to pack multiple marker in a single component batch.
Definition series_point.hpp:176
std::optional< ComponentBatch > color
Color for the corresponding series.
Definition series_point.hpp:83
SeriesPoint with_visible_series(const Collection< rerun::components::SeriesVisible > &_visible_series) &&
Which point series are visible.
Definition series_point.hpp:203
std::optional< ComponentBatch > visible_series
Which point series are visible.
Definition series_point.hpp:98
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
SeriesPoint with_many_name(const Collection< rerun::components::Name > &_name) &&
This method makes it possible to pack multiple name in a single component batch.
Definition series_point.hpp:193
SeriesPoint with_color(const rerun::components::Color &_color) &&
Color for the corresponding series.
Definition series_point.hpp:152
SeriesPoint with_many_color(const Collection< rerun::components::Color > &_color) &&
This method makes it possible to pack multiple color in a single component batch.
Definition series_point.hpp:161
static SeriesPoint clear_fields()
Clear all the fields of a SeriesPoint.
SeriesPoint with_name(const rerun::components::Name &_name) &&
Display name of the series.
Definition series_point.hpp:184
SeriesPoint with_marker(const rerun::components::MarkerShape &_marker) &&
What shape to use to represent the point.
Definition series_point.hpp:167
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
SeriesPoint with_many_marker_size(const Collection< rerun::components::MarkerSize > &_marker_size) &&
This method makes it possible to pack multiple marker_size in a single component batch.
Definition series_point.hpp:223
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:18
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: Radius of a marker of a point in e.g. a 2D plot, measured in UI points.
Definition marker_size.hpp:15
Component: A display name, typically for an entity or a item like a plot series.
Definition name.hpp:17