1.1 --- a/gui/graph_displayer_canvas.cc Wed Jun 15 11:01:55 2005 +0000
1.2 +++ b/gui/graph_displayer_canvas.cc Wed Jun 15 11:15:01 2005 +0000
1.3 @@ -622,28 +622,31 @@
1.4 {
1.5 if(active_node!=INVALID)
1.6 {
1.7 -// EdgeIt e;
1.8 -// g.firstOut(e,active_node);
1.9 -// for(;e!=INVALID;g.nextOut(e))
1.10 -// {
1.11 -// if(e!=INVALID)delete_item(e);
1.12 -// }
1.13
1.14 -// g.firstIn(e,active_node);
1.15 -// for(;e!=INVALID;g.nextIn(e))
1.16 -// {
1.17 -// if(e!=INVALID)delete_item(e);
1.18 -// }
1.19 - for (EdgeIt i(g); i!=INVALID; ++i)
1.20 + //collecting edges to delete
1.21 + EdgeIt e;
1.22 + std::set<Graph::Edge> edges_to_delete;
1.23 +
1.24 + g.firstOut(e,active_node);
1.25 + for(;e!=INVALID;g.nextOut(e))
1.26 {
1.27 - //std::cout << g.source(i).id << "-" << g.target(i).id << " " << active_node.id << std::endl;
1.28 - if((g.source(i)==active_node)||(g.target(i)==active_node))
1.29 - {
1.30 - delete_item(i);
1.31 - }
1.32 + edges_to_delete.insert(e);
1.33 + }
1.34 +
1.35 + g.firstIn(e,active_node);
1.36 + for(;e!=INVALID;g.nextIn(e))
1.37 + {
1.38 + edges_to_delete.insert(e);
1.39 + }
1.40 +
1.41 + //deleting collected edges
1.42 + for(std::set<Graph::Edge>::iterator edge_set_it=edges_to_delete.begin();edge_set_it!=edges_to_delete.end();edge_set_it++)
1.43 + {
1.44 + delete_item(*edge_set_it);
1.45 }
1.46 delete_item(active_node);
1.47 }
1.48 + //a simple edge was chosen
1.49 else
1.50 {
1.51 delete_item(active_edge);
1.52 @@ -651,6 +654,7 @@
1.53
1.54
1.55 }
1.56 + //pointer was moved, deletion is cancelled
1.57 else
1.58 {
1.59 if(active_node!=INVALID)
1.60 @@ -662,6 +666,7 @@
1.61 *active_item << Gnome::Canvas::Properties::fill_color("green");
1.62 }
1.63 }
1.64 + //reseting datas
1.65 active_item=NULL;
1.66 active_edge=INVALID;
1.67 active_node=INVALID;
1.68 @@ -688,3 +693,9 @@
1.69 g.erase(edge_to_delete);
1.70 }
1.71
1.72 +void GraphDisplayerCanvas::delete_item(Graph::Edge edge_to_delete)
1.73 +{
1.74 + delete(edgesmap[edge_to_delete]);
1.75 + g.erase(edge_to_delete);
1.76 +}
1.77 +