gui/broken_edge.cc
changeset 1500 a222eb109e52
parent 1499 9316dcc0a355
child 1501 39d59aee2a1a
equal deleted inserted replaced
1:6bed1226a368 2:980896b724b0
    15 BrokenEdge::~BrokenEdge()
    15 BrokenEdge::~BrokenEdge()
    16 {
    16 {
    17   if(arrow)delete(arrow);
    17   if(arrow)delete(arrow);
    18 }
    18 }
    19 
    19 
    20 void BrokenEdge::set_points(Gnome::Canvas::Points p)
    20 void BrokenEdge::set_points(Gnome::Canvas::Points p, bool move)
    21 {
    21 {
    22   bool set_arrow=false;
    22   bool set_arrow=false;
    23   if(p.size()==2)
    23   if(!move)
    24     {
    24     {
    25       set_arrow=true;
    25       if(p.size()==2)
    26       Gnome::Canvas::Points points_with_center;
    26 	{
    27       points_with_center.push_back(my_points[0]=p[0]);
    27 	  set_arrow=true;
    28       points_with_center.push_back(my_points[1]=Gnome::Art::Point( (p[0].get_x()+p[1].get_x())/2+0 , (p[0].get_y()+p[1].get_y())/2 )+0 );
    28 	  Gnome::Canvas::Points points_with_center;
    29       points_with_center.push_back(my_points[2]=p[1]);
    29 	  points_with_center.push_back(my_points[0]=p[0]);
    30       property_points().set_value(points_with_center);
    30 	  points_with_center.push_back(my_points[1]=Gnome::Art::Point( (p[0].get_x()+p[1].get_x())/2+0 , (p[0].get_y()+p[1].get_y())/2 )+0 );
    31     }  
    31 	  points_with_center.push_back(my_points[2]=p[1]);
    32   if(p.size()==3)
    32 	  property_points().set_value(points_with_center);
       
    33 	}  
       
    34       if(p.size()==3)
       
    35 	{
       
    36 	  set_arrow=true;
       
    37 	  property_points().set_value(p);
       
    38 	  for(int i=0;i<3;i++)
       
    39 	    {
       
    40 	      my_points[i]=p[i];
       
    41 	    }
       
    42 	}
       
    43     }
       
    44   else
    33     {
    45     {
    34       set_arrow=true;
    46       if(p.size()==2)
    35       property_points().set_value(p);
       
    36       for(int i=0;i<3;i++)
       
    37 	{
    47 	{
    38 	  my_points[i]=p[i];
    48 	  Gnome::Canvas::Points points;
       
    49 	  my_points[0]=p[0];
       
    50 	  my_points[2]=p[1];
       
    51 	  for(int i=0;i<3;i++)
       
    52 	    {
       
    53 	      points.push_back(my_points[i]);
       
    54 	    }
       
    55 	  property_points().set_value(points);
    39 	}
    56 	}
    40     }
    57     }
    41 
    58 
    42   if(set_arrow)
    59   if(set_arrow)
    43     {
    60     {