Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::GraphNodes Struct Reference

Archetype: A list of nodes in a graph with optional labels, colors, etc. More...

#include <rerun/archetypes/graph_nodes.hpp>

Public Member Functions

 GraphNodes (GraphNodes &&other)=default
 
 GraphNodes (const GraphNodes &other)=default
 
GraphNodesoperator= (const GraphNodes &other)=default
 
GraphNodesoperator= (GraphNodes &&other)=default
 
 GraphNodes (Collection< rerun::components::GraphNode > _node_ids)
 
GraphNodes with_node_ids (const Collection< rerun::components::GraphNode > &_node_ids) &&
 A list of node IDs.
 
GraphNodes with_positions (const Collection< rerun::components::Position2D > &_positions) &&
 Optional center positions of the nodes.
 
GraphNodes with_colors (const Collection< rerun::components::Color > &_colors) &&
 Optional colors for the boxes.
 
GraphNodes with_labels (const Collection< rerun::components::Text > &_labels) &&
 Optional text labels for the node.
 
GraphNodes with_show_labels (const rerun::components::ShowLabels &_show_labels) &&
 Whether the text labels should be shown.
 
GraphNodes with_many_show_labels (const Collection< rerun::components::ShowLabels > &_show_labels) &&
 This method makes it possible to pack multiple show_labels in a single component batch.
 
GraphNodes with_radii (const Collection< rerun::components::Radius > &_radii) &&
 Optional radii for nodes.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static GraphNodes update_fields ()
 Update only some specific fields of a GraphNodes.
 
static GraphNodes clear_fields ()
 Clear all the fields of a GraphNodes.
 

Public Attributes

std::optional< ComponentBatchnode_ids
 A list of node IDs.
 
std::optional< ComponentBatchpositions
 Optional center positions of the nodes.
 
std::optional< ComponentBatchcolors
 Optional colors for the boxes.
 
std::optional< ComponentBatchlabels
 Optional text labels for the node.
 
std::optional< ComponentBatchshow_labels
 Whether the text labels should be shown.
 
std::optional< ComponentBatchradii
 Optional radii for nodes.
 

Static Public Attributes

static constexpr const char ArchetypeName [] = "rerun.archetypes.GraphNodes"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_node_ids
 ComponentDescriptor for the node_ids field.
 
static constexpr auto Descriptor_positions
 ComponentDescriptor for the positions field.
 
static constexpr auto Descriptor_colors
 ComponentDescriptor for the colors field.
 
static constexpr auto Descriptor_labels
 ComponentDescriptor for the labels field.
 
static constexpr auto Descriptor_show_labels
 ComponentDescriptor for the show_labels field.
 
static constexpr auto Descriptor_radii
 ComponentDescriptor for the radii field.
 

Detailed Description

Archetype: A list of nodes in a graph with optional labels, colors, etc.

Example

Simple directed graph

image

#include <rerun.hpp>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_graph_directed");
rec.spawn().exit_on_failure();
rec.log(
"simple",
rerun::GraphNodes({"a", "b", "c"})
.with_positions({{0.0, 100.0}, {-100.0, 0.0}, {100.0, 0.0}})
.with_labels({"A", "B", "C"}),
rerun::GraphEdges({{"a", "b"}, {"b", "c"}, {"c", "a"}})
// Graphs are undirected by default.
);
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:61
@ Directed
The graph has directed edges.
Archetype: A list of edges in a graph.
Definition graph_edges.hpp:46
Archetype: A list of nodes in a graph with optional labels, colors, etc.
Definition graph_nodes.hpp:48
GraphNodes with_labels(const Collection< rerun::components::Text > &_labels) &&
Optional text labels for the node.
Definition graph_nodes.hpp:142
GraphNodes with_positions(const Collection< rerun::components::Position2D > &_positions) &&
Optional center positions of the nodes.
Definition graph_nodes.hpp:129

Member Function Documentation

◆ with_show_labels()

GraphNodes rerun::archetypes::GraphNodes::with_show_labels ( const rerun::components::ShowLabels _show_labels) &&
inline

Whether the text labels should be shown.

If not set, labels will automatically appear when there is exactly one label for this entity or the number of instances on this entity is under a certain threshold.

◆ with_many_show_labels()

GraphNodes rerun::archetypes::GraphNodes::with_many_show_labels ( const Collection< rerun::components::ShowLabels > &  _show_labels) &&
inline

This method makes it possible to pack multiple show_labels in a single component batch.

This only makes sense when used in conjunction with columns. with_show_labels should be used when logging a single row's worth of data.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::GraphNodes::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::GraphNodes::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ show_labels

std::optional<ComponentBatch> rerun::archetypes::GraphNodes::show_labels

Whether the text labels should be shown.

If not set, labels will automatically appear when there is exactly one label for this entity or the number of instances on this entity is under a certain threshold.

◆ Descriptor_node_ids

constexpr auto rerun::archetypes::GraphNodes::Descriptor_node_ids
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GraphNodes:node_ids",
Loggable<rerun::components::GraphNode>::ComponentType
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition graph_nodes.hpp:72

ComponentDescriptor for the node_ids field.

◆ Descriptor_positions

constexpr auto rerun::archetypes::GraphNodes::Descriptor_positions
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GraphNodes:positions",
Loggable<rerun::components::Position2D>::ComponentType
)

ComponentDescriptor for the positions field.

◆ Descriptor_colors

constexpr auto rerun::archetypes::GraphNodes::Descriptor_colors
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GraphNodes:colors", Loggable<rerun::components::Color>::ComponentType
)

ComponentDescriptor for the colors field.

◆ Descriptor_labels

constexpr auto rerun::archetypes::GraphNodes::Descriptor_labels
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GraphNodes:labels", Loggable<rerun::components::Text>::ComponentType
)

ComponentDescriptor for the labels field.

◆ Descriptor_show_labels

constexpr auto rerun::archetypes::GraphNodes::Descriptor_show_labels
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GraphNodes:show_labels",
Loggable<rerun::components::ShowLabels>::ComponentType
)

ComponentDescriptor for the show_labels field.

◆ Descriptor_radii

constexpr auto rerun::archetypes::GraphNodes::Descriptor_radii
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "GraphNodes:radii", Loggable<rerun::components::Radius>::ComponentType
)

ComponentDescriptor for the radii field.


The documentation for this struct was generated from the following file: