diff -r 7ea73c90a7f0 -r 14a76109b561 graph_displayer_canvas.cc --- a/graph_displayer_canvas.cc Mon Oct 09 08:06:31 2006 +0000 +++ b/graph_displayer_canvas.cc Thu Oct 12 11:39:29 2006 +0000 @@ -5,7 +5,8 @@ nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph), nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0), isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), - edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), mytab(mainw) + edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), + iterations(20), attraction(0.05), propulsation(40000), mytab(mainw) { //base event handler is move tool actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false); @@ -251,3 +252,117 @@ width_p=edge_width; radius_p=radius_size; } + +void GraphDisplayerCanvas::reDesignGraph() +{ + double min_dist=40; + + //iteration counter + for(int l=0;l x(mytab.mapstorage.graph); + Graph::NodeMap y(mytab.mapstorage.graph); + XYMap > actual_forces; + actual_forces.setXMap(x); + actual_forces.setYMap(y); + + lemon::dim2::Point delta; + + //count actual force for each nodes + for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) + { + //propulsation of nodes + for (NodeIt j((mytab.mapstorage).graph); j!=INVALID; ++j) + { + if(i!=j) + { + delta=((mytab.mapstorage).coords[i]-(mytab.mapstorage).coords[j]); + + double length_sqr=delta.normSquare(); + double length=sqrt(length_sqr); + if(length_sqr