logic: Show inheritance edges between parents of active symbol and other visible symbols (issue #167)

* add inheritance edges between parents of active symbol and other visible symbols
* add dashed inheritance edges when symbols are no direct decendants
* inheritance edges are also respected in layouting, putting base/derived classes in the correct top/bottom spot now

bug id = 167
This commit is contained in:
Eberhard Graether
2017-07-16 18:40:59 +02:00
parent 9a36d48d1e
commit 9d0b86ad98
19 changed files with 261 additions and 17 deletions
@@ -6,6 +6,7 @@
#include "component/view/GraphViewStyle.h"
#include "data/graph/Edge.h"
#include "data/graph/token_component/TokenComponentAggregation.h"
#include "data/graph/token_component/TokenComponentInheritanceChain.h"
#include "qt/graphics/QtLineItemAngled.h"
#include "qt/graphics/QtLineItemBezier.h"
#include "qt/graphics/QtLineItemStraight.h"
@@ -207,6 +208,15 @@ void QtGraphEdge::updateLine()
showArrow = m_direction != TokenComponentAggregation::DIRECTION_NONE;
}
if (getData())
{
TokenComponentInheritanceChain* componentInheritance = getData()->getComponent<TokenComponentInheritanceChain>();
if (componentInheritance && componentInheritance->inheritanceEdgeIds.size() > 1)
{
style.dashed = true;
}
}
child->updateLine(
owner->getBoundingRect(), target->getBoundingRect(),
owner->getParentBoundingRect(), target->getParentBoundingRect(),
@@ -262,9 +272,11 @@ void QtGraphEdge::onClick()
}
else
{
TokenComponentInheritanceChain* componentInheritance = getData()->getComponent<TokenComponentInheritanceChain>();
MessageActivateEdge msg(
getData()->getId(),
getData()->getType(),
componentInheritance ? Edge::EDGE_AGGREGATION : getData()->getType(),
getData()->getFrom()->getNameHierarchy(),
getData()->getTo()->getNameHierarchy()
);
@@ -274,6 +286,10 @@ void QtGraphEdge::onClick()
msg.aggregationIds =
utility::toVector<Id>(getData()->getComponent<TokenComponentAggregation>()->getAggregationIds());
}
else if (componentInheritance)
{
msg.aggregationIds = componentInheritance->inheritanceEdgeIds;
}
msg.dispatch();
}