fixed bug 20

This commit is contained in:
Radu Ursu 2002-06-26 12:03:11 +00:00
parent 8b68cfafae
commit 2f775789e9
1 changed files with 23 additions and 23 deletions

View File

@ -53,13 +53,13 @@ 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 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
@ -86,25 +86,26 @@ 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)))
{
min_dist = squared_distance(p, (*it));
closest_p = (*it);
}
it++;
}
if (min_dist > squared_distance(p, (*it))) {
min_dist = squared_distance(p, (*it));
closest_p = (*it);
}
it++;
}
RasterOp old = widget->rasterOp(); //save the initial raster mode
widget->setRasterOp(XorROP);
widget->lock();
@ -125,11 +126,10 @@ private:
{
if(on_first)
{
FT
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);
FT x=static_cast<FT>(widget->x_real(e->x()));
FT y=static_cast<FT>(widget->y_real(e->y()));
*widget << CGAL::GREEN << CGAL::PointSize (5)
<< CGAL::PointStyle (CGAL::DISC);
if(!wasrepainted)
*widget << old_point;
*widget << Point(x, y);