COIN-OR::LEMON - Graph Library

Changeset 1602:c0d7a9247963 in lemon-0.x for gui


Ignore:
Timestamp:
07/28/05 19:06:13 (14 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2107
Message:

Tooltip should be turn up on CreateNode? tool.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gui/broken_edge.cc

    r1601 r1602  
    4646      //arrow keeps its position-left button
    4747
    48       //       if(p.size()==2)
    49       //        {
    50       //          Gnome::Canvas::Points points;
    51       //          my_points[0]=p[0];
    52       //          my_points[2]=p[1];
    53       //          for(int i=0;i<3;i++)
    54       //            {
    55       //              points.push_back(my_points[i]);
    56       //            }
    57       //          property_points().set_value(points);
    58       //        }
     48      if(p.size()==2)
     49        {
     50          Gnome::Canvas::Points points;
     51          my_points[0]=p[0];
     52          my_points[2]=p[1];
     53          for(int i=0;i<3;i++)
     54            {
     55              points.push_back(my_points[i]);
     56            }
     57          property_points().set_value(points);
     58        }
     59      set_arrow=true;
    5960
    6061      //////////////////////////////////////////////////////////////////////////////////////////////////////
     
    185186      //////////////////////////////////////////////////////////////////////////////////////////////////////
    186187
    187       if(p.size()==2)
    188         {
    189           //old vector from one to the other node - a
    190           xy<double> a_v(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y());
    191           //new vector from one to the other node - b
    192           xy<double> b_v(p[1].get_x()-p[0].get_x(),p[1].get_y()-p[0].get_y());
    193 
    194           //old vector from one node to the breakpoint - c
    195           xy<double> c_v(my_points[1].get_x()-my_points[0].get_x(),my_points[1].get_y()-my_points[0].get_y());
    196 
    197           //new vector from one node to the breakpoint - d - we have to calculate this one
    198           xy<double> d_v;
    199 
    200           //scalar product of a and b (old and new vector from first point to the other)
    201           double sab=a_v*b_v;
    202           //scalar product of c and d (old and new vector from first point to breakpoint)
    203           double scd=sab*c_v.normSquare()/a_v.normSquare();
    204 
    205           std::cout<<" a " << a_v<<" b " <<b_v<<" c " <<c_v<<" sab " <<sab<<" scd "<<scd<<std::endl;
    206 
    207           double a=c_v.normSquare();
    208           double b=2*scd*c_v.y;
    209           double c=scd*scd-b_v.normSquare()/a_v.normSquare()*c_v.normSquare()*c_v.x*c_v.x;
    210 
    211           std::cout<<" a " << a<<" b " <<b<<" c " <<c<<std::endl;
    212 
    213           d_v.y=(-b-sqrt(b*b-4*a*c))/2/a;
    214 
    215           if(c_v.x!=0)
    216             {
    217               d_v.x=(scd-c_v.y*d_v.y)/c_v.x;
    218             }
    219           else
    220             {
    221               d_v.x=my_points[1].get_x();
    222             }
    223 
    224           std::cout<<" d " << d_v<<std::endl;
    225 
    226           my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y());
    227 
    228           Gnome::Canvas::Points points;
    229           for(int i=0;i<3;i++)
    230             {
    231               points.push_back(my_points[i]);
    232             }
    233           property_points().set_value(points);
    234         }
     188//       if(p.size()==2)
     189//              {
     190//        //old vector from one to the other node - a
     191//        xy<double> a_v(my_points[2].get_x()-my_points[0].get_x(),my_points[2].get_y()-my_points[0].get_y());
     192//        //new vector from one to the other node - b
     193//        xy<double> b_v(p[1].get_x()-p[0].get_x(),p[1].get_y()-p[0].get_y());
     194
     195//        //old vector from one node to the breakpoint - c
     196//        xy<double> c_v(my_points[1].get_x()-my_points[0].get_x(),my_points[1].get_y()-my_points[0].get_y());
     197
     198//        //new vector from one node to the breakpoint - d - we have to calculate this one
     199//        xy<double> d_v;
     200
     201//        //scalar product of a and b (old and new vector from first point to the other)
     202//        double sab=a_v*b_v;
     203//        //scalar product of c and d (old and new vector from first point to breakpoint)
     204//        double scd=sab*c_v.normSquare()/a_v.normSquare();
     205
     206//        std::cout<<" a " << a_v<<" b " <<b_v<<" c " <<c_v<<" sab " <<sab<<" scd "<<scd<<std::endl;
     207
     208//        double a=c_v.normSquare();
     209//        double b=2*scd*c_v.y;
     210//        double c=scd*scd-b_v.normSquare()/a_v.normSquare()*c_v.normSquare()*c_v.x*c_v.x;
     211
     212//        std::cout<<" a " << a<<" b " <<b<<" c " <<c<<std::endl;
     213
     214//        d_v.y=(-b-sqrt(b*b-4*a*c))/2/a;
     215
     216//        if(c_v.x!=0)
     217//          {
     218//            d_v.x=(scd-c_v.y*d_v.y)/c_v.x;
     219//          }
     220//        else
     221//          {
     222//            d_v.x=my_points[1].get_x();
     223//          }
     224
     225//        std::cout<<" d " << d_v<<std::endl;
     226
     227//        my_points[1]=Gnome::Art::Point(d_v.x+p[0].get_x(),d_v.y+p[0].get_y());
     228
     229//        Gnome::Canvas::Points points;
     230//        for(int i=0;i<3;i++)
     231//          {
     232//            points.push_back(my_points[i]);
     233//          }
     234//        property_points().set_value(points);
     235//      }
    235236    }
    236237  if(set_arrow)
Note: See TracChangeset for help on using the changeset viewer.