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/store/re_types/definitions/rerun/archetypes/geo_line_strings.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/color.hpp"
10#include "../components/geo_line_string.hpp"
11#include "../components/radius.hpp"
12#include "../indicator_component.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) altitude 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() {
34 /// const auto rec = rerun::RecordingStream("rerun_example_geo_line_strings");
35 /// rec.spawn().exit_on_failure();
36 ///
37 /// auto line_string = rerun::components::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.
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.
64 std::optional<ComponentBatch> colors;
65
66 public:
67 static constexpr const char IndicatorComponentName[] =
68 "rerun.components.GeoLineStringsIndicator";
69
70 /// Indicator component, used to identify the archetype when converting to a list of components.
72 /// The name of the archetype as used in `ComponentDescriptor`s.
73 static constexpr const char ArchetypeName[] = "rerun.archetypes.GeoLineStrings";
74
75 /// `ComponentDescriptor` for the `line_strings` field.
77 ArchetypeName, "line_strings",
79 );
80 /// `ComponentDescriptor` for the `radii` field.
81 static constexpr auto Descriptor_radii = ComponentDescriptor(
83 );
84 /// `ComponentDescriptor` for the `colors` field.
85 static constexpr auto Descriptor_colors = ComponentDescriptor(
87 );
88
89 public:
90 GeoLineStrings() = default;
91 GeoLineStrings(GeoLineStrings&& other) = default;
92 GeoLineStrings(const GeoLineStrings& other) = default;
93 GeoLineStrings& operator=(const GeoLineStrings& other) = default;
94 GeoLineStrings& operator=(GeoLineStrings&& other) = default;
95
98 ComponentBatch::from_loggable(std::move(_line_strings), Descriptor_line_strings)
99 .value_or_throw()
100 ) {}
101
102 /// Update only some specific fields of a `GeoLineStrings`.
104 return GeoLineStrings();
105 }
106
107 /// Clear all the fields of a `GeoLineStrings`.
109
110 /// The line strings, expressed in [EPSG:4326](https://epsg.io/4326) coordinates (North/East-positive degrees).
113 ) && {
115 .value_or_throw();
116 return std::move(*this);
117 }
118
119 /// Optional radii for the line strings.
120 ///
121 /// *Note*: scene units radiii are interpreted as meters. Currently, the display scale only considers the latitude of
122 /// the first vertex of each line string (see [this issue](https://github.com/rerun-io/rerun/issues/8013)).
124 radii = ComponentBatch::from_loggable(_radii, Descriptor_radii).value_or_throw();
125 return std::move(*this);
126 }
127
128 /// Optional colors for the line strings.
130 colors = ComponentBatch::from_loggable(_colors, Descriptor_colors).value_or_throw();
131 return std::move(*this);
132 }
133
134 /// Partitions the component data into multiple sub-batches.
135 ///
136 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
137 /// instead, via `ComponentBatch::partitioned`.
138 ///
139 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
140 ///
141 /// The specified `lengths` must sum to the total length of the component batch.
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 };
150
151} // namespace rerun::archetypes
152
153namespace rerun {
154 /// \private
155 template <typename T>
156 struct AsComponents;
157
158 /// \private
159 template <>
160 struct AsComponents<archetypes::GeoLineStrings> {
161 /// Serialize all set component batches.
162 static Result<Collection<ComponentBatch>> as_batches(
163 const archetypes::GeoLineStrings& archetype
164 );
165 };
166} // namespace rerun
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
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
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=rerun::Loggable< T >::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:14
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 altitude 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.
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:81
static constexpr auto Descriptor_line_strings
ComponentDescriptor for the line_strings field.
Definition geo_line_strings.hpp:76
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:85
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition geo_line_strings.hpp:73
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:111
std::optional< ComponentBatch > colors
Optional colors for the line strings.
Definition geo_line_strings.hpp:64
GeoLineStrings with_colors(const Collection< rerun::components::Color > &_colors) &&
Optional colors for the line strings.
Definition geo_line_strings.hpp:129
GeoLineStrings with_radii(const Collection< rerun::components::Radius > &_radii) &&
Optional radii for the line strings.
Definition geo_line_strings.hpp:123
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:103
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32