COIN-OR::LEMON - Graph Library

Changeset 1525:6d94de269ab1 in lemon-0.x


Ignore:
Timestamp:
06/29/05 21:44:30 (19 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@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.

Location:
gui
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • gui/graph_displayer_canvas-edge.cc

    r1512 r1525  
    66int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
    77{
     8  Graph::EdgeMap<double> * actual_map;
     9  if(mapname=="Default")
     10    {
     11      actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
     12    }
     13  else
     14    {
     15      actual_map=(mapstorage.edgemap_storage)[mapname];
     16    }
     17
    818  if(edge==INVALID)
    919    {
    1020      for (EdgeIt i(g); i!=INVALID; ++i)
    1121        {
    12           int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i];
     22          int w=(int)(*actual_map)[i];
    1323          if(w>=0)
    1424            {
     
    1929  else
    2030    {
    21       int w=(int)(*(mapstorage.edgemap_storage)[mapname])[edge];
     31      int w=(int)(*actual_map)[edge];
    2232      if(w>=0)
    2333        {
     
    3444  //the minimum of the nodemap to the range of
    3545  //green in RGB
     46  Graph::EdgeMap<double> * actual_map;
     47  if(mapname=="Default")
     48    {
     49      actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_COLOR]);
     50    }
     51  else
     52    {
     53      actual_map=(mapstorage.edgemap_storage)[mapname];
     54    }
     55
     56  double max, min;
     57
     58  if(mapname!="Default")
     59    {
     60      max=mapstorage.maxOfEdgeMap(mapname);
     61      min=mapstorage.minOfEdgeMap(mapname);
     62    }
     63  else
     64    {
     65      max=edge_property_defaults[E_COLOR];
     66      min=edge_property_defaults[E_COLOR];
     67    }
     68
    3669  if(edge==INVALID)
    3770    {
    38 
    3971      for (EdgeIt i(g); i!=INVALID; ++i)
    4072        {
    41           double w=(*(mapstorage.edgemap_storage)[mapname])[i];
    42           double max=mapstorage.maxOfEdgeMap(mapname);
    43           double min=mapstorage.minOfEdgeMap(mapname);
    44      
    45           //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
     73          double w=(*actual_map)[i];
     74
    4675          Gdk::Color color;
    4776          if(max!=min)
     
    5382              color.set_rgb_p (0, 100, 0);
    5483            }
    55 
    5684          edgesmap[i]->property_fill_color_gdk().set_value(color);
    5785        }
     
    5987  else
    6088    {
    61       double w=(*(mapstorage.edgemap_storage)[mapname])[edge];
    62       double max=mapstorage.maxOfEdgeMap(mapname);
    63       double min=mapstorage.minOfEdgeMap(mapname);
    64      
    65       //std::cout<<w<<" "<<max<<" "<<min<<" "<<100*(w-min)/(max-min)<<std::endl;
    6689      Gdk::Color color;
     90
     91      double w=(*actual_map)[edge];
     92
    6793      if(max!=min)
    6894        {
     
    86112  //in that case empty string will be written, because
    87113  //that is the deleter map
    88   //\todo isn't it a bit woodcutter?
    89114
    90115  if(edge==INVALID)
     
    92117      for (EdgeIt i(g); i!=INVALID; ++i)
    93118        {
    94           if(mapname!=edge_property_strings[E_TEXT])
     119          if(mapname!="Default")
    95120            {
    96121              double number=(*(mapstorage.edgemap_storage)[mapname])[i];
     
    129154  else
    130155    {
    131       if(mapname!=edge_property_strings[E_TEXT])
     156      if(mapname!="Default")
    132157        {
    133158          double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
  • gui/graph_displayer_canvas-event.cc

    r1524 r1525  
    2929    {
    3030    case MOVE:
    31       actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
    32       break;
    33 
    34       //it has to assigned to canvas, because all the canvas has to be monitored, not only the elements of the already drawn group
     31      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
     32      break;
     33
    3534    case CREATE_NODE:
    3635      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createNodeEventHandler), false);
     
    3837
    3938    case CREATE_EDGE:
    40       actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createEdgeEventHandler), false);
     39      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createEdgeEventHandler), false);
    4140      break;
    4241
    4342    case ERASER:
    44       actual_handler=displayed_graph.signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
     43      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
    4544      break;
    4645
     
    6160    case GDK_BUTTON_PRESS:
    6261      //we mark the location of the event to be able to calculate parameters of dragging
    63       clicked_x=e->button.x;
    64       clicked_y=e->button.y;
    65       active_item=(get_item_at(e->button.x, e->button.y));
     62      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
     63
     64      active_item=(get_item_at(clicked_x, clicked_y));
    6665      active_node=INVALID;
    6766      for (NodeIt i(g); i!=INVALID; ++i)
     
    8685      active_item=NULL;
    8786      active_node=INVALID;
    88       updateScrollRegion();
    8987      break;
    9088    case GDK_MOTION_NOTIFY:
     
    9795        //has to be calculated from here
    9896
    99         double dx=e->motion.x-clicked_x;
    100         double dy=e->motion.y-clicked_y;
     97        double new_x, new_y;
     98
     99        window_to_world (e->motion.x, e->motion.y, new_x, new_y);
     100
     101        double dx=new_x-clicked_x;
     102        double dy=new_y-clicked_y;
    101103
    102104        //repositioning node and its text
     
    104106        nodetextmap[active_node]->move(dx, dy);
    105107
    106         clicked_x=e->motion.x;
    107         clicked_y=e->motion.y;
     108        clicked_x=new_x;
     109        clicked_y=new_y;
    108110
    109111        //all the edges connected to the moved point has to be redrawn
     
    169171  }
    170172
    171   return true;
     173  return false;
    172174}
    173175
     
    178180
    179181      //draw the new node in red at the clicked place
     182    case GDK_2BUTTON_PRESS:
     183      std::cout << "double click" << std::endl;
     184      break;
    180185    case GDK_BUTTON_PRESS:
    181186      isbutton=1;
     
    184189
    185190      //initiating values corresponding to new node in maps
    186      
    187191
    188192      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
     193
     194      target_item=NULL;
     195      target_item=get_item_at(clicked_x, clicked_y);
    189196
    190197      nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
     
    206213        double world_motion_x, world_motion_y;
    207214        GdkEvent * generated=new GdkEvent();
    208         window_to_world (e->motion.x, e->motion.y, world_motion_x, world_motion_y);
    209         generated->motion.x=world_motion_x;
    210         generated->motion.y=world_motion_y;
     215        generated->motion.x=e->motion.x;
     216        generated->motion.y=e->motion.y;
    211217        generated->type=GDK_MOTION_NOTIFY;
    212218        moveEventHandler(generated);     
     
    217223    case GDK_BUTTON_RELEASE:
    218224      isbutton=0;
    219       *active_item << Gnome::Canvas::Properties::fill_color("blue");
     225      if(!target_item)
     226        {
     227          //Its appropriate color is given by update.
     228          //*active_item << Gnome::Canvas::Properties::fill_color("blue");
     229        }
     230      else
     231        {
     232          //In this case the given color has to be overwritten, because the noe covers an other item.
     233          *active_item << Gnome::Canvas::Properties::fill_color("lightblue");
     234        }
     235      target_item=NULL;
    220236      active_item=NULL;
    221237      active_node=INVALID;
    222       updateScrollRegion();
    223238      break;
    224239    default:
     
    240255            {
    241256              //we mark the location of the event to be able to calculate parameters of dragging
    242               clicked_x=e->button.x;
    243               clicked_y=e->button.y;
    244               active_item=(get_item_at(e->button.x, e->button.y));
     257
     258              window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
     259
     260              active_item=(get_item_at(clicked_x, clicked_y));
    245261              active_node=INVALID;
    246262              for (NodeIt i(g); i!=INVALID; ++i)
     
    270286          else
    271287            {
    272               target_item=(get_item_at(e->button.x, e->button.y));
     288              window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
     289              target_item=(get_item_at(clicked_x, clicked_y));
    273290              Graph::NodeIt target_node=INVALID;
    274291              for (NodeIt i(g); i!=INVALID; ++i)
     
    367384    {
    368385    case GDK_BUTTON_PRESS:
    369       active_item=(get_item_at(e->button.x, e->button.y));
     386      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
     387      active_item=(get_item_at(clicked_x, clicked_y));
    370388      active_node=INVALID;
    371389      active_edge=INVALID;
     
    387405            }
    388406        }
    389     *active_item << Gnome::Canvas::Properties::fill_color("red");
     407      if(active_item)
     408        {
     409          *active_item << Gnome::Canvas::Properties::fill_color("red");
     410        }
    390411      break;
    391412
    392413    case GDK_BUTTON_RELEASE:
    393       if(active_item==(get_item_at(e->button.x, e->button.y)))
    394         {
    395           if(active_node!=INVALID)
    396             {
    397 
    398               //collecting edges to delete
    399               EdgeIt e;
    400               std::set<Graph::Edge> edges_to_delete;
    401 
    402               g.firstOut(e,active_node);
    403               for(;e!=INVALID;g.nextOut(e))
    404                 {
     414      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
     415      if(active_item)
     416        {
     417          if( active_item == ( get_item_at (clicked_x, clicked_y) ) )
     418            {
     419              if(active_node!=INVALID)
     420                {
     421
     422                  //collecting edges to delete
     423                  EdgeIt e;
     424                  std::set<Graph::Edge> edges_to_delete;
     425
     426                  g.firstOut(e,active_node);
     427                  for(;e!=INVALID;g.nextOut(e))
     428                    {
    405429                      edges_to_delete.insert(e);
    406                 }
    407 
    408               g.firstIn(e,active_node);
    409               for(;e!=INVALID;g.nextIn(e))
    410                 {
     430                    }
     431
     432                  g.firstIn(e,active_node);
     433                  for(;e!=INVALID;g.nextIn(e))
     434                    {
    411435                      edges_to_delete.insert(e);
    412                 }
    413 
    414               //deleting collected edges
    415               for(std::set<Graph::Edge>::iterator edge_set_it=edges_to_delete.begin();edge_set_it!=edges_to_delete.end();edge_set_it++)
    416                 {
    417                   deleteItem(*edge_set_it);
    418                 }
    419               deleteItem(active_node);
    420             }
    421           //a simple edge was chosen
     436                    }
     437
     438                  //deleting collected edges
     439                  for(std::set<Graph::Edge>::iterator edge_set_it=edges_to_delete.begin();edge_set_it!=edges_to_delete.end();edge_set_it++)
     440                    {
     441                      deleteItem(*edge_set_it);
     442                    }
     443                  deleteItem(active_node);
     444                }
     445              //a simple edge was chosen
     446              else
     447                {
     448                  deleteItem(active_edge);
     449                }
     450            }
     451          //pointer was moved, deletion is cancelled
    422452          else
    423453            {
    424               deleteItem(active_edge);
    425             }
    426 
    427          
    428         }
    429       //pointer was moved, deletion is cancelled
    430       else
    431         {
    432           if(active_node!=INVALID)
    433             {
    434               *active_item << Gnome::Canvas::Properties::fill_color("blue");
    435             }
    436           else
    437             {
    438               *active_item << Gnome::Canvas::Properties::fill_color("green");
     454              if(active_node!=INVALID)
     455                {
     456                  *active_item << Gnome::Canvas::Properties::fill_color("blue");
     457                }
     458              else
     459                {
     460                  *active_item << Gnome::Canvas::Properties::fill_color("green");
     461                }
    439462            }
    440463        }
     
    451474      break;
    452475    }
    453   return true;
     476  return false;
    454477}
    455478
  • gui/graph_displayer_canvas-node.cc

    r1512 r1525  
    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
  • gui/graph_displayer_canvas.cc

    r1524 r1525  
    66{
    77 
    8   actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::createNodeEventHandler), false);
     8  actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
    99  actual_tool=CREATE_NODE;
    1010
  • gui/map_win.cc

    r1524 r1525  
    2424  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    2525  {
    26 
    27     std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
    28     std::set<int> props;
    29 
    30     int actprop;
    31 
    32     //here we find out, which map is the default in MapStorage for this property, which are not
    33     for(int j=0;j<ms.numOfEdgeMaps();j++)
    34     {
    35       //this is the default value for this property
    36       if(emsi->second==&(ms.default_edgemaps[i]))
    37       {
    38         actprop=j;
    39       }
    40       //these are the maps NOT to show for this property
    41       for(int k=0;k<EDGE_PROPERTY_NUM;k++)
    42       {
    43         if(emsi->second==&(ms.default_edgemaps[k]))
    44         {
    45           props.insert(j);
    46         }
    47       }
    48       emsi++;
    49     }
    50 
    5126    //filling in combo box with choices
    5227    std::list<Glib::ustring> listStrings;
     
    5429    listStrings.push_back("Default");
    5530
    56     emsi=ms.beginOfEdgeMaps();
    57 
    58     for(int j=0;j<ms.numOfEdgeMaps();j++)
    59     {
    60       if( ( props.find(j) )==( props.end() ) )
    61       {
     31    std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
     32    for(;emsi!=ms.endOfEdgeMaps();emsi++)
     33    {
    6234        listStrings.push_back(emsi->first);
    63       }
    64       emsi++;
    6535    }
    6636
     
    10373  for(int i=0;i<NODE_PROPERTY_NUM;i++)
    10474  {
    105 
    106     std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
    107     std::set<int> props;
    108 
    109     int actprop;
    110 
    111     //here we find out, which map is the default in MapStorage for this property, which are not
    112     for(int j=0;j<ms.numOfNodeMaps();j++)
    113     {
    114       //these are the maps NOT to show for this property
    115       if(emsi->second==&(ms.default_nodemaps[i]))
    116       {
    117         actprop=j;
    118       }
    119       //this is the other maps to show for this property
    120       for(int k=0;k<NODE_PROPERTY_NUM;k++)
    121       {
    122         if(emsi->second==&(ms.default_nodemaps[k]))
    123         {
    124           props.insert(j);
    125         }
    126       }
    127       emsi++;
    128     }
    129 
    13075    //filling in combo box with choices
    13176    std::list<Glib::ustring> listStrings;
     
    13378    listStrings.push_back("Default");
    13479
    135     emsi=ms.beginOfNodeMaps();
    136 
    137     for(int j=0;j<ms.numOfNodeMaps();j++)
    138     {
    139       if( ( props.find(j) )==( props.end() ) )
    140       {
    141         listStrings.push_back(emsi->first);
    142       }
    143       emsi++;
     80    std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
     81
     82    for(;emsi!=ms.endOfNodeMaps();emsi++)
     83    {
     84      listStrings.push_back(emsi->first);
    14485    }
    14586
     
    189130    if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
    190131    {
    191       if(mapname=="Default")
    192       {
    193         mapname=edge_property_strings[prop];
    194       }
    195 
    196       if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
     132      if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
    197133      {
    198134        switch(prop)
     
    225161    if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
    226162    {
    227       if(mapname=="Default")
    228       {
    229         mapname=node_property_strings[prop];
    230       }
    231 
    232       if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
     163      if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
    233164      {
    234165        switch(prop)
     
    262193          if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
    263194            {
    264               if(mapname=="Default")
    265                 {
    266                   mapname=node_property_strings[i];
    267                 }
    268 
    269               if( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() )
     195              if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )
    270196                {
    271197                  switch(i)
    272198                    {
    273199                    case N_RADIUS:
    274                       //gdc.changeNodeRadius(mapname, node);
    275                       std::cout << "If default map-value problem is solved, uncomment line in MapWin::node_update!" << std::endl;
     200                      gdc.changeNodeRadius(mapname, node);
    276201                      break;
    277202                    case N_COLOR:
     
    302227          if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
    303228            {
    304               if(mapname=="Default")
    305                 {
    306                   mapname=edge_property_strings[i];
    307                 }
    308 
    309               if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
     229
     230              if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )
    310231                {
    311232                  switch(i)
    312233                    {
    313234                    case E_WIDTH:
    314                       //gdc.changeEdgeWidth(mapname, edge);
    315                       std::cout << "If default map-value problem is solved, uncomment line in MapWin::edge_update!" << std::endl;
     235                      gdc.changeEdgeWidth(mapname, edge);
    316236                      break;
    317237                    case E_COLOR:
  • gui/mapstorage.cc

    r1524 r1525  
    33MapStorage::MapStorage(Graph & graph):g(graph)
    44{
    5   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    6   {
    7     Graph::EdgeMap<double> emd(g,edge_property_defaults[i]);
    8     default_edgemaps.push_back(emd);
    9   }
    10 
    11   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    12   {
    13     Graph::NodeMap<double> nmd(g,node_property_defaults[i]);
    14     default_nodemaps.push_back(nmd);
    15   }
    16 
    17   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    18   {
    19       for (EdgeIt j(g); j!=INVALID; ++j)
    20       {
    21         (default_edgemaps[i])[j]=edge_property_defaults[i];
    22       }
    23       addEdgeMap(edge_property_strings[i],&(default_edgemaps[i]));
    24   }
    25 
    26   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    27   {
    28       for (NodeIt j(g); j!=INVALID; ++j)
    29       {
    30         (default_nodemaps[i])[j]=node_property_defaults[i];
    31       }
    32       addNodeMap(node_property_strings[i],&(default_nodemaps[i]));
    33   }
    34 
    355};
    366
     
    10373void MapStorage::initMapsForEdge(Graph::Edge e)
    10474{
    105   e=e;
    106 // beragad, aztan csovez
    107 //   std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
    108 //   for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
    109 //     {
    110 //       std::cout << "szevasz\n";
    111 //       (*((*ems_it).second))[e]=0;
    112 //     }
    113 //   std::cout << std::endl;
    114 
    115 // g_closure_invoke...
    116 //   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    117 //     {
    118 //       (default_edgemaps[i])[e]=property_defaults[i];
    119 //     }
     75  std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
     76  for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
     77    {
     78      (*((*ems_it).second))[e]=5;
     79    }
    12080}
  • gui/mapstorage.h

    r1524 r1525  
    8282  std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
    8383
     84  ///To be able to iterate through each maps this function returns an iterator pointing to the last nodemap in the storage.
     85  std::map< std::string,Graph::NodeMap<double> * >::iterator endOfNodeMaps(){return nodemap_storage.end();};
     86
     87  ///To be able to iterate through each maps this function returns an iterator pointing to the last edgemap in the storage.
     88  std::map< std::string,Graph::EdgeMap<double> * >::iterator endOfEdgeMaps(){return edgemap_storage.end();};
     89
    8490  ///This function sets a default base value for the newly created node
    8591  void initMapsForNode(NodeIt);
Note: See TracChangeset for help on using the changeset viewer.