graph_displayer_canvas-event.cc
changeset 153 d79a71382836
parent 151 72f1c33f89d4
child 160 14a76109b561
     1.1 --- a/graph_displayer_canvas-event.cc	Mon Sep 25 10:18:35 2006 +0000
     1.2 +++ b/graph_displayer_canvas-event.cc	Mon Sep 25 12:08:35 2006 +0000
     1.3 @@ -169,46 +169,57 @@
     1.4  	//all the edges connected to the moved point has to be redrawn
     1.5          for(OutEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
     1.6          {
     1.7 +          XY arrow_pos;
     1.8 +
     1.9 +          if (mytab.mapstorage.graph.source(ei) == mytab.mapstorage.graph.target(ei))
    1.10 +          {
    1.11 +            arrow_pos = mytab.mapstorage.arrow_pos[ei] + XY(dx, dy);
    1.12 +          }
    1.13 +          else
    1.14 +          {
    1.15              XY moved_node_1(coord_x - dx, coord_y - dy);
    1.16              XY moved_node_2(coord_x, coord_y);
    1.17              Node target = mytab.mapstorage.graph.target(ei);
    1.18              XY fix_node(mytab.mapstorage.coords[target].x,
    1.19 -                        mytab.mapstorage.coords[target].y);
    1.20 +                mytab.mapstorage.coords[target].y);
    1.21 +            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
    1.22 +
    1.23 +            arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
    1.24 +          }
    1.25 +
    1.26 +          mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
    1.27 +          edgesmap[ei]->draw();
    1.28 +
    1.29 +          //reposition of edgetext
    1.30 +          XY text_pos=mytab.mapstorage.arrow_pos[ei];
    1.31 +          text_pos+=(XY(10,10));
    1.32 +          edgetextmap[ei]->property_x().set_value(text_pos.x);
    1.33 +          edgetextmap[ei]->property_y().set_value(text_pos.y);
    1.34 +        }
    1.35 +
    1.36 +        for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
    1.37 +        {
    1.38 +          if (mytab.mapstorage.graph.source(ei) != mytab.mapstorage.graph.target(ei))
    1.39 +          {
    1.40 +            XY moved_node_1(coord_x - dx, coord_y - dy);
    1.41 +            XY moved_node_2(coord_x, coord_y);
    1.42 +            Node source = mytab.mapstorage.graph.source(ei);
    1.43 +            XY fix_node(mytab.mapstorage.coords[source].x,
    1.44 +                mytab.mapstorage.coords[source].y);
    1.45              XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
    1.46  
    1.47              XY arrow_pos;
    1.48 -	    arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
    1.49 +            arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
    1.50  
    1.51              mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
    1.52              edgesmap[ei]->draw();
    1.53  
    1.54 -	    //reposition of edgetext
    1.55 -	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
    1.56 -	    text_pos+=(XY(10,10));
    1.57 -	    edgetextmap[ei]->property_x().set_value(text_pos.x);
    1.58 -	    edgetextmap[ei]->property_y().set_value(text_pos.y);
    1.59 -        }
    1.60 -
    1.61 -        for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
    1.62 -        {
    1.63 -            XY moved_node_1(coord_x - dx, coord_y - dy);
    1.64 -            XY moved_node_2(coord_x, coord_y);
    1.65 -            Node source = mytab.mapstorage.graph.source(ei);
    1.66 -            XY fix_node(mytab.mapstorage.coords[source].x,
    1.67 -                        mytab.mapstorage.coords[source].y);
    1.68 -            XY old_arrow_pos(mytab.mapstorage.arrow_pos[ei]);
    1.69 -
    1.70 -            XY arrow_pos;
    1.71 -	    arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton);
    1.72 -
    1.73 -            mytab.mapstorage.arrow_pos.set(ei, arrow_pos);
    1.74 -            edgesmap[ei]->draw();
    1.75 -
    1.76 -	    //reposition of edgetext
    1.77 -	    XY text_pos=mytab.mapstorage.arrow_pos[ei];
    1.78 -	    text_pos+=(XY(10,10));
    1.79 -	    edgetextmap[ei]->property_x().set_value(text_pos.x);
    1.80 -	    edgetextmap[ei]->property_y().set_value(text_pos.y);
    1.81 +            //reposition of edgetext
    1.82 +            XY text_pos=mytab.mapstorage.arrow_pos[ei];
    1.83 +            text_pos+=(XY(10,10));
    1.84 +            edgetextmap[ei]->property_x().set_value(text_pos.x);
    1.85 +            edgetextmap[ei]->property_y().set_value(text_pos.y);
    1.86 +          }
    1.87          }
    1.88        }
    1.89      default: break;
    1.90 @@ -526,7 +537,7 @@
    1.91  	{
    1.92  	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    1.93  	    {
    1.94 -	      if(edgesmap[i]==active_item)
    1.95 +	      if(edgesmap[i]->getLine()==active_item)
    1.96  		{
    1.97  		  active_edge=i;
    1.98  		}