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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user