COIN-OR::LEMON - Graph Library

Changeset 25:c45a34eaa118 in glemon-0.x for graph_displayer_canvas.cc


Ignore:
Timestamp:
06/17/05 19:08:45 (19 years ago)
Author:
Hegyi Péter
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@1986
Message:

Previous commit was also mine, but I forgot to say, that it was my younger brother's birthyear. From this commit texts of activated maps move together with red arrows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graph_displayer_canvas.cc

    r21 r25  
    3131    //initializing edge-text as well, to empty string
    3232
    33     double x1, x2, y1, y2;
    34     edgesmap[i]->get_bounds(x1, y1, x2, y2);
    35    
    36     edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph,(x1+x2)/2, (y1+y2)/2, "");
     33    xy<double> text_pos=edgesmap[i]->get_arrow_pos();
     34    text_pos+=(xy<double>(10,10));
     35
     36    edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    3737    edgetextmap[i]->property_fill_color().set_value("black");
    3838  }
     
    174174};
    175175
     176//Deprecated
    176177bool GraphDisplayerCanvas::event_handler(GdkEvent* e, Node n)
    177178{
     
    425426              }
    426427
    427             edgesmap[ei]->get_bounds(x1, y1, x2, y2);
    428 
    429             edgetextmap[ei]->property_x().set_value((x1+x2)/2);
    430             edgetextmap[ei]->property_y().set_value((y1+y2)/2);
     428            xy<double> text_pos=edgesmap[ei]->get_arrow_pos();
     429            text_pos+=(xy<double>(10,10));
     430            edgetextmap[ei]->property_x().set_value(text_pos.x);
     431            edgetextmap[ei]->property_y().set_value(text_pos.y);
    431432        }
    432433
     
    452453              }
    453454
    454             edgesmap[ei]->get_bounds(x1, y1, x2, y2);
    455 
    456             edgetextmap[ei]->property_x().set_value((x1+x2)/2);
    457             edgetextmap[ei]->property_y().set_value((y1+y2)/2);
     455            xy<double> text_pos=edgesmap[ei]->get_arrow_pos();
     456            text_pos+=(xy<double>(10,10));
     457            edgetextmap[ei]->property_x().set_value(text_pos.x);
     458            edgetextmap[ei]->property_y().set_value(text_pos.y);
    458459        }
    459460      }
     
    590591
    591592                  //initializing edge-text as well, to empty string
    592                   edgesmap[active_edge]->get_bounds(x1, y1, x2, y2);
    593                   edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph,(x1+x2)/2, (y1+y2)/2, "");
     593                  xy<double> text_pos=edgesmap[active_edge]->get_arrow_pos();
     594                  text_pos+=(xy<double>(10,10));
     595
     596                  edgetextmap[active_edge]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    594597                  edgetextmap[active_edge]->property_fill_color().set_value("black");
    595598                }
     
    739742}
    740743
     744void GraphDisplayerCanvas::text_reposition(xy<double> new_place)
     745{
     746  new_place+=(xy<double>(10,10));
     747  edgetextmap[active_edge]->property_x().set_value(new_place.x);
     748  edgetextmap[active_edge]->property_y().set_value(new_place.y);
     749}
     750
     751void GraphDisplayerCanvas::toggle_edge_activity(BrokenEdge* active_bre, bool on)
     752{
     753  if(on)
     754    {
     755      if(active_edge!=INVALID)
     756        {
     757          std::cout << "ERROR!!!! Valid edge found!" << std::endl;
     758        }
     759      else
     760        {
     761          for (EdgeIt i(g); i!=INVALID; ++i)
     762            {
     763              if(edgesmap[i]==active_bre)
     764                {
     765                  active_edge=i;
     766                }
     767            }
     768        }
     769    }
     770  else
     771    {
     772      if(active_edge!=INVALID)
     773        {
     774          active_edge=INVALID;
     775        }
     776      else
     777        {
     778          std::cout << "ERROR!!!! Invalid edge found!" << std::endl;
     779        }
     780    }
     781
     782}
Note: See TracChangeset for help on using the changeset viewer.