本文整理汇总了C++中PathNode::setPartId方法的典型用法代码示例。如果您正苦于以下问题:C++ PathNode::setPartId方法的具体用法?C++ PathNode::setPartId怎么用?C++ PathNode::setPartId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathNode
的用法示例。
在下文中一共展示了PathNode::setPartId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPartTags
void PathGraph::setPartTags ( void )
{
static PathNodeStack unprocessed;
int nodeCount = getNodeCount();
for(int i = 0; i < nodeCount; i++)
{
PathNode * node = getNode(i);
node->setPartId(-1);
// ignore nodes without edges unless they're the only node in the cell
int edgeCount = getEdgeCount(node->getIndex());
if(edgeCount > 0)
{
unprocessed.push(node);
}
else
{
PathNodeType type = node->getType();
if((nodeCount == 1) && (type == PNT_CellPortal))
{
unprocessed.push(node);
}
}
}
static PathNodeStack processing;
int currentTag = 0;
while(!unprocessed.empty())
{
PathNode * currentNode = unprocessed.top();
unprocessed.pop();
if(currentNode->getPartId() != -1) continue;
processing.push(currentNode);
while(!processing.empty())
{
PathNode * node = processing.top();
processing.pop();
if(node->getPartId() != -1) continue;
node->setPartId(currentTag);
int edgeCount = getEdgeCount(node->getIndex());
for(int i = 0; i < edgeCount; i++)
{
int neighborIndex = getEdge(node->getIndex(),i)->getIndexB();
PathNode * neighborNode = getNode(neighborIndex);
processing.push(neighborNode);
}
}
currentTag++;
}
m_partCount = currentTag;
}