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 "../components/color.hpp"
10#include "../components/marker_shape.hpp"
11#include "../components/marker_size.hpp"
12#include "../components/name.hpp"
13#include "../indicator_component.hpp"
14#include "../result.hpp"
15
16#include <cstdint>
17#include <optional>
18#include <utility>
19#include <vector>
20
21namespace rerun::archetypes {
22 /// **Archetype**: Define the style properties for a point series in a chart.
23 ///
24 /// This archetype only provides styling information and should be logged as static
25 /// when possible. The underlying data needs to be logged to the same entity-path using
26 /// `archetypes::Scalar`.
27 ///
28 /// ## Example
29 ///
30 /// ### Point series
31 /// ![image](https://static.rerun.io/series_point_style/82207a705da6c086b28ce161db1db9e8b12258b7/full.png)
32 ///
33 /// ```cpp
34 /// #include <rerun.hpp>
35 ///
36 /// #include <cmath>
37 ///
38 /// constexpr float TAU = 6.28318530717958647692528676655900577f;
39 ///
40 /// int main() {
41 /// const auto rec = rerun::RecordingStream("rerun_example_series_point_style");
42 /// rec.spawn().exit_on_failure();
43 ///
44 /// // Set up plot styling:
45 /// // They are logged static as they don't change over time and apply to all timelines.
46 /// // Log two point series under a shared root so that they show in the same plot by default.
47 /// rec.log_static(
48 /// "trig/sin",
49 /// rerun::SeriesPoint()
50 /// .with_color({255, 0, 0})
51 /// .with_name("sin(0.01t)")
52 /// .with_marker(rerun::components::MarkerShape::Circle)
53 /// .with_marker_size(4)
54 /// );
55 /// rec.log_static(
56 /// "trig/cos",
57 /// rerun::SeriesPoint()
58 /// .with_color({0, 255, 0})
59 /// .with_name("cos(0.01t)")
60 /// .with_marker(rerun::components::MarkerShape::Cross)
61 /// .with_marker_size(2)
62 /// );
63 ///
64 /// // Log the data on a timeline called "step".
65 /// for (int t = 0; t <static_cast<int>(TAU * 2.0 * 10.0); ++t) {
66 /// rec.set_time_sequence("step", t);
67 ///
68 /// rec.log("trig/sin", rerun::Scalar(sin(static_cast<double>(t) / 10.0)));
69 /// rec.log("trig/cos", rerun::Scalar(cos(static_cast<double>(t) / 10.0f)));
70 /// }
71 /// }
72 /// ```
73 struct SeriesPoint {
74 /// Color for the corresponding series.
75 std::optional<rerun::components::Color> color;
76
77 /// What shape to use to represent the point
78 std::optional<rerun::components::MarkerShape> marker;
79
80 /// Display name of the series.
81 ///
82 /// Used in the legend.
83 std::optional<rerun::components::Name> name;
84
85 /// Size of the marker.
86 std::optional<rerun::components::MarkerSize> marker_size;
87
88 public:
89 static constexpr const char IndicatorComponentName[] =
90 "rerun.components.SeriesPointIndicator";
91
92 /// Indicator component, used to identify the archetype when converting to a list of components.
94
95 public:
96 SeriesPoint() = default;
97 SeriesPoint(SeriesPoint&& other) = default;
98
99 /// Color for the corresponding series.
101 color = std::move(_color);
102 // See: https://github.com/rerun-io/rerun/issues/4027
103 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
104 }
105
106 /// What shape to use to represent the point
108 marker = std::move(_marker);
109 // See: https://github.com/rerun-io/rerun/issues/4027
110 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
111 }
112
113 /// Display name of the series.
114 ///
115 /// Used in the legend.
117 name = std::move(_name);
118 // See: https://github.com/rerun-io/rerun/issues/4027
119 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
120 }
121
122 /// Size of the marker.
124 marker_size = std::move(_marker_size);
125 // See: https://github.com/rerun-io/rerun/issues/4027
126 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
127 }
128 };
129
130} // namespace rerun::archetypes
131
132namespace rerun {
133 /// \private
134 template <typename T>
135 struct AsComponents;
136
137 /// \private
138 template <>
139 struct AsComponents<archetypes::SeriesPoint> {
140 /// Serialize all set component batches.
141 static Result<std::vector<ComponentBatch>> serialize(
142 const archetypes::SeriesPoint& archetype
143 );
144 };
145} // namespace rerun
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:24
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Archetype: Define the style properties for a point series in a chart.
Definition series_point.hpp:73
SeriesPoint with_marker_size(rerun::components::MarkerSize _marker_size) &&
Size of the marker.
Definition series_point.hpp:123
std::optional< rerun::components::MarkerShape > marker
What shape to use to represent the point.
Definition series_point.hpp:78
std::optional< rerun::components::Name > name
Display name of the series.
Definition series_point.hpp:83
SeriesPoint with_marker(rerun::components::MarkerShape _marker) &&
What shape to use to represent the point.
Definition series_point.hpp:107
SeriesPoint with_name(rerun::components::Name _name) &&
Display name of the series.
Definition series_point.hpp:116
SeriesPoint with_color(rerun::components::Color _color) &&
Color for the corresponding series.
Definition series_point.hpp:100
std::optional< rerun::components::MarkerSize > marker_size
Size of the marker.
Definition series_point.hpp:86
std::optional< rerun::components::Color > color
Color for the corresponding series.
Definition series_point.hpp:75
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30
Component: Radius of a marker of a point in e.g. a 2D plot, measured in UI points.
Definition marker_size.hpp:14
Component: A display name, typically for an entity or a item like a plot series.
Definition name.hpp:16