本文整理汇总了C++中NodeIterator::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeIterator::begin方法的具体用法?C++ NodeIterator::begin怎么用?C++ NodeIterator::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeIterator
的用法示例。
在下文中一共展示了NodeIterator::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcCoordinates
//------------------------------------------------------------------------------
void TreeDrawer::CalcCoordinates ()
{
double l = t->GetNumLeaves();
leafGap = height / (l - 1.0);
if (rooted)
nodeGap = width / l;
else
nodeGap = width / (l - 1.0);
leafCount = 0;
if (rooted)
{
// Allow for edge below root
left += nodeGap;
width -= nodeGap;
}
NodeIterator <Node> n (t->GetRoot());
Node *q = n.begin();
while (q)
{
if (q->IsLeaf ())
{
CalcLeaf (q);
}
else
{
CalcInternal (q);
}
q = n.next();
}
}
示例2:
Node *FEMesh::closestNode(const double x, const double y, const double z=0)
#endif
{
double min=1.; // (initial value provided to suppress compiler warnings)
Node *node, *thenode=0;
for(NodeIterator ni = node_iterator(); !ni.end(); ++ni) {
node = ni.node();
double dx = node->position()(0) - x;
double dy = node->position()(1) - y;
#if DIM==2
double dist = dx*dx + dy*dy;
#elif DIM==3
double dz = node->position()(2) - z;
double dist = dx*dx + dy*dy + dz*dz;
#endif
if (ni.begin()) {
min = dist;
thenode = node;
}
else {
if (dist <= min) {
min = dist;
thenode = node;
}
}
}
return thenode;
}
示例3: Order
//------------------------------------------------------------------------------
void TreeOrder::Order ()
{
NodeIterator <Node> n (t->GetRoot());
Node *q = n.begin();
while (q)
{
if (!q->IsLeaf ())
SortDescendants (q);
q = n.next();
}
}
示例4: Draw
//------------------------------------------------------------------------------
void TreeDrawer::Draw ()
{
NodeIterator <Node> n (t->GetRoot());
Node *q = n.begin();
while (q)
{
if (q->IsLeaf ())
{
DrawLeaf (q);
}
else
{
DrawInternal (q);
}
q = n.next();
}
if (rooted)
{
DrawRoot ();
}
}
示例5: n
//------------------------------------------------------------------------------
TreeDrawer::TreeDrawer (Tree *tree)
{
t = tree;
rooted = true;
showInternalLabels = true;
showLeafLabels = true;
left = 0.0;
top = 0.0;
width = 400.0;
height = 400.0;
leafCount = 0;
NodeIterator <Node> n (t->GetRoot());
Node *q = n.begin();
while (q)
{
if (q->IsLeaf ())
{
point p;
node_coordinates[q] = p;
}
q = n.next();
}
}