ui: improved graph view layouting and bundling
* move top and bottom layout buckets closer to center buckets * split undefined bundles into users and usees * acknowledge zoom for graph view size in layouting * bundle all referencing nodes * fixed bundle node and bundle edge count
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "utility/math/Vector2.h"
|
||||
#include "utility/types.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentAccess.h"
|
||||
|
||||
@@ -24,6 +25,7 @@ public:
|
||||
, hasParent(true)
|
||||
, accessType(TokenComponentAccess::ACCESS_NONE)
|
||||
, invisibleSubNodeCount(0)
|
||||
, bundledNodeCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -101,6 +103,60 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t getConnectedSubNodeCount() const
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
if (connected)
|
||||
{
|
||||
count += 1;
|
||||
}
|
||||
|
||||
for (const DummyNode& node : subNodes)
|
||||
{
|
||||
count += node.getConnectedSubNodeCount();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
std::vector<const DummyNode*> getConnectedSubNodes() const
|
||||
{
|
||||
std::vector<const DummyNode*> nodes;
|
||||
|
||||
if (connected)
|
||||
{
|
||||
nodes.push_back(this);
|
||||
}
|
||||
|
||||
for (const DummyNode& node : subNodes)
|
||||
{
|
||||
utility::append(nodes, node.getConnectedSubNodes());
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
std::vector<const DummyNode*> getAllBundledNodes() const
|
||||
{
|
||||
std::vector<const DummyNode*> nodes;
|
||||
for (const DummyNode& node : bundledNodes)
|
||||
{
|
||||
utility::append(nodes, node.getConnectedSubNodes());
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
size_t getBundledNodeCount() const
|
||||
{
|
||||
if (bundledNodeCount > 0)
|
||||
{
|
||||
return bundledNodeCount;
|
||||
}
|
||||
|
||||
return bundledNodes.size();
|
||||
}
|
||||
|
||||
Vec2i position;
|
||||
Vec2i size;
|
||||
|
||||
@@ -129,6 +185,7 @@ public:
|
||||
|
||||
// BundleNode
|
||||
std::vector<DummyNode> bundledNodes;
|
||||
size_t bundledNodeCount;
|
||||
};
|
||||
|
||||
#endif // DUMMY_NODE_H
|
||||
|
||||
Reference in New Issue
Block a user