No maps with the same name can be added.
1 #include <graph_displayer_canvas.h>
2 #include <broken_edge.h>
6 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
8 Graph::EdgeMap<double> * actual_map;
11 actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
15 actual_map=(mapstorage.edgemap_storage)[mapname];
20 for (EdgeIt i(g); i!=INVALID; ++i)
22 int w=(int)(*actual_map)[i];
25 edgesmap[i]->property_width_pixels().set_value(w);
31 int w=(int)(*actual_map)[edge];
34 edgesmap[edge]->property_width_pixels().set_value(w);
40 int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Graph::Edge edge)
43 //function maps the range of the maximum and
44 //the minimum of the nodemap to the range of
46 Graph::EdgeMap<double> * actual_map;
47 if(mapname=="Default")
49 actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_COLOR]);
53 actual_map=(mapstorage.edgemap_storage)[mapname];
58 if(mapname!="Default")
60 max=mapstorage.maxOfEdgeMap(mapname);
61 min=mapstorage.minOfEdgeMap(mapname);
65 max=edge_property_defaults[E_COLOR];
66 min=edge_property_defaults[E_COLOR];
71 for (EdgeIt i(g); i!=INVALID; ++i)
73 double w=(*actual_map)[i];
78 color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
82 color.set_rgb_p (0, 100, 0);
84 edgesmap[i]->property_fill_color_gdk().set_value(color);
91 double w=(*actual_map)[edge];
95 color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
99 color.set_rgb_p (0, 100, 0);
102 edgesmap[edge]->property_fill_color_gdk().set_value(color);
107 int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Graph::Edge edge)
109 //the number in the map will be written on the edge
110 //EXCEPT when the name of the map is Default, because
111 //in that case empty string will be written, because
112 //that is the deleter map
116 for (EdgeIt i(g); i!=INVALID; ++i)
118 if(mapname!="Default")
120 edgemap_to_edit=mapname;
121 double number=(*(mapstorage.edgemap_storage)[mapname])[i];
123 std::ostringstream ostr;
126 edgetextmap[i]->property_text().set_value(ostr.str());
131 edgetextmap[i]->property_text().set_value("");
138 if(mapname!="Default")
140 double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
142 std::ostringstream ostr;
145 edgetextmap[edge]->property_text().set_value(ostr.str());
149 edgetextmap[edge]->property_text().set_value("");