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:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "data/graph/Node.h"
|
||||
#include "data/graph/token_component/TokenComponentAggregation.h"
|
||||
#include "data/graph/token_component/TokenComponentInheritanceChain.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
@@ -134,6 +135,22 @@ void Edge::addComponentAggregation(std::shared_ptr<TokenComponentAggregation> co
|
||||
}
|
||||
}
|
||||
|
||||
void Edge::addComponentInheritanceChain(std::shared_ptr<TokenComponentInheritanceChain> component)
|
||||
{
|
||||
if (getComponent<TokenComponentInheritanceChain>())
|
||||
{
|
||||
LOG_ERROR("TokenComponentInheritanceChain has been set before!");
|
||||
}
|
||||
else if (m_type != EDGE_INHERITANCE)
|
||||
{
|
||||
LOG_ERROR("TokenComponentInheritanceChain can't be set on edge of type: " + getReadableTypeString());
|
||||
}
|
||||
else
|
||||
{
|
||||
addComponent(component);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Edge::getUnderscoredTypeString(EdgeType type)
|
||||
{
|
||||
return utility::replace(utility::replace(getReadableTypeString(type), "-", "_"), " ", "_");
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
class Node;
|
||||
class TokenComponentAggregation;
|
||||
class TokenComponentAccess;
|
||||
class TokenComponentDataType;
|
||||
class TokenComponentInheritanceChain;
|
||||
|
||||
class Edge
|
||||
: public Token
|
||||
@@ -57,6 +56,7 @@ public:
|
||||
|
||||
// Component setters
|
||||
void addComponentAggregation(std::shared_ptr<TokenComponentAggregation> component);
|
||||
void addComponentInheritanceChain(std::shared_ptr<TokenComponentInheritanceChain> component);
|
||||
|
||||
static std::string getUnderscoredTypeString(EdgeType type);
|
||||
static std::string getReadableTypeString(EdgeType type);
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
|
||||
const Node::NodeTypeMask Node::NODE_NOT_VISIBLE = Node::NODE_NAMESPACE | Node::NODE_PACKAGE;
|
||||
const Node::NodeTypeMask Node::NODE_USEABLE_TYPE = Node::NODE_NON_INDEXED | Node::NODE_BUILTIN_TYPE |
|
||||
Node::NODE_BUILTIN_TYPE | Node::NODE_STRUCT | Node::NODE_CLASS | Node::NODE_INTERFACE | Node::NODE_TYPEDEF;
|
||||
Node::NODE_STRUCT | Node::NODE_CLASS | Node::NODE_INTERFACE | Node::NODE_TYPEDEF;
|
||||
const Node::NodeTypeMask Node::NODE_INHERITABLE_TYPE = Node::NODE_NON_INDEXED | Node::NODE_BUILTIN_TYPE |
|
||||
NODE_TYPE | Node::NODE_STRUCT | Node::NODE_CLASS | Node::NODE_INTERFACE;
|
||||
|
||||
std::string Node::getUnderscoredTypeString(NodeType type)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
|
||||
static const NodeTypeMask NODE_NOT_VISIBLE;
|
||||
static const NodeTypeMask NODE_USEABLE_TYPE;
|
||||
static const NodeTypeMask NODE_INHERITABLE_TYPE;
|
||||
|
||||
Node(Id id, NodeType type, NameHierarchy nameHierarchy, bool defined);
|
||||
Node(const Node& other);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef TOKEN_COMPONENT_INHERITANCE_CHAIN_H
|
||||
#define TOKEN_COMPONENT_INHERITANCE_CHAIN_H
|
||||
|
||||
#include "data/graph/token_component/TokenComponent.h"
|
||||
|
||||
class TokenComponentInheritanceChain
|
||||
: public TokenComponent
|
||||
{
|
||||
public:
|
||||
TokenComponentInheritanceChain(const std::vector<Id>& inheritanceEdgeIds)
|
||||
: inheritanceEdgeIds(inheritanceEdgeIds)
|
||||
{
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<TokenComponent> copy() const
|
||||
{
|
||||
return std::make_shared<TokenComponentInheritanceChain>(*this);
|
||||
}
|
||||
|
||||
const std::vector<Id> inheritanceEdgeIds;
|
||||
};
|
||||
|
||||
#endif // TOKEN_COMPONENT_INHERITANCE_CHAIN_H
|
||||
Reference in New Issue
Block a user