4 |
4 |
5 |
5 |
6 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node) |
6 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node) |
7 { |
7 { |
8 Graph::NodeMap<double> * actual_map; |
8 Graph::NodeMap<double> * actual_map; |
|
9 double min, max; |
9 if(mapname=="Default") |
10 if(mapname=="Default") |
10 { |
11 { |
|
12 min=node_property_defaults[N_RADIUS]; |
|
13 max=node_property_defaults[N_RADIUS]; |
11 actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]); |
14 actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]); |
12 } |
15 } |
13 else |
16 else |
14 { |
17 { |
|
18 min=mapstorage.minOfNodeMap(mapname); |
|
19 max=mapstorage.maxOfNodeMap(mapname); |
15 actual_map=(mapstorage.nodemap_storage)[mapname]; |
20 actual_map=(mapstorage.nodemap_storage)[mapname]; |
16 } |
21 } |
17 |
22 |
18 if(node==INVALID) |
23 if(node==INVALID) |
19 { |
24 { |
20 for (NodeIt i(g); i!=INVALID; ++i) |
25 for (NodeIt i(g); i!=INVALID; ++i) |
21 { |
26 { |
22 int w=(int)(*actual_map)[i]; |
27 double v=abs((*actual_map)[i]); |
|
28 int w; |
|
29 if(min==max) |
|
30 { |
|
31 w=(int)(node_property_defaults[N_RADIUS]); |
|
32 } |
|
33 else |
|
34 { |
|
35 w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS)); |
|
36 } |
23 if(w>=0) |
37 if(w>=0) |
24 { |
38 { |
25 double x1, y1, x2, y2; |
39 double x1, y1, x2, y2; |
26 x1=nodesmap[i]->property_x1().get_value(); |
40 x1=nodesmap[i]->property_x1().get_value(); |
27 x2=nodesmap[i]->property_x2().get_value(); |
41 x2=nodesmap[i]->property_x2().get_value(); |