[Lemon-commits] [lemon_svn] hegyi: r2992 - glemon/trunk
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 21:51:42 CET 2006
Author: hegyi
Date: Mon Oct 16 15:05:25 2006
New Revision: 2992
Modified:
glemon/trunk/graph_displayer_canvas.cc
glemon/trunk/graph_displayer_canvas.h
Log:
Graph redesign starts with an initial kick of the first node.
Modified: glemon/trunk/graph_displayer_canvas.cc
==============================================================================
--- glemon/trunk/graph_displayer_canvas.cc (original)
+++ glemon/trunk/graph_displayer_canvas.cc Mon Oct 16 15:05:25 2006
@@ -6,7 +6,7 @@
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),
- iterations(20), attraction(0.05), propulsation(40000), mytab(mainw)
+ iterations(20), attraction(0.05), propulsation(40000), was_redesigned(false), mytab(mainw)
{
//base event handler is move tool
actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
@@ -255,7 +255,18 @@
void GraphDisplayerCanvas::reDesignGraph()
{
- double min_dist=40;
+ double min_dist=20;
+ double init_vector_length=25;
+
+ if(!was_redesigned)
+ {
+ NodeIt i((mytab.mapstorage).graph);
+ double r=random();
+ dim2::Point<double> init(init_vector_length*sin(r),init_vector_length*cos(r));
+ moveNode(init.x, init.y, nodesmap[i], i);
+ was_redesigned=true;
+ }
+
//iteration counter
for(int l=0;l<iterations;l++)
Modified: glemon/trunk/graph_displayer_canvas.h
==============================================================================
--- glemon/trunk/graph_displayer_canvas.h (original)
+++ glemon/trunk/graph_displayer_canvas.h Mon Oct 16 15:05:25 2006
@@ -417,6 +417,13 @@
///Propulsation factor during graph design
double propulsation;
+
+ ///Was redesign run on this graph already?
+ ///
+ ///If not, the layout will be modified randomly
+ ///to avoid frozen layout because of wrong
+ ///initial state
+ bool was_redesigned;
private:
More information about the Lemon-commits
mailing list