diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2018-03-18 11:58:33 -0400 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2018-03-18 11:58:33 -0400 |
commit | 8b8ea9395bdda4bb1404497ff654b82098084822 (patch) | |
tree | c92d720990686acda5eeba18b028fe1e4b656a25 /src/data/graph.cpp | |
parent | 3cea1514203a451c0a8806d276807863b463a78f (diff) |
finally got bboxes working...i think
Diffstat (limited to 'src/data/graph.cpp')
-rw-r--r-- | src/data/graph.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/data/graph.cpp b/src/data/graph.cpp index 7a5fedc..208cd00 100644 --- a/src/data/graph.cpp +++ b/src/data/graph.cpp @@ -66,6 +66,19 @@ int Graph::maxIntName() return max; } +QRectF Graph::realBbox() +{ + float maxX = 0.0f; + QRectF rect = bbox(); + foreach (Node *n, _nodes) { + rect = rect.united(QRectF(n->point().x()-0.5f, + n->point().y()-0.5f, + 1.0f, 1.0f)); + } + + return rect; +} + QString Graph::freshNodeName() { return QString::number(maxIntName() + 1); @@ -228,14 +241,8 @@ Graph *Graph::copyOfSubgraphWithNodes(QSet<Node *> nds) void Graph::insertGraph(Graph *graph) { QMap<Node*,Node*> nodeTable; - foreach (Node *n, graph->nodes()) { - Node *n1 = n->copy(); - nodeTable.insert(n, n1); - addNode(n1); - } - foreach (Edge *e, graph->edges()) { - addEdge(e->copy(&nodeTable)); - } + foreach (Node *n, graph->nodes()) addNode(n); + foreach (Edge *e, graph->edges()) addEdge(e); } void Graph::setBbox(const QRectF &bbox) |