Changeset 201:879e47e5b731 in glemon-0.x for graph_displayer_canvas-node.cc
- Timestamp:
- 01/02/08 22:03:09 (16 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3431
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas-node.cc
r194 r201 26 26 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node) 27 27 { 28 Graph::NodeMap<double> * actual_map; 28 MapStorage& ms = *mytab.mapstorage; 29 29 30 double min, max; 30 min=(mytab.mapstorage)->minOfNodeMap(mapname); 31 max=(mytab.mapstorage)->maxOfNodeMap(mapname); 32 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; 33 34 if(node==INVALID) 35 { 36 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 37 { 38 double v=fabs((*actual_map)[i]); 31 32 { 33 NodeIt n(ms.graph); 34 min = max = ms.get(mapname, n); 35 for (; n != INVALID; ++n) 36 { 37 if (static_cast<double>(ms.get(mapname, n)) > max) 38 max = ms.get(mapname, n); 39 if (static_cast<double>(ms.get(mapname, n)) < min) 40 min = ms.get(mapname, n); 41 } 42 } 43 44 if(node==INVALID) 45 { 46 for (NodeIt i(ms.graph); i!=INVALID; ++i) 47 { 48 double v=fabs(ms.get(mapname,i)); 39 49 int w; 40 50 if(autoscale) … … 103 113 int GraphDisplayerCanvas::resetNodeRadius (Node node) 104 114 { 115 MapStorage& ms = *mytab.mapstorage; 116 105 117 double min, max; 106 118 min=node_property_defaults[N_RADIUS]; 107 119 max=node_property_defaults[N_RADIUS]; 108 Graph::NodeMap<double> actual_map( (mytab.mapstorage)->graph,node_property_defaults[N_RADIUS]);120 Graph::NodeMap<double> actual_map(ms.graph,node_property_defaults[N_RADIUS]); 109 121 110 122 if(node==INVALID) 111 123 { 112 for (NodeIt i( (mytab.mapstorage)->graph); i!=INVALID; ++i)124 for (NodeIt i(ms.graph); i!=INVALID; ++i) 113 125 { 114 126 double v=fabs(actual_map[i]); … … 164 176 int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node) 165 177 { 178 MapStorage& ms = *mytab.mapstorage; 166 179 167 180 //function maps the range of the maximum and … … 169 182 //green in RGB 170 183 171 Graph::NodeMap<double> * actual_map;172 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname];173 174 184 double max, min; 175 185 176 max=(mytab.mapstorage)->maxOfNodeMap(mapname); 177 min=(mytab.mapstorage)->minOfNodeMap(mapname); 178 179 if(node==INVALID) 180 { 181 182 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 186 { 187 NodeIt n(ms.graph); 188 min = max = ms.get(mapname, n); 189 for (; n != INVALID; ++n) 190 { 191 if (static_cast<double>(ms.get(mapname, n)) > max) 192 max = ms.get(mapname, n); 193 if (static_cast<double>(ms.get(mapname, n)) < min) 194 min = ms.get(mapname, n); 195 } 196 } 197 198 if(node==INVALID) 199 { 200 201 for (NodeIt i(ms.graph); i!=INVALID; ++i) 183 202 { 184 203 Gdk::Color color; 185 204 186 double w= (*actual_map)[i];205 double w=ms.get(mapname, i); 187 206 188 207 if(max!=min) … … 202 221 Gdk::Color color; 203 222 204 double w= (*actual_map)[node];223 double w=ms.get(mapname, node); 205 224 206 225 if(max!=min) … … 220 239 int GraphDisplayerCanvas::resetNodeColor (Node node) 221 240 { 241 MapStorage& ms = *mytab.mapstorage; 222 242 223 243 //function maps the range of the maximum and … … 225 245 //green in RGB 226 246 227 Graph::NodeMap<double> actual_map( (mytab.mapstorage)->graph,node_property_defaults[N_COLOR]);247 Graph::NodeMap<double> actual_map(ms.graph,node_property_defaults[N_COLOR]); 228 248 229 249 double max, min; … … 235 255 { 236 256 237 for (NodeIt i( (mytab.mapstorage)->graph); i!=INVALID; ++i)257 for (NodeIt i(ms.graph); i!=INVALID; ++i) 238 258 { 239 259 Gdk::Color color; … … 275 295 int GraphDisplayerCanvas::changeNodeText (std::string mapname, Node node) 276 296 { 297 MapStorage& ms = *mytab.mapstorage; 277 298 278 299 //the number in the map will be written on the node … … 281 302 //that is the deleter map 282 303 283 Graph::NodeMap<double> * actual_map=NULL; 284 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; 285 286 if(node==INVALID) 287 { 288 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 304 if(node==INVALID) 305 { 306 for (NodeIt i(ms.graph); i!=INVALID; ++i) 289 307 { 290 308 nodemap_to_edit=mapname; 291 double number=(*actual_map)[i]; 292 293 std::ostringstream ostr; 294 ostr << number; 295 296 nodetextmap[i]->property_text().set_value(ostr.str()); 297 } 298 } 299 else 300 { 301 double number=(*actual_map)[node]; 302 303 std::ostringstream ostr; 304 ostr << number; 305 306 nodetextmap[node]->property_text().set_value(ostr.str()); 309 310 nodetextmap[i]->property_text().set_value( 311 static_cast<std::string>(ms.get(mapname, i))); 312 } 313 } 314 else 315 { 316 nodetextmap[node]->property_text().set_value( 317 static_cast<std::string>(ms.get(mapname, node))); 307 318 } 308 319 return 0; … … 311 322 int GraphDisplayerCanvas::resetNodeText (Node node) 312 323 { 324 MapStorage& ms = *mytab.mapstorage; 313 325 314 326 //the number in the map will be written on the node … … 319 331 if(node==INVALID) 320 332 { 321 for (NodeIt i( (mytab.mapstorage)->graph); i!=INVALID; ++i)333 for (NodeIt i(ms.graph); i!=INVALID; ++i) 322 334 { 323 335 nodemap_to_edit="";
Note: See TracChangeset
for help on using the changeset viewer.