Function names are corrected according to naming conventions.
1 #include <graph_displayer_canvas.h>
2 #include <broken_edge.h>
6 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
10 for (EdgeIt i(g); i!=INVALID; ++i)
12 int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
15 edgesmap[i]->property_width_pixels().set_value(w);
21 int w=(int)(*(mapstorage.edgemap_storage)[mapname])[edge];
24 edgesmap[edge]->property_width_pixels().set_value(w);
30 int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Graph::Edge edge)
33 //function maps the range of the maximum and
34 //the minimum of the nodemap to the range of
39 for (EdgeIt i(g); i!=INVALID; ++i)
41 double w=(*(mapstorage.edgemap_storage)[mapname])[i];
42 double max=mapstorage.maxOfEdgeMap(mapname);
43 double min=mapstorage.minOfEdgeMap(mapname);
45 //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
49 color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
53 color.set_rgb_p (0, 100, 0);
56 edgesmap[i]->property_fill_color_gdk().set_value(color);
61 double w=(*(mapstorage.edgemap_storage)[mapname])[edge];
62 double max=mapstorage.maxOfEdgeMap(mapname);
63 double min=mapstorage.minOfEdgeMap(mapname);
65 //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
69 color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
73 color.set_rgb_p (0, 100, 0);
76 edgesmap[edge]->property_fill_color_gdk().set_value(color);
81 int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Graph::Edge edge)
84 //the number in the map will be written on the edge
85 //EXCEPT when the name of the map is Text, because
86 //in that case empty string will be written, because
87 //that is the deleter map
88 //\todo isn't it a bit woodcutter?
92 for (EdgeIt i(g); i!=INVALID; ++i)
94 if(mapname!=edge_property_strings[E_TEXT])
96 double number=(*(mapstorage.edgemap_storage)[mapname])[i];
98 //if number is smaller than one, length would be negative, or invalid
101 length=(int)(floor(log(number)/log(10)))+1;
103 int maxpos=(int)(pow(10,length-1));
104 int strl=length+1+RANGE;
105 char * str=new char[strl];
109 for(int j=0;j<strl;j++)
113 int digit=(int)(number/maxpos);
115 number-=digit*maxpos;
120 edgetextmap[i]->property_text().set_value(str);
124 edgetextmap[i]->property_text().set_value("");
131 if(mapname!=edge_property_strings[E_TEXT])
133 double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
135 //if number is smaller than one, length would be negative, or invalid
138 length=(int)(floor(log(number)/log(10)))+1;
140 int maxpos=(int)(pow(10,length-1));
141 int strl=length+1+RANGE;
142 char * str=new char[strl];
146 for(int j=0;j<strl;j++)
150 int digit=(int)(number/maxpos);
152 number-=digit*maxpos;
157 edgetextmap[edge]->property_text().set_value(str);
161 edgetextmap[edge]->property_text().set_value("");