1.1 --- a/graph_displayer_canvas-node.cc Wed Jun 29 15:41:33 2005 +0000
1.2 +++ b/graph_displayer_canvas-node.cc Wed Jun 29 19:44:30 2005 +0000
1.3 @@ -5,15 +5,28 @@
1.4
1.5 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
1.6 {
1.7 + Graph::NodeMap<double> * actual_map;
1.8 + if(mapname=="Default")
1.9 + {
1.10 + actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]);
1.11 + }
1.12 + else
1.13 + {
1.14 + actual_map=(mapstorage.nodemap_storage)[mapname];
1.15 + }
1.16 +
1.17 if(node==INVALID)
1.18 {
1.19 for (NodeIt i(g); i!=INVALID; ++i)
1.20 {
1.21 - int w=(int)(*(mapstorage.nodemap_storage)[mapname])[i];
1.22 + int w=(int)(*actual_map)[i];
1.23 if(w>=0)
1.24 {
1.25 double x1, y1, x2, y2;
1.26 - nodesmap[i]->get_bounds(x1, y1, x2, y2);
1.27 + x1=nodesmap[i]->property_x1().get_value();
1.28 + x2=nodesmap[i]->property_x2().get_value();
1.29 + y1=nodesmap[i]->property_y1().get_value();
1.30 + y2=nodesmap[i]->property_y2().get_value();
1.31 nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
1.32 nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
1.33 nodesmap[i]->property_y1().set_value((y1+y2)/2-w);
1.34 @@ -23,11 +36,16 @@
1.35 }
1.36 else
1.37 {
1.38 - int w=(int)(*(mapstorage.nodemap_storage)[mapname])[node];
1.39 + //I think only new nodes use this case
1.40 +// int w=(int)(*actual_map)[node];
1.41 + int w=(int)(node_property_defaults[N_RADIUS]);
1.42 if(w>=0)
1.43 {
1.44 double x1, y1, x2, y2;
1.45 - nodesmap[node]->get_bounds(x1, y1, x2, y2);
1.46 + x1=nodesmap[node]->property_x1().get_value();
1.47 + x2=nodesmap[node]->property_x2().get_value();
1.48 + y1=nodesmap[node]->property_y1().get_value();
1.49 + y2=nodesmap[node]->property_y2().get_value();
1.50 nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
1.51 nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
1.52 nodesmap[node]->property_y1().set_value((y1+y2)/2-w);
1.53 @@ -44,17 +62,39 @@
1.54 //the minimum of the nodemap to the range of
1.55 //green in RGB
1.56
1.57 + Graph::NodeMap<double> * actual_map;
1.58 + if(mapname=="Default")
1.59 + {
1.60 + actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
1.61 + }
1.62 + else
1.63 + {
1.64 + actual_map=(mapstorage.nodemap_storage)[mapname];
1.65 + }
1.66 +
1.67 + double max, min;
1.68 +
1.69 + if(mapname!="Default")
1.70 + {
1.71 + max=mapstorage.maxOfNodeMap(mapname);
1.72 + min=mapstorage.minOfNodeMap(mapname);
1.73 + }
1.74 + else
1.75 + {
1.76 + max=node_property_defaults[N_COLOR];
1.77 + min=node_property_defaults[N_COLOR];
1.78 + }
1.79 +
1.80 +
1.81 if(node==INVALID)
1.82 {
1.83
1.84 for (NodeIt i(g); i!=INVALID; ++i)
1.85 {
1.86 - double w=(*(mapstorage.nodemap_storage)[mapname])[i];
1.87 - double max=mapstorage.maxOfNodeMap(mapname);
1.88 - double min=mapstorage.minOfNodeMap(mapname);
1.89 -
1.90 - //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
1.91 Gdk::Color color;
1.92 +
1.93 + double w=(*actual_map)[i];
1.94 +
1.95 if(max!=min)
1.96 {
1.97 color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
1.98 @@ -69,12 +109,10 @@
1.99 }
1.100 else
1.101 {
1.102 - double w=(*(mapstorage.nodemap_storage)[mapname])[node];
1.103 - double max=mapstorage.maxOfNodeMap(mapname);
1.104 - double min=mapstorage.minOfNodeMap(mapname);
1.105 -
1.106 - //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
1.107 Gdk::Color color;
1.108 +
1.109 + double w=(*actual_map)[node];
1.110 +
1.111 if(max!=min)
1.112 {
1.113 color.set_rgb_p (0, 0, 100*(w-min)/(max-min));
1.114 @@ -96,15 +134,24 @@
1.115 //EXCEPT when the name of the map is Text, because
1.116 //in that case empty string will be written, because
1.117 //that is the deleter map
1.118 - //\todo isn't it a bit woodcutter?
1.119 +
1.120 + Graph::NodeMap<double> * actual_map;
1.121 + if(mapname=="Default")
1.122 + {
1.123 + actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
1.124 + }
1.125 + else
1.126 + {
1.127 + actual_map=(mapstorage.nodemap_storage)[mapname];
1.128 + }
1.129
1.130 if(node==INVALID)
1.131 {
1.132 for (NodeIt i(g); i!=INVALID; ++i)
1.133 {
1.134 - if(mapname!=node_property_strings[N_TEXT])
1.135 + if(mapname!="Default")
1.136 {
1.137 - double number=(*(mapstorage.nodemap_storage)[mapname])[i];
1.138 + double number=(*actual_map)[i];
1.139 int length=1;
1.140 //if number is smaller than one, length would be negative, or invalid
1.141 if(number>=1)
1.142 @@ -138,9 +185,9 @@
1.143 }
1.144 else
1.145 {
1.146 - if(mapname!=node_property_strings[N_TEXT])
1.147 + if(mapname!="Default")
1.148 {
1.149 - double number=(*(mapstorage.nodemap_storage)[mapname])[node];
1.150 + double number=(*actual_map)[node];
1.151 int length=1;
1.152 //if number is smaller than one, length would be negative, or invalid
1.153 if(number>=1)