patched bug 20

This commit is contained in:
Radu Ursu 2002-06-26 11:58:15 +00:00
parent 88065620dd
commit 8b68cfafae
1 changed files with 16 additions and 12 deletions

View File

@ -53,14 +53,14 @@ class Qt_widget_move_list_point : public Qt_widget_movepoint_helper
public:
typedef typename R::Point_2 Point;
typedef typename R::FT FT;
bool on_first, //if the user choosed something from the popup
wasrepainted;//true when the widget was repainted
Point old_point, //the last point stored in the list
current_v; //the current point
QPopupMenu *popup1;
QCursor cursor;
std::list<Point>* l_of_p;
bool first_time;
bool on_first, //if the user choosed something from the popup
wasrepainted;//true when the widget was repainted
Point old_point, //the last point stored in the list
current_v; //the current point
QPopupMenu *popup1;
QCursor cursor;
std::list<Point>* l_of_p;
bool first_time;
//constructor
Qt_widget_move_list_point(const QCursor c=QCursor(Qt::crossCursor)) :
@ -86,15 +86,18 @@ private:
{
if(l_of_p->empty())
QMessageBox::warning( widget, "There are no points in the list!",
"Generate some points first or add it with the input tool before using this tool!");
"Generate some points first or add it with the
input tool before using this tool!");
else{
FT x=static_cast<FT>(widget->x_real(e->x()));
FT y=static_cast<FT>(widget->y_real(e->y()));
FT y=static_cast<FT>(widget->y_real(e->y()));
Point p(x, y);
Point closest_p; //this point is the closest one to the mouse coordinates
Point closest_p;
//this point is the closest one to the mouse coordinates
FT min_dist;
std::list<Point>::const_iterator it = l_of_p->begin();
min_dist = squared_distance(p, (*it));
closest_p = (*it);
while(it!=l_of_p->end())
{
if (min_dist > squared_distance(p, (*it)))
@ -129,7 +132,8 @@ private:
x=static_cast<FT>(widget->x_real(e->x())),
y=static_cast<FT>(widget->y_real(e->y()));
*widget << CGAL::GREEN << CGAL::PointSize (5) << CGAL::PointStyle (CGAL::DISC);
*widget << CGAL::GREEN << CGAL::PointSize (5)
<< CGAL::PointStyle (CGAL::DISC);
if(!wasrepainted)
*widget << old_point;
*widget << Point(x, y);