equal
deleted
inserted
replaced
4 |
4 |
5 |
5 |
6 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge) |
6 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge) |
7 { |
7 { |
8 Graph::EdgeMap<double> * actual_map; |
8 Graph::EdgeMap<double> * actual_map; |
|
9 double min, max; |
|
10 |
9 if(mapname=="Default") |
11 if(mapname=="Default") |
10 { |
12 { |
|
13 min=edge_property_defaults[E_WIDTH]; |
|
14 max=edge_property_defaults[E_WIDTH]; |
11 actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]); |
15 actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]); |
12 } |
16 } |
13 else |
17 else |
14 { |
18 { |
|
19 min=mapstorage.minOfEdgeMap(mapname); |
|
20 max=mapstorage.maxOfEdgeMap(mapname); |
15 actual_map=(mapstorage.edgemap_storage)[mapname]; |
21 actual_map=(mapstorage.edgemap_storage)[mapname]; |
16 } |
22 } |
17 |
23 |
18 if(edge==INVALID) |
24 if(edge==INVALID) |
19 { |
25 { |
20 for (EdgeIt i(g); i!=INVALID; ++i) |
26 for (EdgeIt i(g); i!=INVALID; ++i) |
21 { |
27 { |
22 int w=(int)(*actual_map)[i]; |
28 double v=abs((*actual_map)[i]); |
23 if(w>=0) |
29 int w; |
|
30 if(min==max) |
24 { |
31 { |
25 edgesmap[i]->property_width_units().set_value(w); |
32 w=(int)(edge_property_defaults[E_WIDTH]); |
26 } |
33 } |
|
34 else |
|
35 { |
|
36 w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH)); |
|
37 } |
|
38 edgesmap[i]->property_width_units().set_value(w); |
27 } |
39 } |
28 } |
40 } |
29 else |
41 else |
30 { |
42 { |
31 int w=(int)(*actual_map)[edge]; |
43 int w=(int)(*actual_map)[edge]; |