本文整理汇总了C++中graph::get_node方法的典型用法代码示例。如果您正苦于以下问题:C++ graph::get_node方法的具体用法?C++ graph::get_node怎么用?C++ graph::get_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::get_node方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_dashes_draft
//------------------------------------------------------------------------
void draw_dashes_draft()
{
pixfmt pixf(rbuf_window());
base_renderer rb(pixf);
primitives_renderer prim(rb);
outline_rasterizer ras(prim);
int i;
for(i = 0; i < m_graph.get_num_edges(); i++)
{
graph::edge e = m_graph.get_edge(i);
graph::node n1 = m_graph.get_node(e.node1, width(), height());
graph::node n2 = m_graph.get_node(e.node2, width(), height());
curve c(n1.x, n1.y, n2.x, n2.y);
dash_stroke_draft<curve> s(c, 6.0, 3.0, m_width.value());
int r = rand() & 0x7F;
int g = rand() & 0x7F;
int b = rand() & 0x7F;
int a = 255;
if(m_translucent.status()) a = 80;
prim.line_color(agg::srgba8(r, g, b, a));
ras.add_path(s);
}
}
示例2: draw_dashes_fine
//------------------------------------------------------------------------
void draw_dashes_fine(scanline_rasterizer& ras,
solid_renderer& solid,
draft_renderer& draft)
{
int i;
for(i = 0; i < m_graph.get_num_edges(); i++)
{
graph::edge b = m_graph.get_edge(i);
graph::node n1 = m_graph.get_node(b.node1, width(), height());
graph::node n2 = m_graph.get_node(b.node2, width(), height());
curve c(n1.x, n1.y, n2.x, n2.y);
dash_stroke_fine<curve> s(c, 6.0, 3.0, m_width.value());
render_edge_fine(ras, solid, draft, s);
}
}
示例3: draw_nodes_draft
//------------------------------------------------------------------------
void draw_nodes_draft()
{
pixfmt pixf(rbuf_window());
base_renderer rb(pixf);
primitives_renderer prim(rb);
int i;
for(i = 0; i < m_graph.get_num_nodes(); i++)
{
graph::node n = m_graph.get_node(i, width(), height());
prim.fill_color(m_gradient_colors[147]);
prim.line_color(m_gradient_colors[255]);
prim.outlined_ellipse(int(n.x), int(n.y), 10, 10);
prim.fill_color(m_gradient_colors[50]);
prim.solid_ellipse(int(n.x), int(n.y), 4, 4);
}
}
示例4: draw_nodes_fine
//------------------------------------------------------------------------
void draw_nodes_fine(scanline_rasterizer& ras)
{
gradient_span_alloc sa;
pixfmt pixf(rbuf_window());
base_renderer rb(pixf);
int i;
for(i = 0; i < m_graph.get_num_nodes(); i++)
{
graph::node n = m_graph.get_node(i, width(), height());
agg::ellipse ell(n.x, n.y, 5.0 * m_width.value(), 5.0 * m_width.value());
double x, y;
switch(m_draw)
{
case 0:
ell.rewind(0);
while(!agg::is_stop(ell.vertex(&x, &y)));
break;
case 1:
ras.reset();
ras.add_path(ell);
break;
case 2:
ras.reset();
ras.add_path(ell);
ras.sort();
break;
case 3:
{
gradient_function gf;
agg::trans_affine mtx;
mtx *= agg::trans_affine_scaling(m_width.value() / 2.0);
mtx *= agg::trans_affine_translation(n.x, n.y);
mtx.invert();
interpolator inter(mtx);
gradient_span_gen sg(inter, gf, m_gradient_colors, 0.0, 10.0);
gradient_renderer ren(rb, sa, sg);
ras.add_path(ell);
agg::render_scanlines(ras, m_sl, ren);
}
break;
}
}
}
示例5: draw_polygons
//------------------------------------------------------------------------
void draw_polygons(scanline_rasterizer& ras,
solid_renderer& solid,
draft_renderer& draft)
{
int i;
if(m_type.cur_item() == 4)
{
ras.gamma(agg::gamma_threshold(0.5));
}
for(i = 0; i < m_graph.get_num_edges(); i++)
{
graph::edge b = m_graph.get_edge(i);
graph::node n1 = m_graph.get_node(b.node1, width(), height());
graph::node n2 = m_graph.get_node(b.node2, width(), height());
curve c(n1.x, n1.y, n2.x, n2.y);
render_edge_fine(ras, solid, draft, c);
}
ras.gamma(agg::gamma_none());
}
示例6: divide_graph
void partialgraph::divide_graph(const graph& g, int number, std::string outfile_prefix) {
// divided to equal nodes per graph
const int totalnode = g.get_node_num();
nodepergraph = ceil((double) totalnode / (double) number);
int nodecnt = 0;
std::vector<NodePtr> pnvec = g.get_node();
for (int i = 0; i < number; ++i) {
// convert i to string
std::stringstream ss_cnt;
ss_cnt << i;
// obtain output file name for this part of the graph
std::string outfile = outfile_prefix + ss_cnt.str() + ".txt";
// open file
FILE* fp = fopen(outfile.c_str(), "w");
int nodelimit = (nodecnt + nodepergraph) < totalnode ? (nodecnt + nodepergraph) : totalnode;
// print node number
fprintf(fp, "%d\n", nodelimit - nodecnt);
// print start node
fprintf(fp, "%d\n", nodecnt);
// print end node
fprintf(fp, "%d\n", nodelimit - 1);
for (; nodecnt < nodelimit; ++nodecnt) {
// print node id
fprintf(fp, "%d\n", nodecnt);
// print neighbors
const std::vector<int>& nbvec = pnvec[nodecnt]->nbvec;
fprintf(fp, "%d\n", nbvec.size());
for (int j = 0; j < nbvec.size(); ++j) fprintf(fp, "%d ", nbvec[j]);
fprintf(fp, "\n");
// print walkers
const std::vector<int>& walkervec = pnvec[nodecnt]->walkervec;
fprintf(fp, "%d\n", walkervec.size());
for (int j = 0; j < walkervec.size(); ++j) fprintf(fp, "%d ", walkervec[j]);
fprintf(fp, "\n");
}
fclose(fp);
}
}