本文整理汇总了C++中AbstractNode::getSuccessors方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractNode::getSuccessors方法的具体用法?C++ AbstractNode::getSuccessors怎么用?C++ AbstractNode::getSuccessors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractNode
的用法示例。
在下文中一共展示了AbstractNode::getSuccessors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createLinearSegment
void BalanceGraph::createLinearSegment(AbstractNode *node)
{
// Create a segment
Segment* segment = new Segment();
segments.push_back(segment);
// Add the head of the chain
segment->nodes.push_back(node);
nodeToSegment.insert(node,segment);
AbstractNode* currentNode = node->getSuccessors().first();
// We are still within in the chain
while(currentNode->getPredecessors().size() == 1 && currentNode->getSuccessors().size() == 1) {
segment->nodes.push_back(currentNode);
nodeToSegment.insert(currentNode,segment);
currentNode = currentNode->getSuccessors().first();
}
// We are at the end of the chain now
// If we have many predecessors, let it be
if(currentNode->getPredecessors().size() > 1) {
return;
}
// if we have no successors, end of chain, add and return
if(currentNode->getSuccessors().isEmpty()) {
segment->nodes.push_back(currentNode);
nodeToSegment.insert(currentNode,segment);
}
}
示例2: calculateUpForces
void BalanceGraph::calculateUpForces()
{
for(Segment* segment : segments) {
AbstractNode* tail = segment->nodes.last();
if (tail->getSuccessors().isEmpty()) {
segment->dForce = 0;
} else {
qreal sum = 0;
for(AbstractNode* succ : tail->getSuccessors()) {
sum += succ->getInport().x() - tail->getOutport().x();
}
segment->dForce = (double) (sum / tail->getSuccessors().size());
}
}
}