nodegraph: added more helper functions for contexts
This commit is contained in:
@@ -58,6 +58,31 @@ qreal NodeGraph::GetNodeContextHeight(Node *context)
|
|||||||
return bottom - top;
|
return bottom - top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int NodeGraph::GetNumberOfContextsNodeIsIn(Node *node) const
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for (auto it=position_map_.cbegin(); it!=position_map_.cend(); it++) {
|
||||||
|
if (it.value().contains(node)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NodeGraph::NodeOutputsToContext(Node *node) const
|
||||||
|
{
|
||||||
|
for (auto it=position_map_.cbegin(); it!=position_map_.cend(); it++) {
|
||||||
|
const PositionMap &pm = it.value();
|
||||||
|
if (pm.contains(node) && node->OutputsTo(it.key(), true)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void NodeGraph::childEvent(QChildEvent *event)
|
void NodeGraph::childEvent(QChildEvent *event)
|
||||||
{
|
{
|
||||||
super::childEvent(event);
|
super::childEvent(event);
|
||||||
|
|||||||
@@ -108,6 +108,10 @@ public:
|
|||||||
return position_map_;
|
return position_map_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetNumberOfContextsNodeIsIn(Node *node) const;
|
||||||
|
|
||||||
|
bool NodeOutputsToContext(Node *node) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief Signal emitted when a Node is added to the graph
|
* @brief Signal emitted when a Node is added to the graph
|
||||||
|
|||||||
Reference in New Issue
Block a user