本文整理汇总了C++中NodePtr::GetEdgeLength方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::GetEdgeLength方法的具体用法?C++ NodePtr::GetEdgeLength怎么用?C++ NodePtr::GetEdgeLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::GetEdgeLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traversenoquote
//Added by BCO
//------------------------------------------------------------------------------
void Tree::traversenoquote (NodePtr p)
{
if (p)
{
if (p->IsLeaf())
{
for (int i=0; i<(NEXUSString (p->GetLabel())).length(); i++) {
if ((NEXUSString (p->GetLabel()))[i]!= '\'') {
*treeStream <<(NEXUSString (p->GetLabel()))[i];
}
}
//*treeStream<<NEXUSString (p->GetLabel());
if (EdgeLengths)
{
*treeStream << ':' << p->GetEdgeLength ();
}
}
else
{
*treeStream << "(";
}
traversenoquote (p->GetChild());
if (p->GetSibling())
{
*treeStream << ",";
}
else
{
if (p != Root)
{
*treeStream << ")";
// 29/3/96
if ((p->GetAnc()->GetLabel() != "") && InternalLabels)
{
*treeStream << NEXUSString (p->GetAnc()->GetLabel ()) ; //here's the change from traverse
}
if (EdgeLengths && (p->GetAnc () != Root))
{
*treeStream << ':' << p->GetAnc()->GetEdgeLength ();
}
}
}
traversenoquote (p->GetSibling());
}
}
示例2: getPathLengths
//------------------------------------------------------------------------------
// Compute nodal heights based on path length from root, and store maximum
// value in plot.maxheight. Used by drawing routines.
void Tree::getPathLengths (NodePtr p)
{
if (p)
{
if (p != Root)
{
float l = p->GetEdgeLength();
if (l < 0.000001) // suppress negative branch lengths
l = 0.0;
p->SetPathLength (p->GetAnc()->GetPathLength() + l);
}
if (p->GetPathLength() > MaxPathLength)
MaxPathLength = p->GetPathLength();
getPathLengths (p->GetChild());
getPathLengths (p->GetSibling());
}
}
示例3: traverse
//------------------------------------------------------------------------------
void Tree::traverse (NodePtr p)
{
if (p)
{
if (p->IsLeaf())
{
*treeStream << NEXUSString (p->GetLabel());
if (EdgeLengths)
{
*treeStream << ':' << p->GetEdgeLength ();
}
}
else
{
*treeStream << "(";
}
traverse (p->GetChild());
if (p->GetSibling())
{
*treeStream << ",";
}
else
{
if (p != Root)
{
*treeStream << ")";
// 29/3/96
if ((p->GetAnc()->GetLabel() != "") && InternalLabels)
{
*treeStream << '\'' << NEXUSString (p->GetAnc()->GetLabel ()) << '\'';
}
if (EdgeLengths && (p->GetAnc () != Root))
{
*treeStream << ':' << p->GetAnc()->GetEdgeLength ();
}
}
}
traverse (p->GetSibling());
}
}