UI: GraphLayouting

Implemented graph layouting, hybrid approach using spectral and force based layouting

fortune cookie message = Giving credit where it's due ensures loyalty to you.
This commit is contained in:
Manuel
2015-01-29 15:47:02 +01:00
parent 016d692dda
commit a7eaeae432
23 changed files with 2003 additions and 11 deletions
+25
View File
@@ -1,5 +1,7 @@
#include "data/Storage.h"
#include <iostream>
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
@@ -553,6 +555,7 @@ std::shared_ptr<Graph> Storage::getGraphForActiveTokenIds(const std::vector<Id>&
else if (tokenIds.size() == 1)
{
Token* token = m_graph.getTokenById(tokenIds[0]);
if (!token)
{
LOG_ERROR_STREAM(<< "Token with id " << tokenIds[0] << " was not found");
@@ -585,6 +588,28 @@ std::shared_ptr<Graph> Storage::getGraphForActiveTokenIds(const std::vector<Id>&
}
}
for(const std::pair<Id, std::shared_ptr<Node>> nodePair : graph->getNodes())
{
Node* node = m_graph.getNodeById(nodePair.first);
node->forEachEdge(
[graph](Edge* edge)
{
if(edge->getType() != Edge::EdgeType::EDGE_MEMBER)
{
Node* from = edge->getFrom();
Node* to = edge->getTo();
if(graph->findNode([from](Node* node){return from->getId() == node->getId();}) != NULL
&& graph->findNode([to](Node* node){return to->getId() == node->getId();}) != NULL)
{
graph->addEdge(edge);
}
}
}
);
}
return graph;
}