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