File graph_displayer is split in functional parts.
1 #include <graph_displayer_canvas.h>
2 #include <broken_edge.h>
6 int GraphDisplayerCanvas::changeLineWidth (std::string mapname)
8 for (EdgeIt i(g); i!=INVALID; ++i)
10 int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
13 edgesmap[i]->property_width_pixels().set_value(w);
19 int GraphDisplayerCanvas::changeColor (std::string mapname)
22 //function maps the range of the maximum and
23 //the minimum of the nodemap to the range of
26 for (EdgeIt i(g); i!=INVALID; ++i)
28 double w=(*(mapstorage.edgemap_storage)[mapname])[i];
29 double max=mapstorage.maxOfEdgeMap(mapname);
30 double min=mapstorage.minOfEdgeMap(mapname);
32 //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
36 color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
40 color.set_rgb_p (0, 100, 0);
43 edgesmap[i]->property_fill_color_gdk().set_value(color);
48 int GraphDisplayerCanvas::changeText (std::string mapname)
51 //the number in the map will be written on the edge
52 //EXCEPT when the name of the map is Text, because
53 //in that case empty string will be written, because
54 //that is the deleter map
55 //\todo isn't it a bit woodcutter?
57 for (EdgeIt i(g); i!=INVALID; ++i)
61 double number=(*(mapstorage.edgemap_storage)[mapname])[i];
63 //if number is smaller than one, length would be negative, or invalid
66 length=(int)(floor(log(number)/log(10)))+1;
68 int maxpos=(int)(pow(10,length-1));
69 int strl=length+1+RANGE;
70 char * str=new char[strl];
74 for(int j=0;j<strl;j++)
78 int digit=(int)(number/maxpos);
85 edgetextmap[i]->property_text().set_value(str);
89 edgetextmap[i]->property_text().set_value("");