Typo.
1 #include <graph_displayer_canvas.h>
2 #include <broken_edge.h>
6 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
8 Graph::NodeMap<double> * actual_map;
11 actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]);
15 actual_map=(mapstorage.nodemap_storage)[mapname];
20 for (NodeIt i(g); i!=INVALID; ++i)
22 int w=(int)(*actual_map)[i];
25 double x1, y1, x2, y2;
26 x1=nodesmap[i]->property_x1().get_value();
27 x2=nodesmap[i]->property_x2().get_value();
28 y1=nodesmap[i]->property_y1().get_value();
29 y2=nodesmap[i]->property_y2().get_value();
30 nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
31 nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
32 nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
33 nodesmap[i]->property_y2().set_value((y1+y2)/2+w);
39 //I think only new nodes use this case
40 // int w=(int)(*actual_map)[node];
41 int w=(int)(node_property_defaults[N_RADIUS]);
44 double x1, y1, x2, y2;
45 x1=nodesmap[node]->property_x1().get_value();
46 x2=nodesmap[node]->property_x2().get_value();
47 y1=nodesmap[node]->property_y1().get_value();
48 y2=nodesmap[node]->property_y2().get_value();
49 nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
50 nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
51 nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
52 nodesmap[node]->property_y2().set_value((y1+y2)/2+w);
58 int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Graph::Node node)
61 //function maps the range of the maximum and
62 //the minimum of the nodemap to the range of
65 Graph::NodeMap<double> * actual_map;
66 if(mapname=="Default")
68 actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
72 actual_map=(mapstorage.nodemap_storage)[mapname];
77 if(mapname!="Default")
79 max=mapstorage.maxOfNodeMap(mapname);
80 min=mapstorage.minOfNodeMap(mapname);
84 max=node_property_defaults[N_COLOR];
85 min=node_property_defaults[N_COLOR];
92 for (NodeIt i(g); i!=INVALID; ++i)
96 double w=(*actual_map)[i];
100 color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
104 color.set_rgb_p (0, 0, 100);
107 nodesmap[i]->property_fill_color_gdk().set_value(color);
114 double w=(*actual_map)[node];
118 color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
122 color.set_rgb_p (0, 0, 100);
125 nodesmap[node]->property_fill_color_gdk().set_value(color);
130 int GraphDisplayerCanvas::changeNodeText (std::string mapname, Graph::Node node)
133 //the number in the map will be written on the node
134 //EXCEPT when the name of the map is Text, because
135 //in that case empty string will be written, because
136 //that is the deleter map
138 Graph::NodeMap<double> * actual_map;
139 if(mapname=="Default")
141 actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
145 actual_map=(mapstorage.nodemap_storage)[mapname];
150 for (NodeIt i(g); i!=INVALID; ++i)
152 if(mapname!="Default")
154 double number=(*actual_map)[i];
156 //if number is smaller than one, length would be negative, or invalid
159 length=(int)(floor(log(number)/log(10)))+1;
161 int maxpos=(int)(pow(10,length-1));
162 int strl=length+1+RANGE;
163 char * str=new char[strl];
167 for(int j=0;j<strl;j++)
171 int digit=(int)(number/maxpos);
173 number-=digit*maxpos;
178 nodetextmap[i]->property_text().set_value(str);
182 nodetextmap[i]->property_text().set_value("");
188 if(mapname!="Default")
190 double number=(*actual_map)[node];
192 //if number is smaller than one, length would be negative, or invalid
195 length=(int)(floor(log(number)/log(10)))+1;
197 int maxpos=(int)(pow(10,length-1));
198 int strl=length+1+RANGE;
199 char * str=new char[strl];
203 for(int j=0;j<strl;j++)
207 int digit=(int)(number/maxpos);
209 number-=digit*maxpos;
214 nodetextmap[node]->property_text().set_value(str);
218 nodetextmap[node]->property_text().set_value("");