Rerun C++ SDK
Loading...
Searching...
No Matches
geo_line_strings.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/build/re_type_definitions/rerun/archetypes/geo_line_strings.def.rs".
3
4#pragma once
5
6#include "../archetype_utils.hpp"
7#include "../collection.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/color.hpp"
11#include "../components/geo_line_string.hpp"
12#include "../components/radius.hpp"
13#include "../result.hpp"
14
15#include <cstdint>
16#include <optional>
17#include <utility>
18#include <vector>
19
20namespace rerun::archetypes {
21 /// **Archetype**: Geospatial line strings with positions expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees), and optional colors and radii.
22 ///
23 /// Also known as "line strips" or "polylines".
24 ///
25 /// ## Example
26 ///
27 /// ### Log a geospatial line string
28 /// ![image](https://static.rerun.io/geo_line_strings_simple/5669983eb10906ace303755b5b5039cad75b917f/full.png)
29 ///
30 /// ```cpp
31 /// #include <rerun.hpp>
32 ///
33 /// int main(int argc, char* argv[]) {
34 /// const auto rec = rerun::RecordingStream("rerun_example_geo_line_strings");
35 /// rec.spawn().exit_on_failure();
36 ///
37 /// auto line_string = rerun::GeoLineString::from_lat_lon(
38 /// {{41.0000, -109.0452},
39 /// {41.0000, -102.0415},
40 /// {36.9931, -102.0415},
41 /// {36.9931, -109.0452},
42 /// {41.0000, -109.0452}}
43 /// );
44 ///
45 /// rec.log(
46 /// "colorado",
47 /// rerun::GeoLineStrings(line_string)
48 /// .with_radii(rerun::Radius::ui_points(2.0f))
49 /// .with_colors(rerun::Color(0, 0, 255))
50 /// );
51 /// }
52 /// ```
54 /// The line strings, expressed in [EPSG:4326](https://epsg.io/4326) coordinates (North/East-positive degrees).
55 std::optional<ComponentBatch> line_strings;
56
57 /// Optional radii for the line strings. Each radius applies to one line string, not to an individual vertex.
58 ///
59 /// *Note*: scene units radiii are interpreted as meters. Currently, the display scale only considers the latitude of
60 /// the first vertex of each line string (see [this issue](https://github.com/rerun-io/rerun/issues/8013)).
61 std::optional<ComponentBatch> radii;
62
63 /// Optional colors for the line strings. Each color applies to one line string, not to an individual vertex.
64 std::optional<ComponentBatch> colors;
65
66 public:
67 /// The name of the archetype as used in `ComponentDescriptor`s.
68 static constexpr const char ArchetypeName[] = "rerun.archetypes.GeoLineStrings";
69
70 /// `ComponentDescriptor` for the `line_strings` field.
72 ArchetypeName, "GeoLineStrings:line_strings",
74 );
75 /// `ComponentDescriptor` for the `radii` field.
76 static constexpr auto Descriptor_radii = ComponentDescriptor(
77 ArchetypeName, "GeoLineStrings:radii",
79 );
80 /// `ComponentDescriptor` for the `colors` field.
81 static constexpr auto Descriptor_colors = ComponentDescriptor(
82 ArchetypeName, "GeoLineStrings:colors",
84 );
85
86 public:
87 GeoLineStrings() = default;
88 GeoLineStrings(GeoLineStrings&& other) = default;
89 GeoLineStrings(const GeoLineStrings& other) = default;
90 GeoLineStrings& operator=(const GeoLineStrings& other) = default;
91 GeoLineStrings& operator=(GeoLineStrings&& other) = default;
92
95 ComponentBatch::from_loggable(std::move(_line_strings), Descriptor_line_strings)
96 .value_or_throw()
97 ) {}
98
99 /// Update only some specific fields of a `GeoLineStrings`.
101 return GeoLineStrings();
102 }
103
104 /// Clear all the fields of a `GeoLineStrings`.
106
107 /// The line strings, expressed in [EPSG:4326](https://epsg.io/4326) coordinates (North/East-positive degrees).
110 ) && {
112 .value_or_throw();
113 return std::move(*this);
114 }
115
116 /// Optional radii for the line strings. Each radius applies to one line string, not to an individual vertex.
117 ///
118 /// *Note*: scene units radiii are interpreted as meters. Currently, the display scale only considers the latitude of
119 /// the first vertex of each line string (see [this issue](https://github.com/rerun-io/rerun/issues/8013)).
121 radii = ComponentBatch::from_loggable(_radii, Descriptor_radii).value_or_throw();
122 return std::move(*this);
123 }
124
125 /// Optional colors for the line strings. Each color applies to one line string, not to an individual vertex.
127 colors = ComponentBatch::from_loggable(_colors, Descriptor_colors).value_or_throw();
128 return std::move(*this);
129 }
130
131 /// Partitions the component data into multiple sub-batches.
132 ///
133 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
134 /// instead, via `ComponentBatch::partitioned`.
135 ///
136 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
137 ///
138 /// The specified `lengths` must sum to the total length of the component batch.
140 return detail::partition_batches({&line_strings, &radii, &colors}, lengths_)
141 .value_or_throw();
142 }
143
144 /// Partitions the component data into unit-length sub-batches.
145 ///
146 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
147 /// where `n` is automatically guessed.
149 return detail::partition_batches_of_unit_length({&line_strings, &radii, &colors})
150 .value_or_throw();
151 }
152 };
153
154} // namespace rerun::archetypes
155
156namespace rerun {
157 /// \private
158 template <typename T>
159 struct AsComponents;
160
161 /// \private
162 template <>
163 struct AsComponents<archetypes::GeoLineStrings> {
164 /// Serialize all set component batches.
165 static Result<Collection<ComponentBatch>> as_batches(
166 const archetypes::GeoLineStrings& archetype
167 ) {
168 return detail::collect_batches(
169 {&archetype.line_strings, &archetype.radii, &archetype.colors}
170 );
171 }
172 };
173} // 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:90
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Geospatial line strings with positions expressed in EPSG:4326 latitude and longitude (Nort...
Definition geo_line_strings.hpp:53
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition geo_line_strings.hpp:139
static GeoLineStrings clear_fields()
Clear all the fields of a GeoLineStrings.
static constexpr auto Descriptor_radii
ComponentDescriptor for the radii field.
Definition geo_line_strings.hpp:76
static constexpr auto Descriptor_line_strings
ComponentDescriptor for the line_strings field.
Definition geo_line_strings.hpp:71
std::optional< ComponentBatch > line_strings
The line strings, expressed in EPSG:4326 coordinates (North/East-positive degrees).
Definition geo_line_strings.hpp:55
static constexpr auto Descriptor_colors
ComponentDescriptor for the colors field.
Definition geo_line_strings.hpp:81
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition geo_line_strings.hpp:68
GeoLineStrings with_line_strings(const Collection< rerun::components::GeoLineString > &_line_strings) &&
The line strings, expressed in EPSG:4326 coordinates (North/East-positive degrees).
Definition geo_line_strings.hpp:108
std::optional< ComponentBatch > colors
Optional colors for the line strings. Each color applies to one line string, not to an individual ver...
Definition geo_line_strings.hpp:64
GeoLineStrings with_colors(const Collection< rerun::components::Color > &_colors) &&
Optional colors for the line strings. Each color applies to one line string, not to an individual ver...
Definition geo_line_strings.hpp:126
GeoLineStrings with_radii(const Collection< rerun::components::Radius > &_radii) &&
Optional radii for the line strings.
Definition geo_line_strings.hpp:120
std::optional< ComponentBatch > radii
Optional radii for the line strings.
Definition geo_line_strings.hpp:61
static GeoLineStrings update_fields()
Update only some specific fields of a GeoLineStrings.
Definition geo_line_strings.hpp:100
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition geo_line_strings.hpp:148