gui/graph_displayer_canvas.cc
changeset 1515 dd7616b51333
parent 1510 cde847387b5a
child 1524 587a823bcdd0
equal deleted inserted replaced
17:a1494ee9ab46 18:70e18dc86fea
     1 #include <graph_displayer_canvas.h>
     1 #include <graph_displayer_canvas.h>
     2 #include <broken_edge.h>
     2 #include <broken_edge.h>
     3 #include <math.h>
     3 #include <math.h>
     4 
     4 
     5 GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),displayed_graph(*(root()), 0, 0),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL)
     5 GraphDisplayerCanvas::GraphDisplayerCanvas(Graph & gr, CoordinatesMap & cm, MapStorage & ms, MapWin * mw):g(gr),nodesmap(g),edgesmap(g),edgetextmap(g),nodetextmap(g),displayed_graph(*(root()), 0, 0),mapstorage(ms),isbutton(0),active_item(NULL),target_item(NULL),mapwin(mw)
     6 {
     6 {
     7   
     7   
     8   actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_node_event_handler), false);
     8   actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::create_node_event_handler), false);
     9   actual_tool=CREATE_NODE;
     9   actual_tool=CREATE_NODE;
    10 
    10 
    32 
    32 
    33     xy<double> text_pos=edgesmap[i]->get_arrow_pos();
    33     xy<double> text_pos=edgesmap[i]->get_arrow_pos();
    34     text_pos+=(xy<double>(10,10));
    34     text_pos+=(xy<double>(10,10));
    35 
    35 
    36     edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    36     edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    37     edgetextmap[i]->property_fill_color().set_value("black");
    37     edgetextmap[i]->property_fill_color().set_value("darkgreen");
    38   }
    38   }
    39 
    39 
    40   //afterwards nodes come to be drawn
    40   //afterwards nodes come to be drawn
    41 
    41 
    42   NodeIt i(g);
    42   NodeIt i(g);
    54     //drawing bule nodes, with black line around them
    54     //drawing bule nodes, with black line around them
    55 
    55 
    56     nodesmap[i]=new Gnome::Canvas::Ellipse(displayed_graph, cm[i].x-20, cm[i].y-20, cm[i].x+20, cm[i].y+20);
    56     nodesmap[i]=new Gnome::Canvas::Ellipse(displayed_graph, cm[i].x-20, cm[i].y-20, cm[i].x+20, cm[i].y+20);
    57     *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
    57     *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
    58     *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
    58     *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
    59     //!!!!!!! (nodesmap[i])->signal_event().connect(sigc::bind(sigc::mem_fun(*this, &GraphDisplayerCanvas::event_handler),i));
    59 
       
    60     //initializing edge-text as well, to empty string
       
    61 
       
    62     xy<double> text_pos((cm[i].x+node_property_defaults[N_RADIUS]+5),(cm[i].y+node_property_defaults[N_RADIUS]+5));
       
    63 
       
    64     nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
       
    65     nodetextmap[i]->property_fill_color().set_value("darkblue");
    60   }
    66   }
    61 
    67 
    62   updateScrollRegion();
    68   updateScrollRegion();
    63 }
    69 }
    64 
    70