graph_displayer_canvas-node.cc
branchgui
changeset 54 9128e364fb19
parent 48 b8ec84524fa2
child 55 e4ee805ca5fc
equal deleted inserted replaced
5:8762288e03b9 6:101727106024
     1 #include <graph_displayer_canvas.h>
     1 #include "graph_displayer_canvas.h"
     2 #include <broken_edge.h>
     2 #include "broken_edge.h"
     3 #include <math.h>
     3 #include <math.h>
     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 {
     9   double min, max;
     9   double min, max;
    10   if(mapname=="Default")
    10   if(mapname=="Default")
    11     {
    11     {
    12       min=node_property_defaults[N_RADIUS];
    12       min=node_property_defaults[N_RADIUS];
    13       max=node_property_defaults[N_RADIUS];
    13       max=node_property_defaults[N_RADIUS];
    14       actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]);
    14       actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]);
    15     }
    15     }
    16   else
    16   else
    17     {
    17     {
    18       min=mapstorage.minOfNodeMap(mapname);
    18       min=mapstorage.minOfNodeMap(mapname);
    19       max=mapstorage.maxOfNodeMap(mapname);
    19       max=mapstorage.maxOfNodeMap(mapname);
    20       actual_map=(mapstorage.nodemap_storage)[mapname];
    20       actual_map=(mapstorage.nodemap_storage)[mapname];
    21     }
    21     }
    22 
    22 
    23   if(node==INVALID)
    23   if(node==INVALID)
    24     {
    24     {
    25       for (NodeIt i(g); i!=INVALID; ++i)
    25       for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
    26 	{
    26 	{
    27 	  double v=abs((*actual_map)[i]);
    27 	  double v=abs((*actual_map)[i]);
    28 	  int w;
    28 	  int w;
    29 	  if(min==max)
    29 	  if(min==max)
    30 	    {
    30 	    {
    77   //green in RGB
    77   //green in RGB
    78 
    78 
    79   Graph::NodeMap<double> * actual_map;
    79   Graph::NodeMap<double> * actual_map;
    80   if(mapname=="Default")
    80   if(mapname=="Default")
    81     {
    81     {
    82       actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
    82       actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]);
    83     }
    83     }
    84   else
    84   else
    85     {
    85     {
    86       actual_map=(mapstorage.nodemap_storage)[mapname];
    86       actual_map=(mapstorage.nodemap_storage)[mapname];
    87     }
    87     }
   101 
   101 
   102 
   102 
   103   if(node==INVALID)
   103   if(node==INVALID)
   104     {
   104     {
   105 
   105 
   106       for (NodeIt i(g); i!=INVALID; ++i)
   106       for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   107 	{
   107 	{
   108 	  Gdk::Color color;
   108 	  Gdk::Color color;
   109 
   109 
   110 	  double w=(*actual_map)[i];
   110 	  double w=(*actual_map)[i];
   111 
   111 
   155       actual_map=(mapstorage.nodemap_storage)[mapname];
   155       actual_map=(mapstorage.nodemap_storage)[mapname];
   156     }
   156     }
   157 
   157 
   158   if(node==INVALID)
   158   if(node==INVALID)
   159     {
   159     {
   160       for (NodeIt i(g); i!=INVALID; ++i)
   160       for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
   161 	{
   161 	{
   162 	  if(mapname!="Default")
   162 	  if(mapname!="Default")
   163 	    {
   163 	    {
   164 	      nodemap_to_edit=mapname;
   164 	      nodemap_to_edit=mapname;
   165 	      double number=(*actual_map)[i];
   165 	      double number=(*actual_map)[i];