equal
deleted
inserted
replaced
14 * express or implied, and with no claim as to its suitability for any |
14 * express or implied, and with no claim as to its suitability for any |
15 * purpose. |
15 * purpose. |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 #include "graph_displayer_canvas.h" |
19 #include <graph_displayer_canvas.h> |
|
20 #include <mapstorage.h> |
|
21 #include <nbtab.h> |
20 #include <cmath> |
22 #include <cmath> |
21 |
23 |
22 const int minimum_node_radius=5; |
24 const int minimum_node_radius=5; |
23 |
25 |
24 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node) |
26 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node) |
25 { |
27 { |
26 Graph::NodeMap<double> * actual_map; |
28 Graph::NodeMap<double> * actual_map; |
27 double min, max; |
29 double min, max; |
28 min=(mytab.mapstorage).minOfNodeMap(mapname); |
30 min=(mytab.mapstorage)->minOfNodeMap(mapname); |
29 max=(mytab.mapstorage).maxOfNodeMap(mapname); |
31 max=(mytab.mapstorage)->maxOfNodeMap(mapname); |
30 actual_map=((mytab.mapstorage).nodemap_storage)[mapname]; |
32 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; |
31 |
33 |
32 if(node==INVALID) |
34 if(node==INVALID) |
33 { |
35 { |
34 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
36 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) |
35 { |
37 { |
36 double v=fabs((*actual_map)[i]); |
38 double v=fabs((*actual_map)[i]); |
37 int w; |
39 int w; |
38 if(autoscale) |
40 if(autoscale) |
39 { |
41 { |
101 int GraphDisplayerCanvas::resetNodeRadius (Node node) |
103 int GraphDisplayerCanvas::resetNodeRadius (Node node) |
102 { |
104 { |
103 double min, max; |
105 double min, max; |
104 min=node_property_defaults[N_RADIUS]; |
106 min=node_property_defaults[N_RADIUS]; |
105 max=node_property_defaults[N_RADIUS]; |
107 max=node_property_defaults[N_RADIUS]; |
106 Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_RADIUS]); |
108 Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_RADIUS]); |
107 |
109 |
108 if(node==INVALID) |
110 if(node==INVALID) |
109 { |
111 { |
110 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
112 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) |
111 { |
113 { |
112 double v=fabs(actual_map[i]); |
114 double v=fabs(actual_map[i]); |
113 int w; |
115 int w; |
114 if(min==max) |
116 if(min==max) |
115 { |
117 { |
165 //function maps the range of the maximum and |
167 //function maps the range of the maximum and |
166 //the minimum of the nodemap to the range of |
168 //the minimum of the nodemap to the range of |
167 //green in RGB |
169 //green in RGB |
168 |
170 |
169 Graph::NodeMap<double> * actual_map; |
171 Graph::NodeMap<double> * actual_map; |
170 actual_map=((mytab.mapstorage).nodemap_storage)[mapname]; |
172 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; |
171 |
173 |
172 double max, min; |
174 double max, min; |
173 |
175 |
174 max=(mytab.mapstorage).maxOfNodeMap(mapname); |
176 max=(mytab.mapstorage)->maxOfNodeMap(mapname); |
175 min=(mytab.mapstorage).minOfNodeMap(mapname); |
177 min=(mytab.mapstorage)->minOfNodeMap(mapname); |
176 |
178 |
177 if(node==INVALID) |
179 if(node==INVALID) |
178 { |
180 { |
179 |
181 |
180 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
182 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) |
181 { |
183 { |
182 Gdk::Color color; |
184 Gdk::Color color; |
183 |
185 |
184 double w=(*actual_map)[i]; |
186 double w=(*actual_map)[i]; |
185 |
187 |
220 |
222 |
221 //function maps the range of the maximum and |
223 //function maps the range of the maximum and |
222 //the minimum of the nodemap to the range of |
224 //the minimum of the nodemap to the range of |
223 //green in RGB |
225 //green in RGB |
224 |
226 |
225 Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_COLOR]); |
227 Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_COLOR]); |
226 |
228 |
227 double max, min; |
229 double max, min; |
228 |
230 |
229 max=node_property_defaults[N_COLOR]; |
231 max=node_property_defaults[N_COLOR]; |
230 min=node_property_defaults[N_COLOR]; |
232 min=node_property_defaults[N_COLOR]; |
231 |
233 |
232 if(node==INVALID) |
234 if(node==INVALID) |
233 { |
235 { |
234 |
236 |
235 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
237 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) |
236 { |
238 { |
237 Gdk::Color color; |
239 Gdk::Color color; |
238 |
240 |
239 double w=actual_map[i]; |
241 double w=actual_map[i]; |
240 |
242 |
277 //EXCEPT when the name of the map is Text, because |
279 //EXCEPT when the name of the map is Text, because |
278 //in that case empty string will be written, because |
280 //in that case empty string will be written, because |
279 //that is the deleter map |
281 //that is the deleter map |
280 |
282 |
281 Graph::NodeMap<double> * actual_map=NULL; |
283 Graph::NodeMap<double> * actual_map=NULL; |
282 actual_map=((mytab.mapstorage).nodemap_storage)[mapname]; |
284 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; |
283 |
285 |
284 if(node==INVALID) |
286 if(node==INVALID) |
285 { |
287 { |
286 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
288 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) |
287 { |
289 { |
288 nodemap_to_edit=mapname; |
290 nodemap_to_edit=mapname; |
289 double number=(*actual_map)[i]; |
291 double number=(*actual_map)[i]; |
290 |
292 |
291 std::ostringstream ostr; |
293 std::ostringstream ostr; |
314 //in that case empty string will be written, because |
316 //in that case empty string will be written, because |
315 //that is the deleter map |
317 //that is the deleter map |
316 |
318 |
317 if(node==INVALID) |
319 if(node==INVALID) |
318 { |
320 { |
319 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
321 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) |
320 { |
322 { |
321 nodemap_to_edit=""; |
323 nodemap_to_edit=""; |
322 nodetextmap[i]->property_text().set_value(""); |
324 nodetextmap[i]->property_text().set_value(""); |
323 } |
325 } |
324 } |
326 } |