Ejemplo n.º 1
0
    //------------------------------------------------------------------------
    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);
        }
    }
Ejemplo n.º 2
0
 //------------------------------------------------------------------------
 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);
     }
 }
vertex_id reach_dijkstra::iterate()
{
    if (q_.size() > max_heap_size_)
        max_heap_size_ = q_.size();


    while (pout_->count(q_.top().id) != 0)
    {
        if (iterations_counter % 100000 == 0)
            cout << "Heap size: " << q_.size() << endl;
        ++iterations_counter;

        q_.pop();
    }

    heap_vertex hv = q_.top();
    q_.pop();
    
    const path_vertex &pv = unordered_safe_find_const(border_, hv.id);
    (*pout_)[hv.id] = pv;

    const vertex &v = pgraph_->get_vertex(hv.id);

    for (vertex::adj_iterator it = v.out_begin(); it != v.out_end(); ++it)
    {

        const vertex_id &adj_vid = (*it).v;
        const vertex &adj_v = pgraph_->get_vertex(adj_vid);
        const edge_id &eid = (*it).e;
        const edge &e = pgraph_->get_edge(eid);

        if (pout_->count (adj_vid) > 0)
            continue;
        
        path_vertex pv2 (adj_vid, pv.d + get_weight(e), eid, hv.id);
        heap_vertex hv2 (adj_vid, pv2.d); 

        if (border_.count(adj_vid) == 0 || 
            unordered_safe_find_const(border_, adj_vid).d > pv2.d)
        {
            q_.push(hv2);
            border_[adj_vid] = pv2;
        }
    }
    border_.erase(hv.id);
    return hv.id;
}
Ejemplo n.º 4
0
 //------------------------------------------------------------------------
 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());
 }