Changeset 1505:7121597da9ba in lemon-0.x for gui/graph_displayer_canvas.cc
- Timestamp:
- 06/17/05 19:08:45 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1986
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/graph_displayer_canvas.cc
r1501 r1505 31 31 //initializing edge-text as well, to empty string 32 32 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, ""); 37 37 edgetextmap[i]->property_fill_color().set_value("black"); 38 38 } … … 174 174 }; 175 175 176 //Deprecated 176 177 bool GraphDisplayerCanvas::event_handler(GdkEvent* e, Node n) 177 178 { … … 425 426 } 426 427 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); 431 432 } 432 433 … … 452 453 } 453 454 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); 458 459 } 459 460 } … … 590 591 591 592 //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, ""); 594 597 edgetextmap[active_edge]->property_fill_color().set_value("black"); 595 598 } … … 739 742 } 740 743 744 void 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 751 void 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.