equal
deleted
inserted
replaced
59 return 0; |
59 return 0; |
60 }; |
60 }; |
61 |
61 |
62 int GraphDisplayerCanvas::resetNodeRadius (Node node) |
62 int GraphDisplayerCanvas::resetNodeRadius (Node node) |
63 { |
63 { |
64 Graph::NodeMap<double> * actual_map; |
|
65 double min, max; |
64 double min, max; |
66 min=node_property_defaults[N_RADIUS]; |
65 min=node_property_defaults[N_RADIUS]; |
67 max=node_property_defaults[N_RADIUS]; |
66 max=node_property_defaults[N_RADIUS]; |
68 actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]); |
67 Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_RADIUS]); |
69 |
68 |
70 if(node==INVALID) |
69 if(node==INVALID) |
71 { |
70 { |
72 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) |
71 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) |
73 { |
72 { |
74 double v=fabs((*actual_map)[i]); |
73 double v=fabs(actual_map[i]); |
75 int w; |
74 int w; |
76 if(min==max) |
75 if(min==max) |
77 { |
76 { |
78 w=(int)(node_property_defaults[N_RADIUS]); |
77 w=(int)(node_property_defaults[N_RADIUS]); |
79 } |
78 } |
96 } |
95 } |
97 } |
96 } |
98 else |
97 else |
99 { |
98 { |
100 //I think only new nodes use this case |
99 //I think only new nodes use this case |
101 // int w=(int)(*actual_map)[node]; |
100 // int w=(int)actual_map[node]; |
102 int w=(int)(node_property_defaults[N_RADIUS]); |
101 int w=(int)(node_property_defaults[N_RADIUS]); |
103 if(w>=0) |
102 if(w>=0) |
104 { |
103 { |
105 double x1, y1, x2, y2; |
104 double x1, y1, x2, y2; |
106 x1=nodesmap[node]->property_x1().get_value(); |
105 x1=nodesmap[node]->property_x1().get_value(); |
177 |
176 |
178 //function maps the range of the maximum and |
177 //function maps the range of the maximum and |
179 //the minimum of the nodemap to the range of |
178 //the minimum of the nodemap to the range of |
180 //green in RGB |
179 //green in RGB |
181 |
180 |
182 Graph::NodeMap<double> * actual_map; |
181 Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_COLOR]); |
183 actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]); |
|
184 |
182 |
185 double max, min; |
183 double max, min; |
186 |
184 |
187 max=node_property_defaults[N_COLOR]; |
185 max=node_property_defaults[N_COLOR]; |
188 min=node_property_defaults[N_COLOR]; |
186 min=node_property_defaults[N_COLOR]; |
192 |
190 |
193 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) |
191 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) |
194 { |
192 { |
195 Gdk::Color color; |
193 Gdk::Color color; |
196 |
194 |
197 double w=(*actual_map)[i]; |
195 double w=actual_map[i]; |
198 |
196 |
199 if(max!=min) |
197 if(max!=min) |
200 { |
198 { |
201 color.set_rgb_p (0, 0, 100*(w-min)/(max-min)); |
199 color.set_rgb_p (0, 0, 100*(w-min)/(max-min)); |
202 } |
200 } |
210 } |
208 } |
211 else |
209 else |
212 { |
210 { |
213 Gdk::Color color; |
211 Gdk::Color color; |
214 |
212 |
215 double w=(*actual_map)[node]; |
213 double w=actual_map[node]; |
216 |
214 |
217 if(max!=min) |
215 if(max!=min) |
218 { |
216 { |
219 color.set_rgb_p (0, 0, 100*(w-min)/(max-min)); |
217 color.set_rgb_p (0, 0, 100*(w-min)/(max-min)); |
220 } |
218 } |