Rerun C++ SDK
Loading...
Searching...
No Matches
visual_bounds2d.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/blueprint/archetypes/visual_bounds2d.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/visual_bounds2d.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../result.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <utility>
16#include <vector>
17
18namespace rerun::blueprint::archetypes {
19 /// **Archetype**: Controls the visual bounds of a 2D view.
20 ///
21 /// Everything within these bounds are guaranteed to be visible.
22 /// Somethings outside of these bounds may also be visible due to letterboxing.
23 ///
24 /// If no visual bounds are set, it will be determined automatically,
25 /// based on the bounding-box of the data or other camera information present in the view.
26 ///
27 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
28 ///
30 /// Controls the visible range of a 2D view.
31 ///
32 /// Use this to control pan & zoom of the view.
33 std::optional<ComponentBatch> range;
34
35 public:
36 /// The name of the archetype as used in `ComponentDescriptor`s.
37 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.VisualBounds2D";
38
39 /// `ComponentDescriptor` for the `range` field.
40 static constexpr auto Descriptor_range = ComponentDescriptor(
41 ArchetypeName, "VisualBounds2D:range",
43 );
44
45 public:
46 VisualBounds2D() = default;
47 VisualBounds2D(VisualBounds2D&& other) = default;
48 VisualBounds2D(const VisualBounds2D& other) = default;
49 VisualBounds2D& operator=(const VisualBounds2D& other) = default;
50 VisualBounds2D& operator=(VisualBounds2D&& other) = default;
51
53 : range(ComponentBatch::from_loggable(std::move(_range), Descriptor_range)
54 .value_or_throw()) {}
55
56 /// Update only some specific fields of a `VisualBounds2D`.
58 return VisualBounds2D();
59 }
60
61 /// Clear all the fields of a `VisualBounds2D`.
63
64 /// Controls the visible range of a 2D view.
65 ///
66 /// Use this to control pan & zoom of the view.
68 range = ComponentBatch::from_loggable(_range, Descriptor_range).value_or_throw();
69 return std::move(*this);
70 }
71
72 /// Partitions the component data into multiple sub-batches.
73 ///
74 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
75 /// instead, via `ComponentBatch::partitioned`.
76 ///
77 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
78 ///
79 /// The specified `lengths` must sum to the total length of the component batch.
81 return detail::partition_batches({&range}, lengths_).value_or_throw();
82 }
83
84 /// Partitions the component data into unit-length sub-batches.
85 ///
86 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
87 /// where `n` is automatically guessed.
89 return detail::partition_batches_of_unit_length({&range}).value_or_throw();
90 }
91 };
92
93} // namespace rerun::blueprint::archetypes
94
95namespace rerun {
96 /// \private
97 template <typename T>
98 struct AsComponents;
99
100 /// \private
101 template <>
102 struct AsComponents<blueprint::archetypes::VisualBounds2D> {
103 /// Serialize all set component batches.
104 static Result<Collection<ComponentBatch>> as_batches(
106 ) {
107 return detail::collect_batches({&archetype.range});
108 }
109 };
110} // 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 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: Controls the visual bounds of a 2D view.
Definition visual_bounds2d.hpp:29
static VisualBounds2D clear_fields()
Clear all the fields of a VisualBounds2D.
std::optional< ComponentBatch > range
Controls the visible range of a 2D view.
Definition visual_bounds2d.hpp:33
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition visual_bounds2d.hpp:88
static constexpr auto Descriptor_range
ComponentDescriptor for the range field.
Definition visual_bounds2d.hpp:40
static VisualBounds2D update_fields()
Update only some specific fields of a VisualBounds2D.
Definition visual_bounds2d.hpp:57
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition visual_bounds2d.hpp:37
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition visual_bounds2d.hpp:80
VisualBounds2D with_range(const rerun::blueprint::components::VisualBounds2D &_range) &&
Controls the visible range of a 2D view.
Definition visual_bounds2d.hpp:67
Component: Visual bounds in 2D space used for Spatial2DView.
Definition visual_bounds2d.hpp:17