1.1 --- a/gui/graph_displayer_canvas-edge.cc Wed Jun 29 15:41:33 2005 +0000
1.2 +++ b/gui/graph_displayer_canvas-edge.cc Wed Jun 29 19:44:30 2005 +0000
1.3 @@ -5,11 +5,21 @@
1.4
1.5 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
1.6 {
1.7 + Graph::EdgeMap<double> * actual_map;
1.8 + if(mapname=="Default")
1.9 + {
1.10 + actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
1.11 + }
1.12 + else
1.13 + {
1.14 + actual_map=(mapstorage.edgemap_storage)[mapname];
1.15 + }
1.16 +
1.17 if(edge==INVALID)
1.18 {
1.19 for (EdgeIt i(g); i!=INVALID; ++i)
1.20 {
1.21 - int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
1.22 + int w=(int)(*actual_map)[i];
1.23 if(w>=0)
1.24 {
1.25 edgesmap[i]->property_width_pixels().set_value(w);
1.26 @@ -18,7 +28,7 @@
1.27 }
1.28 else
1.29 {
1.30 - int w=(int)(*(mapstorage.edgemap_storage)[mapname])[edge];
1.31 + int w=(int)(*actual_map)[edge];
1.32 if(w>=0)
1.33 {
1.34 edgesmap[edge]->property_width_pixels().set_value(w);
1.35 @@ -33,16 +43,35 @@
1.36 //function maps the range of the maximum and
1.37 //the minimum of the nodemap to the range of
1.38 //green in RGB
1.39 + Graph::EdgeMap<double> * actual_map;
1.40 + if(mapname=="Default")
1.41 + {
1.42 + actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_COLOR]);
1.43 + }
1.44 + else
1.45 + {
1.46 + actual_map=(mapstorage.edgemap_storage)[mapname];
1.47 + }
1.48 +
1.49 + double max, min;
1.50 +
1.51 + if(mapname!="Default")
1.52 + {
1.53 + max=mapstorage.maxOfEdgeMap(mapname);
1.54 + min=mapstorage.minOfEdgeMap(mapname);
1.55 + }
1.56 + else
1.57 + {
1.58 + max=edge_property_defaults[E_COLOR];
1.59 + min=edge_property_defaults[E_COLOR];
1.60 + }
1.61 +
1.62 if(edge==INVALID)
1.63 {
1.64 -
1.65 for (EdgeIt i(g); i!=INVALID; ++i)
1.66 {
1.67 - double w=(*(mapstorage.edgemap_storage)[mapname])[i];
1.68 - double max=mapstorage.maxOfEdgeMap(mapname);
1.69 - double min=mapstorage.minOfEdgeMap(mapname);
1.70 -
1.71 - //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
1.72 + double w=(*actual_map)[i];
1.73 +
1.74 Gdk::Color color;
1.75 if(max!=min)
1.76 {
1.77 @@ -52,18 +81,15 @@
1.78 {
1.79 color.set_rgb_p (0, 100, 0);
1.80 }
1.81 -
1.82 edgesmap[i]->property_fill_color_gdk().set_value(color);
1.83 }
1.84 }
1.85 else
1.86 {
1.87 - double w=(*(mapstorage.edgemap_storage)[mapname])[edge];
1.88 - double max=mapstorage.maxOfEdgeMap(mapname);
1.89 - double min=mapstorage.minOfEdgeMap(mapname);
1.90 -
1.91 - //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
1.92 Gdk::Color color;
1.93 +
1.94 + double w=(*actual_map)[edge];
1.95 +
1.96 if(max!=min)
1.97 {
1.98 color.set_rgb_p (0, 100*(w-min)/(max-min), 0);
1.99 @@ -85,13 +111,12 @@
1.100 //EXCEPT when the name of the map is Text, because
1.101 //in that case empty string will be written, because
1.102 //that is the deleter map
1.103 - //\todo isn't it a bit woodcutter?
1.104
1.105 if(edge==INVALID)
1.106 {
1.107 for (EdgeIt i(g); i!=INVALID; ++i)
1.108 {
1.109 - if(mapname!=edge_property_strings[E_TEXT])
1.110 + if(mapname!="Default")
1.111 {
1.112 double number=(*(mapstorage.edgemap_storage)[mapname])[i];
1.113 int length=1;
1.114 @@ -128,7 +153,7 @@
1.115 }
1.116 else
1.117 {
1.118 - if(mapname!=edge_property_strings[E_TEXT])
1.119 + if(mapname!="Default")
1.120 {
1.121 double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
1.122 int length=1;