COIN-OR::LEMON - Graph Library

Changeset 31:66e85f44a66f in glemon-0.x for graph_displayer_canvas-node.cc


Ignore:
Timestamp:
06/29/05 21:44:30 (19 years ago)
Author:
Hegyi Péter
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2011
Message:

Uh, long comment arrives... Zoom update does not happen after editorial steps. Nodes initial color is light blue, if there is any item under them. Strange node-text relations disappeared. Initial values of new items are given now in a more common way. The wood-cutter way of handling default values of properties is now changed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graph_displayer_canvas-node.cc

    r28 r31  
    66int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
    77{
     8  Graph::NodeMap<double> * actual_map;
     9  if(mapname=="Default")
     10    {
     11      actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]);
     12    }
     13  else
     14    {
     15      actual_map=(mapstorage.nodemap_storage)[mapname];
     16    }
     17
    818  if(node==INVALID)
    919    {
    1020      for (NodeIt i(g); i!=INVALID; ++i)
    1121        {
    12           int w=(int)(*(mapstorage.nodemap_storage)[mapname])[i];
     22          int w=(int)(*actual_map)[i];
    1323          if(w>=0)
    1424            {
    1525              double x1, y1, x2, y2;
    16               nodesmap[i]->get_bounds(x1, y1, x2, y2);
     26              x1=nodesmap[i]->property_x1().get_value();
     27              x2=nodesmap[i]->property_x2().get_value();
     28              y1=nodesmap[i]->property_y1().get_value();
     29              y2=nodesmap[i]->property_y2().get_value();
    1730              nodesmap[i]->property_x1().set_value((x1+x2)/2-w);
    1831              nodesmap[i]->property_x2().set_value((x1+x2)/2+w);
     
    2437  else
    2538    {
    26       int w=(int)(*(mapstorage.nodemap_storage)[mapname])[node];
     39      //I think only new nodes use this case
     40//       int w=(int)(*actual_map)[node];
     41      int w=(int)(node_property_defaults[N_RADIUS]);
    2742      if(w>=0)
    2843        {
    2944          double x1, y1, x2, y2;
    30           nodesmap[node]->get_bounds(x1, y1, x2, y2);
     45          x1=nodesmap[node]->property_x1().get_value();
     46          x2=nodesmap[node]->property_x2().get_value();
     47          y1=nodesmap[node]->property_y1().get_value();
     48          y2=nodesmap[node]->property_y2().get_value();
    3149          nodesmap[node]->property_x1().set_value((x1+x2)/2-w);
    3250          nodesmap[node]->property_x2().set_value((x1+x2)/2+w);
     
    4563  //green in RGB
    4664
     65  Graph::NodeMap<double> * actual_map;
     66  if(mapname=="Default")
     67    {
     68      actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
     69    }
     70  else
     71    {
     72      actual_map=(mapstorage.nodemap_storage)[mapname];
     73    }
     74
     75  double max, min;
     76
     77  if(mapname!="Default")
     78    {
     79      max=mapstorage.maxOfNodeMap(mapname);
     80      min=mapstorage.minOfNodeMap(mapname);
     81    }
     82  else
     83    {
     84      max=node_property_defaults[N_COLOR];
     85      min=node_property_defaults[N_COLOR];
     86    }
     87
     88
    4789  if(node==INVALID)
    4890    {
     
    5092      for (NodeIt i(g); i!=INVALID; ++i)
    5193        {
    52           double w=(*(mapstorage.nodemap_storage)[mapname])[i];
    53           double max=mapstorage.maxOfNodeMap(mapname);
    54           double min=mapstorage.minOfNodeMap(mapname);
    55      
    56           //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    5794          Gdk::Color color;
     95
     96          double w=(*actual_map)[i];
     97
    5898          if(max!=min)
    5999            {
     
    70110  else
    71111    {
    72       double w=(*(mapstorage.nodemap_storage)[mapname])[node];
    73       double max=mapstorage.maxOfNodeMap(mapname);
    74       double min=mapstorage.minOfNodeMap(mapname);
    75      
    76       //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    77112      Gdk::Color color;
     113
     114      double w=(*actual_map)[node];
     115
    78116      if(max!=min)
    79117        {
     
    97135  //in that case empty string will be written, because
    98136  //that is the deleter map
    99   //\todo isn't it a bit woodcutter?
     137
     138  Graph::NodeMap<double> * actual_map;
     139  if(mapname=="Default")
     140    {
     141      actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_COLOR]);
     142    }
     143  else
     144    {
     145      actual_map=(mapstorage.nodemap_storage)[mapname];
     146    }
    100147
    101148  if(node==INVALID)
     
    103150      for (NodeIt i(g); i!=INVALID; ++i)
    104151        {
    105           if(mapname!=node_property_strings[N_TEXT])
    106             {
    107               double number=(*(mapstorage.nodemap_storage)[mapname])[i];
     152          if(mapname!="Default")
     153            {
     154              double number=(*actual_map)[i];
    108155              int length=1;
    109156              //if number is smaller than one, length would be negative, or invalid
     
    139186  else
    140187    {
    141       if(mapname!=node_property_strings[N_TEXT])
    142         {
    143           double number=(*(mapstorage.nodemap_storage)[mapname])[node];
     188      if(mapname!="Default")
     189        {
     190          double number=(*actual_map)[node];
    144191          int length=1;
    145192          //if number is smaller than one, length would be negative, or invalid
Note: See TracChangeset for help on using the changeset viewer.