GraphvizLayout.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <optional>
5#include <string>
6
7#include <QList>
8#include <QPointF>
9
10#include <graphviz/gvc.h>
11
12namespace armarx
13{
15 {
16 float posX = 0.0f;
17 float posY = 0.0f;
18 float width = 0.0f;
19 float height = 0.0f;
20 std::string label;
21 };
22
24 {
25 QList<QPointF> controlPoints;
26 std::optional<QPointF> startPoint;
27 std::optional<QPointF> endPoint;
28
29 std::string label; // May be empty
30 float labelPosX = 0.0f;
31 float labelPosY = 0.0f;
32 };
33
35 {
36 std::map<int, GraphvizLayoutedNode> nodes;
37 std::map<std::pair<int, int>, GraphvizLayoutedEdge> edges;
38 };
39
41 {
42 public:
44
46
48
49 void addNode(int id, std::string const& label);
50
51 void addEdge(int sourceID, int targetID, const std::string& label);
52
53 GraphvizLayoutedGraph finish(std::string const& savePNG = "");
54
55
56 private:
57 GVC_t* context = nullptr;
58 graph_t* graph = nullptr;
59
60 std::map<int, node_t*> id2node;
61 std::map<std::pair<int, int>, edge_t*> id2edge;
62 };
63
64} // namespace armarx
GraphvizLayoutedGraph finish(std::string const &savePNG="")
void addNode(int id, std::string const &label)
GraphvizLayout(GraphvizLayout const &)=delete
void addEdge(int sourceID, int targetID, const std::string &label)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::optional< QPointF > startPoint
std::optional< QPointF > endPoint
std::map< std::pair< int, int >, GraphvizLayoutedEdge > edges
std::map< int, GraphvizLayoutedNode > nodes