[Lemon-commits] [lemon_svn] ladanyi: r2957 - glemon/trunk

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 21:51:28 CET 2006


Author: ladanyi
Date: Mon Sep 25 14:08:35 2006
New Revision: 2957

Modified:
   glemon/trunk/graph_displayer_canvas-event.cc

Log:
Bugfixes.

Modified: glemon/trunk/graph_displayer_canvas-event.cc
==============================================================================
--- glemon/trunk/graph_displayer_canvas-event.cc	(original)
+++ glemon/trunk/graph_displayer_canvas-event.cc	Mon Sep 25 14:08:35 2006
@@ -169,46 +169,57 @@
 	//all the edges connected to the moved point has to be redrawn
         for(OutEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
+          XY arrow_pos;
+
+          if (mytab.mapstorage.graph.source(ei) == mytab.mapstorage.graph.target(ei))
+          {
+            arrow_pos = mytab.mapstorage.arrow_pos[ei] + XY(dx, dy);
+          }
+          else
+          {
             XY moved_node_1(coord_x - dx, coord_y - dy);
             XY moved_node_2(coord_x, coord_y);
             Node target = mytab.mapstorage.graph.target(ei);
             XY fix_node(mytab.mapstorage.coords[target].x,
-                        mytab.mapstorage.coords[target].y);
+                mytab.mapstorage.coords[target].y);
             XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
 
-            XY arrow_pos;
-	    arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
+            arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
+          }
 
-            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
-            edgesmap[ei]->draw();
+          mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
+          edgesmap[ei]->draw();
 
-	    //reposition of edgetext
-	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
-	    text_pos+=(XY(10,10));
-	    edgetextmap[ei]->property_x().set_value(text_pos.x);
-	    edgetextmap[ei]->property_y().set_value(text_pos.y);
+          //reposition of edgetext
+          XY text_pos=mytab.mapstorage.arrow_pos[ei];
+          text_pos+=(XY(10,10));
+          edgetextmap[ei]->property_x().set_value(text_pos.x);
+          edgetextmap[ei]->property_y().set_value(text_pos.y);
         }
 
         for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
         {
+          if (mytab.mapstorage.graph.source(ei) != mytab.mapstorage.graph.target(ei))
+          {
             XY moved_node_1(coord_x - dx, coord_y - dy);
             XY moved_node_2(coord_x, coord_y);
             Node source = mytab.mapstorage.graph.source(ei);
             XY fix_node(mytab.mapstorage.coords[source].x,
-                        mytab.mapstorage.coords[source].y);
+                mytab.mapstorage.coords[source].y);
             XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
 
             XY arrow_pos;
-	    arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
+            arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
 
             mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
             edgesmap[ei]->draw();
 
-	    //reposition of edgetext
-	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
-	    text_pos+=(XY(10,10));
-	    edgetextmap[ei]->property_x().set_value(text_pos.x);
-	    edgetextmap[ei]->property_y().set_value(text_pos.y);
+            //reposition of edgetext
+            XY text_pos=mytab.mapstorage.arrow_pos[ei];
+            text_pos+=(XY(10,10));
+            edgetextmap[ei]->property_x().set_value(text_pos.x);
+            edgetextmap[ei]->property_y().set_value(text_pos.y);
+          }
         }
       }
     default: break;
@@ -526,7 +537,7 @@
 	{
 	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
 	    {
-	      if(edgesmap[i]==active_item)
+	      if(edgesmap[i]->getLine()==active_item)
 		{
 		  active_edge=i;
 		}



More information about the Lemon-commits mailing list