diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 0d12b4e7..5c18b97b 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -761,6 +761,7 @@ void GraphController::bundleNodes() return data->isType(Node::NODE_FILE); }, 1, + false, "Importing Files" ); } @@ -771,6 +772,7 @@ void GraphController::bundleNodes() return !info.isDefined && info.isReferencing && !info.layoutVertical; }, 2, + true, "Non-indexed Symbols" ); @@ -780,6 +782,7 @@ void GraphController::bundleNodes() return !info.isDefined && info.isReferenced && !info.layoutVertical; }, 2, + true, "Non-indexed Symbols" ); @@ -789,6 +792,7 @@ void GraphController::bundleNodes() return info.isDefined && info.isReferenced && data->isType(Node::NODE_BUILTIN_TYPE); }, 3, + false, "Built-in Types" ); @@ -800,6 +804,7 @@ void GraphController::bundleNodes() return info.isDefined && info.isReferencing && !info.layoutVertical; }, 10, + false, "Referencing Symbols" ); @@ -809,6 +814,7 @@ void GraphController::bundleNodes() return info.isDefined && info.isReferenced && !info.layoutVertical; }, 10, + false, "Referenced Symbols" ); } @@ -819,6 +825,7 @@ void GraphController::bundleNodes() return info.isReferencing && info.layoutVertical; }, 5, + false, "Derived Symbols" ); @@ -828,14 +835,20 @@ void GraphController::bundleNodes() return info.isReferenced && info.layoutVertical; }, 5, + false, "Base Symbols" ); } void GraphController::bundleNodesAndEdgesMatching( - std::function matcher, size_t count, const std::string& name + std::function matcher, + size_t count, + bool countConnectedNodes, + const std::string& name ){ std::vector matchedNodeIndices; + size_t connectedNodeCount = 0; for (size_t i = 0; i < m_dummyNodes.size(); i++) { const DummyNode* node = m_dummyNodes[i].get(); @@ -847,10 +860,16 @@ void GraphController::bundleNodesAndEdgesMatching( if (matcher(node->bundleInfo, node->data)) { matchedNodeIndices.push_back(i); + + if (countConnectedNodes) + { + connectedNodeCount += node->getConnectedSubNodes().size(); + } } } - if (!matchedNodeIndices.size() || matchedNodeIndices.size() < count || matchedNodeIndices.size() == m_dummyNodes.size()) + size_t matchedNodeCount = countConnectedNodes ? connectedNodeCount : matchedNodeIndices.size(); + if (!matchedNodeIndices.size() || matchedNodeCount < count || matchedNodeIndices.size() == m_dummyNodes.size()) { return; } @@ -870,6 +889,11 @@ void GraphController::bundleNodesAndEdgesMatching( m_dummyNodes.erase(m_dummyNodes.begin() + matchedNodeIndices[i]); } + if (countConnectedNodes) + { + bundleNode->bundledNodeCount = connectedNodeCount; + } + DummyNode* firstNode = bundleNode->bundledNodes.begin()->get(); // Use token Id of first node and make first bit 1 diff --git a/src/lib/component/controller/GraphController.h b/src/lib/component/controller/GraphController.h index 4e42229a..3727da93 100644 --- a/src/lib/component/controller/GraphController.h +++ b/src/lib/component/controller/GraphController.h @@ -84,7 +84,8 @@ private: void bundleNodes(); void bundleNodesAndEdgesMatching( - std::function matcher, size_t count, const std::string& name); + std::function matcher, size_t count, bool countConnectedNodes, + const std::string& name); std::shared_ptr bundleNodesMatching( std::list>& nodes, std::function matcher, const std::string& name); void bundleByType(std::list>& nodes, Node::NodeType type, const std::string& name);