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
@@ -73,7 +73,7 @@ bool QtGraphNode::addOutEdge(const std::shared_ptr<GraphEdge>& edge)
bool QtGraphNode::addInEdge(const std::weak_ptr<GraphEdge>& edge)
{
for (std::list<std::weak_ptr<GraphEdge> >::iterator it = m_inEdges.begin(); it != m_inEdges.end(); it++)
for (std::list<std::weak_ptr<GraphEdge>>::iterator it = m_inEdges.begin(); it != m_inEdges.end(); it++)
{
std::shared_ptr<GraphEdge> existingEdge = it->lock();
if (existingEdge != NULL)
@@ -92,7 +92,7 @@ bool QtGraphNode::addInEdge(const std::weak_ptr<GraphEdge>& edge)
void QtGraphNode::removeOutEdge(GraphEdge* edge)
{
std::list<std::shared_ptr<GraphEdge> >::iterator it = m_outEdges.begin();
std::list<std::shared_ptr<GraphEdge>>::iterator it = m_outEdges.begin();
while (it != m_outEdges.end())
{
if ((*it).get() == edge)
@@ -105,7 +105,7 @@ void QtGraphNode::removeOutEdge(GraphEdge* edge)
}
}
std::list<std::shared_ptr<GraphNode> > QtGraphNode::getSubNodes() const
std::list<std::shared_ptr<GraphNode>> QtGraphNode::getSubNodes() const
{
return m_subNodes;
}
@@ -128,12 +128,12 @@ void QtGraphNode::notifyParentMoved()
void QtGraphNode::notifyEdgesAfterMove()
{
for (std::list<std::shared_ptr<GraphEdge> >::iterator it = m_outEdges.begin(); it != m_outEdges.end(); it++)
for (std::list<std::shared_ptr<GraphEdge>>::iterator it = m_outEdges.begin(); it != m_outEdges.end(); it++)
{
(*it)->ownerMoved();
}
std::list<std::weak_ptr<GraphEdge> >::iterator it2 = m_inEdges.begin();
std::list<std::weak_ptr<GraphEdge>>::iterator it2 = m_inEdges.begin();
while (it2 != m_inEdges.end())
{
std::shared_ptr<GraphEdge> edge = it2->lock();
@@ -148,7 +148,7 @@ void QtGraphNode::notifyEdgesAfterMove()
}
}
for (std::list<std::shared_ptr<GraphNode> >::iterator it3 = m_subNodes.begin(); it3 != m_subNodes.end(); it3++)
for (std::list<std::shared_ptr<GraphNode>>::iterator it3 = m_subNodes.begin(); it3 != m_subNodes.end(); it3++)
{
(*it3)->notifyParentMoved();
}