diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2018-01-04 16:00:52 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2018-01-04 16:00:52 +0100 |
commit | 738ecbd5fad2b46836bfd6a94aeebf165ae2bbca (patch) | |
tree | df04709807cc9ec8481a3ebc7d80ac25e5b2f457 /src/data/graph.h | |
parent | 0421a96749743868554d44585050b1b3d04864d2 (diff) |
relocated source code to the root
Diffstat (limited to 'src/data/graph.h')
-rw-r--r-- | src/data/graph.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/data/graph.h b/src/data/graph.h new file mode 100644 index 0000000..8856e5c --- /dev/null +++ b/src/data/graph.h @@ -0,0 +1,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 |