-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement graph components and archetypes #7500
base: main
Are you sure you want to change the base?
Changes from 120 commits
b863aa4
d3b22d1
b39c35a
74f1aeb
8102a95
10339c1
6c6519b
c2a2d4e
b2c9a73
0f78d8b
8823513
c0900c9
34032eb
aaa8733
30ec59d
36d4c8f
5c0284f
aeb518e
58328fb
e41c0fe
7558ee3
e1965bf
d8b16c8
803ef60
b786845
dff3358
f644118
ef3da62
8e4c69d
c50a508
eac1765
761d817
4aaac83
95bbb99
ff950e0
5e1cdcb
ebf5a66
63f9baa
44cd7d2
c5104be
0c5d6b9
8f99d6f
6465092
511543d
3c3e65f
0df93fd
d42c899
002c7b0
8fea1fc
80ad5b1
6463f23
32b9f9c
4654d3e
a1d9dc7
61203fb
435a646
9c86e37
fc40c49
69d225e
58e2267
8fd9263
6fddce8
c64678e
933a712
25022b7
760d8d4
f32e299
69e55fc
db1dc1d
c96ac2e
da1c85a
c73f2e5
009482c
adad111
37562a3
85ccfed
8fa2c63
600b812
e5d70f6
898afc6
e60b06f
6c9f327
8685be0
b919f17
9c7e021
eb09bfb
748740c
c2edffd
229e6b6
dda3947
b63f0ed
b4c5ce3
812a5d1
85b5963
fb44b7a
1408bad
a40390c
49e8277
3aa50ac
181d6a4
68e9435
111b0f5
64c09f1
cdae279
adb3ec9
b694ac3
eb4ae25
c36e011
b1ae62a
d524516
558b98b
f1d9f21
2bf7079
59acc6b
10cf7f0
5613a07
d9d4a02
729682c
e04b6e5
2fa2815
007e8d1
f3ff5f6
59049fe
b3d7b4c
9ef47be
0674ef0
81d556d
50a11a9
24b3ed7
82f190c
ec64a20
36f6670
9140ee6
5375384
9f6d989
a80192c
954844c
3b7608e
b636bc3
ead179f
1023394
bc4580d
c790ef4
d1d144a
08eff6e
91e9385
ebcbe4c
9b55b72
539ad0a
0284625
c7de2bf
d295b43
29e4a53
47c20a5
ebf8fa2
89232ad
83cb218
636a7c5
5a7cb20
a242daa
9d14402
9585b16
c100d50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace rerun.archetypes; | ||
|
||
// --- | ||
|
||
/// A list of edges in a graph. | ||
/// | ||
/// By default, edges are undirected. | ||
table GraphEdges ( | ||
"attr.rust.derive": "PartialEq, Eq", | ||
"attr.docs.category": "Graph", | ||
"attr.docs.view_types": "Graph View" | ||
) { | ||
grtlr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// --- Required --- | ||
|
||
/// A list of node IDs. | ||
edges: [rerun.components.GraphEdge] ("attr.rerun.component_required", order: 1000); | ||
|
||
|
||
// --- Recommended --- | ||
|
||
/// Specifies if the graph is directed or undirected. | ||
grtlr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
graph_type: rerun.components.GraphType ("attr.rerun.component_recommended", nullable, order: 2000); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace rerun.archetypes; | ||
|
||
// --- | ||
|
||
/// A list of nodes in a graph with optional labels, colors, etc. | ||
table GraphNodes ( | ||
"attr.rust.derive": "PartialEq", | ||
"attr.docs.category": "Graph", | ||
"attr.docs.view_types": "Graph View" | ||
) { | ||
// --- Required --- | ||
|
||
/// A list of node IDs. | ||
node_ids: [rerun.components.GraphNode] ("attr.rerun.component_required", order: 1000); | ||
|
||
// --- Optional --- | ||
|
||
/// Optional center positions of the nodes. | ||
positions: [rerun.components.Position2D] ("attr.rerun.component_recommended", nullable, order: 3000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Random thought for the future: it might be nice to have a view property to control whether these positions should be overridden by the auto-layout, if any. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree! We also could conceptualize this even a bit more. In my current implementation the user can drag individual nodes, and in the future the auto-layout should dynamically adapt to those changes. One idea would then be to set the position of that particular node as an override. However, I'm not sure if I can override a single value in a component batch?
grtlr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Optional colors for the boxes. | ||
colors: [rerun.components.Color] ("attr.rerun.component_recommended", nullable, order: 3100); | ||
grtlr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Optional text labels for the node. | ||
labels: [rerun.components.Text] ("attr.rerun.component_optional", nullable, order: 3200); | ||
|
||
/// Optional choice of whether the text labels should be shown by default. | ||
show_labels: rerun.components.ShowLabels ("attr.rerun.component_optional", nullable, order: 3250); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// An edge in a graph connecting two nodes. | ||
table GraphEdge ( | ||
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord", | ||
"attr.rust.repr": "transparent", | ||
"attr.rust.custom_clause": | ||
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))' | ||
) { | ||
edge: rerun.datatypes.GraphEdge (order: 100); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A string-based ID representing a node in a graph. | ||
table GraphNode ( | ||
"attr.python.aliases": "str", | ||
"attr.python.array_aliases": "str, Sequence[str]", | ||
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord", | ||
"attr.rust.repr": "transparent", | ||
"attr.rust.custom_clause": | ||
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))' | ||
) { | ||
id: rerun.datatypes.GraphNode (order: 100); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace rerun.components; | ||
|
||
// -- | ||
|
||
/// Specifies if a graph has directed or undirected edges. | ||
enum GraphType: ubyte ( | ||
"attr.rust.derive": "Default, PartialEq, Eq", | ||
"attr.rust.custom_clause": | ||
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))' | ||
) { | ||
/// Invalid value. Won't show up in generated types. | ||
Invalid = 0, | ||
|
||
/// The graph has undirected edges. | ||
Undirected (default), | ||
|
||
/// The graph has directed edges. | ||
Directed, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace rerun.datatypes; | ||
|
||
/// An edge in a graph connecting two nodes. | ||
table GraphEdge ( | ||
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord", | ||
"attr.rust.custom_clause": | ||
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))' | ||
) { | ||
/// The id of the source node. | ||
source: rerun.datatypes.GraphNode (order: 100); | ||
|
||
/// The id of the target node. | ||
target: rerun.datatypes.GraphNode (order: 200); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace rerun.datatypes; | ||
|
||
/// A string-based ID representing a node in a graph. | ||
table GraphNode ( | ||
"attr.arrow.transparent", | ||
"attr.python.aliases": "str", | ||
"attr.python.array_aliases": "Sequence[str]", | ||
"attr.rust.derive": "Default, PartialEq, Eq, PartialOrd, Ord, Hash", | ||
"attr.rust.repr": "transparent", | ||
"attr.rust.tuple_struct", | ||
"attr.rust.custom_clause": | ||
'cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))' | ||
) { | ||
id: string (order: 100); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: update the crate diagram