Rerun C++ SDK
Loading...
Searching...
No Matches
geo_points.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_points.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/class_id.hpp"
10#include "../components/color.hpp"
11#include "../components/lat_lon.hpp"
12#include "../components/radius.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**: Geospatial points with positions expressed in [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees), and optional colors and radii.
23 ///
24 /// ## Example
25 ///
26 /// ### Log a geospatial point
27 /// ![image](https://static.rerun.io/geopoint_simple/b86ce83e5871837587bd33a0ad639358b96e9010/full.png)
28 ///
29 /// ```cpp
30 /// #include <rerun.hpp>
31 ///
32 /// int main() {
33 /// const auto rec = rerun::RecordingStream("rerun_example_geo_points");
34 /// rec.spawn().exit_on_failure();
35 ///
36 /// rec.log(
37 /// "rerun_hq",
38 /// rerun::GeoPoints::from_lat_lon({{59.319221, 18.075631}})
39 /// .with_radii(rerun::Radius::ui_points(10.0f))
40 /// .with_colors(rerun::Color(255, 0, 0))
41 /// );
42 /// }
43 /// ```
44 struct GeoPoints {
45 /// The [EPSG:4326](https://epsg.io/4326) coordinates for the points (North/East-positive degrees).
46 std::optional<ComponentBatch> positions;
47
48 /// Optional radii for the points, effectively turning them into circles.
49 ///
50 /// *Note*: scene units radiii are interpreted as meters.
51 std::optional<ComponentBatch> radii;
52
53 /// Optional colors for the points.
54 std::optional<ComponentBatch> colors;
55
56 /// Optional class Ids for the points.
57 ///
58 /// The `components::ClassId` provides colors if not specified explicitly.
59 std::optional<ComponentBatch> class_ids;
60
61 public:
62 static constexpr const char IndicatorComponentName[] =
63 "rerun.components.GeoPointsIndicator";
64
65 /// Indicator component, used to identify the archetype when converting to a list of components.
67 /// The name of the archetype as used in `ComponentDescriptor`s.
68 static constexpr const char ArchetypeName[] = "rerun.archetypes.GeoPoints";
69
70 /// `ComponentDescriptor` for the `positions` field.
72 ArchetypeName, "positions",
74 );
75 /// `ComponentDescriptor` for the `radii` field.
76 static constexpr auto Descriptor_radii = ComponentDescriptor(
78 );
79 /// `ComponentDescriptor` for the `colors` field.
80 static constexpr auto Descriptor_colors = ComponentDescriptor(
82 );
83 /// `ComponentDescriptor` for the `class_ids` field.
85 ArchetypeName, "class_ids",
87 );
88
89 public: // START of extensions from geo_points_ext.cpp:
90 /// Creates a new GeoPoints object based on [EPSG:4326](https://epsg.io/4326) latitude and longitude (North/East-positive degrees).
92 return GeoPoints(std::move(positions_));
93 }
94
95 // END of extensions from geo_points_ext.cpp, start of generated code:
96
97 public:
98 GeoPoints() = default;
99 GeoPoints(GeoPoints&& other) = default;
100 GeoPoints(const GeoPoints& other) = default;
101 GeoPoints& operator=(const GeoPoints& other) = default;
102 GeoPoints& operator=(GeoPoints&& other) = default;
103
105 : positions(ComponentBatch::from_loggable(std::move(_positions), Descriptor_positions)
106 .value_or_throw()) {}
107
108 /// Update only some specific fields of a `GeoPoints`.
110 return GeoPoints();
111 }
112
113 /// Clear all the fields of a `GeoPoints`.
115
116 /// The [EPSG:4326](https://epsg.io/4326) coordinates for the points (North/East-positive degrees).
118 positions =
119 ComponentBatch::from_loggable(_positions, Descriptor_positions).value_or_throw();
120 return std::move(*this);
121 }
122
123 /// Optional radii for the points, effectively turning them into circles.
124 ///
125 /// *Note*: scene units radiii are interpreted as meters.
127 radii = ComponentBatch::from_loggable(_radii, Descriptor_radii).value_or_throw();
128 return std::move(*this);
129 }
130
131 /// Optional colors for the points.
133 colors = ComponentBatch::from_loggable(_colors, Descriptor_colors).value_or_throw();
134 return std::move(*this);
135 }
136
137 /// Optional class Ids for the points.
138 ///
139 /// The `components::ClassId` provides colors if not specified explicitly.
141 class_ids =
142 ComponentBatch::from_loggable(_class_ids, Descriptor_class_ids).value_or_throw();
143 return std::move(*this);
144 }
145
146 /// Partitions the component data into multiple sub-batches.
147 ///
148 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
149 /// instead, via `ComponentBatch::partitioned`.
150 ///
151 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
152 ///
153 /// The specified `lengths` must sum to the total length of the component batch.
155
156 /// Partitions the component data into unit-length sub-batches.
157 ///
158 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
159 /// where `n` is automatically guessed.
161 };
162
163} // namespace rerun::archetypes
164
165namespace rerun {
166 /// \private
167 template <typename T>
168 struct AsComponents;
169
170 /// \private
171 template <>
172 struct AsComponents<archetypes::GeoPoints> {
173 /// Serialize all set component batches.
174 static Result<Collection<ComponentBatch>> as_batches(const archetypes::GeoPoints& archetype
175 );
176 };
177} // 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 points with positions expressed in EPSG:4326 latitude and longitude (North/East...
Definition geo_points.hpp:44
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
GeoPoints with_positions(const Collection< rerun::components::LatLon > &_positions) &&
The EPSG:4326 coordinates for the points (North/East-positive degrees).
Definition geo_points.hpp:117
std::optional< ComponentBatch > radii
Optional radii for the points, effectively turning them into circles.
Definition geo_points.hpp:51
GeoPoints with_class_ids(const Collection< rerun::components::ClassId > &_class_ids) &&
Optional class Ids for the points.
Definition geo_points.hpp:140
std::optional< ComponentBatch > class_ids
Optional class Ids for the points.
Definition geo_points.hpp:59
static constexpr auto Descriptor_radii
ComponentDescriptor for the radii field.
Definition geo_points.hpp:76
static constexpr auto Descriptor_class_ids
ComponentDescriptor for the class_ids field.
Definition geo_points.hpp:84
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition geo_points.hpp:68
static GeoPoints update_fields()
Update only some specific fields of a GeoPoints.
Definition geo_points.hpp:109
GeoPoints with_radii(const Collection< rerun::components::Radius > &_radii) &&
Optional radii for the points, effectively turning them into circles.
Definition geo_points.hpp:126
static constexpr auto Descriptor_colors
ComponentDescriptor for the colors field.
Definition geo_points.hpp:80
static GeoPoints from_lat_lon(Collection< components::LatLon > positions_)
Creates a new GeoPoints object based on EPSG:4326 latitude and longitude (North/East-positive degrees...
Definition geo_points.hpp:91
std::optional< ComponentBatch > positions
The EPSG:4326 coordinates for the points (North/East-positive degrees).
Definition geo_points.hpp:46
GeoPoints with_colors(const Collection< rerun::components::Color > &_colors) &&
Optional colors for the points.
Definition geo_points.hpp:132
static GeoPoints clear_fields()
Clear all the fields of a GeoPoints.
std::optional< ComponentBatch > colors
Optional colors for the points.
Definition geo_points.hpp:54
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static constexpr auto Descriptor_positions
ComponentDescriptor for the positions field.
Definition geo_points.hpp:71
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32