blob: c25d51b92a4f742275f5ba50143343eb1239fb20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*!
* A graph defined by tikz code.
*/
#ifndef GRAPH_H
#define GRAPH_H
#include "node.h"
#include "edge.h"
#include "graphelementdata.h"
#include <QObject>
#include <QVector>
#include <QMultiHash>
#include <QRectF>
#include <QString>
class Graph : public QObject
{
Q_OBJECT
public:
explicit Graph(QObject *parent = 0);
~Graph();
void addNode(Node *n);
void addNode(Node *n, int index);
void removeNode(Node *n);
void addEdge(Edge *e);
void addEdge(Edge *e, int index);
void removeEdge(Edge *e);
GraphElementData *data() const;
void setData(GraphElementData *data);
const QVector<Node *> &nodes();
const QVector<Edge*> &edges();
QRectF bbox() const;
void setBbox(const QRectF &bbox);
bool hasBbox();
void clearBbox();
QString tikz();
signals:
public slots:
private:
QVector<Node*> _nodes;
QVector<Edge*> _edges;
//QMultiHash<Node*,Edge*> inEdges;
//QMultiHash<Node*,Edge*> outEdges;
GraphElementData *_data;
QRectF _bbox;
};
#endif // GRAPH_H
|