UI: GraphLayouting
Implemented graph layouting, hybrid approach using spectral and force based layouting fortune cookie message = Giving credit where it's due ensures loyalty to you.
This commit is contained in:
@@ -15,6 +15,11 @@ CodeView::CodeSnippetParams::CodeSnippetParams()
|
||||
|
||||
bool CodeView::CodeSnippetParams::sort(const CodeSnippetParams& a, const CodeSnippetParams& b)
|
||||
{
|
||||
if(a.isActive && b.isActive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// sort active snippet first
|
||||
if (a.isActive && !b.isActive)
|
||||
{
|
||||
|
||||
@@ -47,8 +47,9 @@ protected:
|
||||
|
||||
struct DummyNode
|
||||
{
|
||||
DummyNode(const Node* data)
|
||||
: data(data)
|
||||
public:
|
||||
DummyNode()
|
||||
: data(nullptr)
|
||||
, accessType(TokenComponentAccess::ACCESS_NONE)
|
||||
, active(false)
|
||||
, connected(false)
|
||||
@@ -60,6 +61,12 @@ struct DummyNode
|
||||
{
|
||||
}
|
||||
|
||||
DummyNode(const Node* data)
|
||||
: data(data)
|
||||
, accessType(TokenComponentAccess::ACCESS_NONE)
|
||||
{
|
||||
}
|
||||
|
||||
DummyNode(TokenComponentAccess::AccessType accessType)
|
||||
: data(nullptr)
|
||||
, accessType(accessType)
|
||||
@@ -78,6 +85,45 @@ struct DummyNode
|
||||
return expanded || autoExpanded;
|
||||
}
|
||||
|
||||
bool operator==(const DummyNode& other) const
|
||||
{
|
||||
if (data->getId() == other.data->getId()
|
||||
&& data->getName() == other.data->getName())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator!=(const DummyNode& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
bool operator<(const DummyNode& other) const
|
||||
{
|
||||
if (data->getId() < other.data->getId())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator>(const DummyNode& other) const
|
||||
{
|
||||
return !(*this < other);
|
||||
}
|
||||
|
||||
DummyNode& operator=(const DummyNode& other)
|
||||
{
|
||||
data = other.data;
|
||||
subNodes = other.subNodes;
|
||||
position = other.position;
|
||||
topLevelAncestorId = other.topLevelAncestorId;
|
||||
tokenId = other.tokenId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Node* data;
|
||||
TokenComponentAccess::AccessType accessType;
|
||||
|
||||
@@ -93,7 +139,10 @@ struct DummyNode
|
||||
size_t invisibleSubNodeCount;
|
||||
|
||||
bool visible;
|
||||
|
||||
|
||||
Id topLevelAncestorId;
|
||||
Id tokenId;
|
||||
|
||||
std::vector<DummyNode> subNodes;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user