logic: refactored GraphAccess and GraphController to use single call that returns Graph

This change refactors the GraphController to use the GraphAccess only with a single call that returns a Graph. The Graph
contains all information for visually representing the active Token with all parent and child nodes and edges. This
reduces coupling of the data and logic tiers.
This commit is contained in:
Eberhard Graether
2014-09-10 01:07:26 +02:00
parent 9a546b4312
commit 760e5ffafd
18 changed files with 164 additions and 544 deletions
+26
View File
@@ -244,6 +244,32 @@ Edge* Graph::addEdgeAsPlainCopy(Edge* edge)
return copy.get();
}
Node* Graph::addNodeAndAllChildrenAsPlainCopy(Node* node)
{
Node* n = addNodeAsPlainCopy(node);
node->forEachEdgeOfType(Edge::EDGE_MEMBER,
[node, this](Edge* edge)
{
if (edge->getFrom() == node)
{
addEdgeAsPlainCopy(edge);
addNodeAndAllChildrenAsPlainCopy(edge->getTo());
}
}
);
return n;
}
Edge* Graph::addEdgeAndAllChildrenAsPlainCopy(Edge* edge)
{
addNodeAndAllChildrenAsPlainCopy(edge->getFrom()->getLastParentNode());
addNodeAndAllChildrenAsPlainCopy(edge->getTo()->getLastParentNode());
return addEdgeAsPlainCopy(edge);
}
void Graph::removeEdgeInternal(Edge* edge)
{
std::map<Id, std::shared_ptr<Edge> >::const_iterator it = m_edges.find(edge->getId());