本文整理汇总了C++中Site::get_branch_count_since_last_used方法的典型用法代码示例。如果您正苦于以下问题:C++ Site::get_branch_count_since_last_used方法的具体用法?C++ Site::get_branch_count_since_last_used怎么用?C++ Site::get_branch_count_since_last_used使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::get_branch_count_since_last_used方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_metapost_alignment_graph
void Node::write_metapost_alignment_graph(ostream *output, ostream *output2, int *count, int root_length) const throw (Exception)
{
vector<Site> *sites = this->sequence->get_sites();
vector<int> left_child_index;
vector<int> right_child_index;
for(unsigned int i=0;i<sites->size();i++)
{
Site_children *offspring = sites->at(i).get_children();
if(offspring->left_index>=0)
{
left_child_index.push_back(i);
}
if(offspring->right_index>=0)
{
right_child_index.push_back(i);
}
}
*output<<"beginfig("<<*count<<");\npickup pencircle scaled 1pt;\npath l[]; path r[];\ndefaultscale := 0.5;\n";
string full_alphabet = this->sequence->get_full_alphabet();
*output<<"l0 = circle((0cm,1.5cm),\"s\",white);\n";
*output<<"r0 = circle((0cm,0cm),\"s\",white);\n";
stringstream all_chars;
for(unsigned int i=1;i<sites->size();i++)
{
Site_children *offspring = sites->at(i).get_children();
if(offspring->left_index>=0)
{
Site *lsite = this->left_child->get_sequence()->get_site_at(offspring->left_index);
char lc = 's';
if(lsite->get_site_type()==Site::real_site || lsite->get_site_type()==Site::non_real)
lc = full_alphabet.at(lsite->get_state());
else if(lsite->get_site_type()==Site::stop_site)
lc = 'e';
string color = this->get_node_fill_color(lc);
if(lsite->get_branch_count_since_last_used()>0)
color = "0.5white";
*output<<"l"<<i<<" = circle"<<"(("<<0.5*i<<"cm,1.5cm),\""<<lc<<"\","<<color<<");\n";
}
if(offspring->right_index>=0)
{
Site *rsite = this->right_child->get_sequence()->get_site_at(offspring->right_index);
char rc = 's';
if(rsite->get_site_type()==Site::real_site || rsite->get_site_type()==Site::non_real)
rc = full_alphabet.at(rsite->get_state());
else if(rsite->get_site_type()==Site::stop_site)
rc = 'e';
string color = this->get_node_fill_color(rc);
if(rsite->get_branch_count_since_last_used()>0)
color = "0.5white";
*output<<"r"<<i<<" = circle"<<"(("<<0.5*i<<"cm,0cm),\""<<rc<<"\","<<color<<");\n";
}
}
if(left_child->is_leaf())
*output<<"label.top(btex $"<<left_child->get_name()<<"$ etex,(0.125cm,1.75cm));\n";
else
{
string n = left_child->get_name();
n = n.substr(1,n.length()-2);
*output<<"label.top(btex \\#"<<n<<"\\# etex,(0.125cm,1.75cm));\n";
}
if(right_child->is_leaf())
*output<<"label.top(btex $"<<right_child->get_name()<<"$ etex,(0.125cm,0.25cm));\n";
else
{
string n = right_child->get_name();
n = n.substr(1,n.length()-2);
*output<<"label.top(btex \\#"<<n<<"\\# etex,(0.125cm,0.25cm));\n";
}
*output<<"defaultscale := 0.25;\n";
for(unsigned int i=1;i<sites->size();i++)
{
Site_children *offspring = sites->at(i).get_children();
if(offspring->left_index>=0)
{
Site *tsite = left_child->get_sequence()->get_site_at(offspring->left_index);
if(tsite->has_bwd_edge())
{
//.........这里部分代码省略.........
示例2: write_metapost_sequence_graph
void Node::write_metapost_sequence_graph(ostream *output, ostream *output2, int *count, int root_length) const throw (Exception)
{
*output<<"beginfig("<<*count<<");\npickup pencircle scaled 1pt;\npath c[];\ndefaultscale := 0.5;\n";
vector<Site> *sites = this->sequence->get_sites();
string full_alphabet = this->sequence->get_full_alphabet();
stringstream all_chars;
for(unsigned int i=0;i<sites->size();i++)
{
Site *tsite = &sites->at(i);
char c = 's';
if(tsite->get_site_type()==Site::real_site)
c = full_alphabet.at(tsite->get_state());
else if(tsite->get_site_type()==Site::stop_site)
c = 'e';
string color = this->get_node_fill_color(c);
if(tsite->get_branch_count_since_last_used()>0)
color = "0.5white";
*output<<"c"<<i<<" = circle"<<"(("<<0.5*i<<"cm,0cm),\""<<c<<"\","<<color<<");\n";
}
if(leaf)
*output<<"label.top(btex $"<<this->get_name()<<"$ etex,(0.125cm,0.25cm));\n";
else
{
string n = this->get_name();
n = n.substr(1,n.length()-2);
*output<<"label.top(btex \\#"<<n<<"\\# etex,(0.125cm,0.25cm));\n";
}
*output<<"defaultscale := 0.25;\n";
for(unsigned int i=1;i<sites->size();i++)
{
Site *tsite = &sites->at(i);
if(tsite->has_bwd_edge())
{
Edge *tedge = tsite->get_first_bwd_edge();
int start = tedge->get_start_site_index();
int stop = tedge->get_end_site_index();
int angle = 0;
string place = "edgetop";
if(start+1==stop)
place = "edgebot";
else if(start+2==stop)
angle = 40;
else if(start+3==stop)
angle = 30;
else if(start+4<=stop)
angle = 20;
stringstream label;
if(tedge->get_branch_count_since_last_used()>0)
label<<"["<<tedge->get_branch_count_since_last_used()<<" "<<tedge->get_branch_count_as_skipped_edge()<<" "<<tedge->get_branch_distance_since_last_used()<<"]";
*output<<place<<"(c"<<start<<",c"<<stop<<","<<angle<<",\""<<label.str()<<"\",0.5);\n";
while(tsite->has_next_bwd_edge())
{
tedge = tsite->get_next_bwd_edge();
start = tedge->get_start_site_index();
stop = tedge->get_end_site_index();
angle = 0;
place = "edgetop";
if(start+1==stop)
place = "edgebot";
else if(start+2==stop)
angle = 40;
else if(start+3==stop)
angle = 30;
else if(start+4<=stop)
angle = 20;
label.str("");
if(tedge->get_branch_count_since_last_used()>0)
label<<"["<<tedge->get_branch_count_since_last_used()<<" "<<tedge->get_branch_count_as_skipped_edge()<<" "<<tedge->get_branch_distance_since_last_used()<<"]";
*output<<place<<"(c"<<start<<",c"<<stop<<","<<angle<<",\""<<label.str()<<"\",0.5);\n";
}
}
}
*output<<"endfig;\n";
string file = Settings_handle::st.get("mpost-graph-file").as<string>();
float width = (float)this->sequence->get_sites()->size()/(float)root_length;
*output2<<"\\includegraphics[width="<<width<<"\\columnwidth]{"<<file<<"."<<*count<<"}\n\n\\bigskip\n";
++*count;
//.........这里部分代码省略.........