From 59eee652c5fea36945a4a8ce2936843bd90d0e1b Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Fri, 20 Jul 2018 11:01:34 +0200 Subject: ... --- src/data/graph.h | 218 +++++++++++++++++++++++++++---------------------------- 1 file changed, 109 insertions(+), 109 deletions(-) (limited to 'src/data/graph.h') diff --git a/src/data/graph.h b/src/data/graph.h index 77af253..82e1f95 100644 --- a/src/data/graph.h +++ b/src/data/graph.h @@ -1,109 +1,109 @@ -/* - TikZiT - a GUI diagram editor for TikZ - Copyright (C) 2018 Aleks Kissinger - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/*! - * A graph defined by tikz code. - */ - -#ifndef GRAPH_H -#define GRAPH_H - -#include "node.h" -#include "edge.h" -#include "graphelementdata.h" - -#include -#include -#include -#include -#include - -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); - int maxIntName(); - QString freshNodeName(); - - /*! - * \brief renameApart assigns fresh names to all of the nodes in "this", - * with respect to the given graph - * \param graph - */ - void renameApart(Graph *graph); - - GraphElementData *data() const; - void setData(GraphElementData *data); - - const QVector &nodes(); - const QVector &edges(); - - QRectF bbox() const; - void setBbox(const QRectF &bbox); - bool hasBbox(); - void clearBbox(); - - /*! - * \brief realBbox computes the union of the user-defined - * bounding box, and the bounding boxes of the graph's - * contents. - * - * \return - */ - QRectF realBbox(); - - QString tikz(); - - /*! - * \brief copyOfSubgraphWithNodes produces a copy of the full subgraph - * with the given nodes. Used for cutting and copying to clipboard. - * \param nds - * \return - */ - Graph *copyOfSubgraphWithNodes(QSet nds); - - /*! - * \brief insertGraph inserts the given graph into "this". Prior to calling this - * method, the node names in the given graph should be made fresh via - * "renameApart". Note that the parameter "graph" relinquishes ownership of its - * nodes and edges, so it should be not be allowed to exist longer than "this". - * \param graph - */ - void insertGraph(Graph *graph); -signals: - -public slots: - -private: - QVector _nodes; - QVector _edges; - //QMultiHash inEdges; - //QMultiHash outEdges; - GraphElementData *_data; - QRectF _bbox; -}; - -#endif // GRAPH_H +/* + TikZiT - a GUI diagram editor for TikZ + Copyright (C) 2018 Aleks Kissinger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/*! + * A graph defined by tikz code. + */ + +#ifndef GRAPH_H +#define GRAPH_H + +#include "node.h" +#include "edge.h" +#include "graphelementdata.h" + +#include +#include +#include +#include +#include + +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); + int maxIntName(); + QString freshNodeName(); + + /*! + * \brief renameApart assigns fresh names to all of the nodes in "this", + * with respect to the given graph + * \param graph + */ + void renameApart(Graph *graph); + + GraphElementData *data() const; + void setData(GraphElementData *data); + + const QVector &nodes(); + const QVector &edges(); + + QRectF bbox() const; + void setBbox(const QRectF &bbox); + bool hasBbox(); + void clearBbox(); + + /*! + * \brief realBbox computes the union of the user-defined + * bounding box, and the bounding boxes of the graph's + * contents. + * + * \return + */ + QRectF realBbox(); + + QString tikz(); + + /*! + * \brief copyOfSubgraphWithNodes produces a copy of the full subgraph + * with the given nodes. Used for cutting and copying to clipboard. + * \param nds + * \return + */ + Graph *copyOfSubgraphWithNodes(QSet nds); + + /*! + * \brief insertGraph inserts the given graph into "this". Prior to calling this + * method, the node names in the given graph should be made fresh via + * "renameApart". Note that the parameter "graph" relinquishes ownership of its + * nodes and edges, so it should be not be allowed to exist longer than "this". + * \param graph + */ + void insertGraph(Graph *graph); +signals: + +public slots: + +private: + QVector _nodes; + QVector _edges; + //QMultiHash inEdges; + //QMultiHash outEdges; + GraphElementData *_data; + QRectF _bbox; +}; + +#endif // GRAPH_H -- cgit v1.2.3