mirror of https://github.com/CGAL/cgal
1.3.62 - 21/11/2003
----------------------------------------
We don't have time for ROTATIONS support, so we roll back the
Rotations stuff.
It remains in v1_3_61 though.
This commit is contained in:
parent
f3ddd07e9a
commit
7cae2fd7f1
|
|
@ -1,3 +1,9 @@
|
|||
1.3.62 - 21/11/2003
|
||||
----------------------------------------
|
||||
We don't have time for ROTATIONS support, so we roll back the
|
||||
Rotations stuff.
|
||||
It remains in v1_3_61 though.
|
||||
|
||||
1.3.61 - 19/11/2003
|
||||
----------------------------------------
|
||||
I want the latest changes in the testsuite
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// $Revision$ $Date$
|
||||
// $Name$
|
||||
//
|
||||
// Author(s) : Laurent Rineau && Radu Ursu
|
||||
// Author(s) : Laurent Rineau
|
||||
|
||||
#ifndef CGAL_QT_WIDGET_H
|
||||
#define CGAL_QT_WIDGET_H
|
||||
|
|
@ -48,9 +48,6 @@
|
|||
#include <qpixmap.h>
|
||||
#include <qprinter.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> SCD;
|
||||
typedef CGAL::Aff_transformation_2<SCD> Transformation;
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Qt_widget_layer;
|
||||
|
|
@ -138,9 +135,6 @@ public:
|
|||
// coordinates system
|
||||
// ~~~~~~~~~~~~~~~~~~
|
||||
// real world coordinates
|
||||
// x_real, y_real are deprecated
|
||||
// as soon as rotations are used, those functions are not good.
|
||||
// users should use only xy_real
|
||||
double x_real(int x) const;
|
||||
double y_real(int y) const;
|
||||
template <class FT>
|
||||
|
|
@ -151,8 +145,6 @@ public:
|
|||
void x_real(int, Gmpq&) const;
|
||||
void y_real(int, Gmpq&) const;
|
||||
#endif
|
||||
template <class FT>
|
||||
void xy_real(int, int, FT&, FT&) const;
|
||||
|
||||
double x_real_dist(double d) const;
|
||||
double y_real_dist(double d) const;
|
||||
|
|
@ -161,8 +153,6 @@ public:
|
|||
// pixel coordinates
|
||||
int x_pixel(double x) const;
|
||||
int y_pixel(double y) const;
|
||||
void xy_pixel(const double x, const double y,
|
||||
int &x_result, int &y_result) const;
|
||||
int x_pixel_dist(double d) const;
|
||||
int y_pixel_dist(double d) const;
|
||||
|
||||
|
|
@ -228,10 +218,6 @@ public:
|
|||
void add_to_history() { emit(internal_add_to_history()); }
|
||||
void clear_history() { emit(internal_clear_history()); }
|
||||
|
||||
Transformation* get_transformation(){return t;};
|
||||
void set_transformation(const Transformation &newt){(*t) = newt;};
|
||||
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
|
@ -293,9 +279,6 @@ private:
|
|||
//backup ranges for resize
|
||||
double xscal, yscal; // scales int/double
|
||||
bool constranges; // tell if the ranges should be const
|
||||
Transformation *t; //this transformation is used to perform mainly
|
||||
//rotations. It is initialised in the constructor.
|
||||
//this will remove xscal, yscal in the future
|
||||
|
||||
//for layers
|
||||
std::list<Qt_widget_layer*> qt_layers;
|
||||
|
|
@ -475,9 +458,8 @@ void Qt_widget::setPointStyle(const PointStyle ps)
|
|||
template <class R>
|
||||
Qt_widget& operator<<(Qt_widget& w, const Point_2<R>& p)
|
||||
{
|
||||
int x, y;
|
||||
w.xy_pixel(CGAL::to_double(p.x()),
|
||||
CGAL::to_double(p.y()), x, y);
|
||||
int x = w.x_pixel(CGAL::to_double(p.x()));
|
||||
int y = w.y_pixel(CGAL::to_double(p.y()));
|
||||
|
||||
uint size=w.pointSize();
|
||||
PointStyle ps=w.pointStyle();
|
||||
|
|
@ -770,94 +752,42 @@ Qt_widget& operator<<(Qt_widget& w, const Bbox_2& r);
|
|||
// see Qt_widget for the implementation of this non-template function
|
||||
#endif // CGAL_BBOX_2_H
|
||||
|
||||
// templated x_real and y_real keeped for backward compatibility
|
||||
// as soon as someone use rotations, this functions are not good
|
||||
// users should only use xy_real/xy_pixel
|
||||
// templated x_real and y_real
|
||||
|
||||
template <class FT>
|
||||
void Qt_widget::x_real(int x, FT& return_t) const
|
||||
{
|
||||
double temp_x = static_cast<double>(x);
|
||||
double xnew = xmin + temp_x/xscal;
|
||||
CGAL::Point_2<SCD> p1(xnew, 1);
|
||||
p1 = (t->inverse())(p1);
|
||||
|
||||
if(xscal<1)
|
||||
return_t = static_cast<FT>((int)(p1.x()));
|
||||
return_t = static_cast<FT>(xmin+(int)(x/xscal));
|
||||
else{
|
||||
#ifdef CGAL_USE_GMP
|
||||
CGAL_Rational r = simplest_rational_in_interval<CGAL_Rational>(
|
||||
p1.x() - (1/xscal)/2,
|
||||
p1.x() + (1/xscal)/2);
|
||||
xmin+x/xscal-(x/xscal-(x-1)/xscal)/2,
|
||||
xmin+x/xscal+((x+1)/xscal-x/xscal)/2);
|
||||
return_t = static_cast<FT>(CGAL::to_double(r));
|
||||
#else
|
||||
return_t = static_cast<FT>(p1.x());
|
||||
return_t = static_cast<FT>(xmin+x/xscal);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class FT>
|
||||
void Qt_widget::y_real(int y, FT& return_t) const
|
||||
{
|
||||
double temp_y = static_cast<double>(y);
|
||||
double ynew = ymax - temp_y/yscal;
|
||||
CGAL::Point_2<SCD> p1(1, ynew);
|
||||
p1 = (t->inverse())(p1);
|
||||
|
||||
if(yscal<1)
|
||||
return_t = static_cast<FT>((int)(p1.y()));
|
||||
else{
|
||||
if(yscal<1)
|
||||
return_t = static_cast<FT>(ymax-(int)(y/yscal));
|
||||
else{
|
||||
#ifdef CGAL_USE_GMP
|
||||
CGAL_Rational r = simplest_rational_in_interval<CGAL_Rational>(
|
||||
p1.y() - (1/yscal)/2,
|
||||
p1.y() + (1/yscal)/2);
|
||||
ymax - y/yscal-(y/yscal-(y-1)/yscal)/2,
|
||||
ymax - y/yscal+((y+1)/yscal-y/yscal)/2);
|
||||
return_t = static_cast<FT>(CGAL::to_double(r));
|
||||
#else
|
||||
return_t = static_cast<FT>(p1.y());
|
||||
return_t = static_cast<FT>(ymax-y/yscal);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class FT>
|
||||
void Qt_widget::xy_real(int x, int y,
|
||||
FT& x_result, FT& y_result) const
|
||||
{
|
||||
double temp_x = static_cast<double>(x);
|
||||
double xnew = xmin + temp_x/xscal;
|
||||
double temp_y = static_cast<double>(y);
|
||||
double ynew = ymax - temp_y/yscal;
|
||||
CGAL::Point_2<SCD> p1(xnew, ynew);
|
||||
p1 = (t->inverse())(p1);
|
||||
|
||||
if(xscal<1)
|
||||
x_result = static_cast<FT>((int)(p1.x()));
|
||||
else{
|
||||
#ifdef CGAL_USE_GMP
|
||||
CGAL_Rational r = simplest_rational_in_interval<CGAL_Rational>(
|
||||
p1.x() - (1/xscal)/2,
|
||||
p1.x() + (1/xscal)/2);
|
||||
x_result = static_cast<FT>(CGAL::to_double(r));
|
||||
#else
|
||||
x_result = static_cast<FT>(p1.x());
|
||||
#endif
|
||||
}
|
||||
|
||||
if(yscal<1)
|
||||
y_result = static_cast<FT>((int)(p1.y()));
|
||||
else{
|
||||
#ifdef CGAL_USE_GMP
|
||||
CGAL_Rational r = simplest_rational_in_interval<CGAL_Rational>(
|
||||
p1.y() - (1/yscal)/2,
|
||||
p1.y() + (1/yscal)/2);
|
||||
y_result = static_cast<FT>(CGAL::to_double(r));
|
||||
#else
|
||||
y_result = static_cast<FT>(p1.y());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_QT_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ private:
|
|||
&& is_pure(e->state()))
|
||||
{
|
||||
double x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
widget->set_center(x, y);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ protected:
|
|||
&& is_pure(e->state()))
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
x1 = x;
|
||||
y1 = y;
|
||||
x2 = x;
|
||||
|
|
@ -77,7 +78,8 @@ protected:
|
|||
firstpoint = true;
|
||||
} else if(e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON){
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
widget->new_object(make_object(Circle(Point(x1,y1),
|
||||
squared_distance(Point(x1, y1), Point(x,y)))));
|
||||
firstpoint = false;
|
||||
|
|
@ -132,7 +134,8 @@ protected:
|
|||
if(firstpoint==TRUE)
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
QColor old_color = widget->color();
|
||||
RasterOp old_raster = widget->rasterOp();//save the initial raster mode
|
||||
widget->setRasterOp(XorROP);
|
||||
|
|
|
|||
|
|
@ -82,8 +82,10 @@ protected:
|
|||
} else {
|
||||
if((e->x() != first_x) && (e->y() != first_y)) {
|
||||
RT x, y, xfirst2, yfirst2;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->xy_real(first_x, first_y, xfirst2, yfirst2);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
widget->x_real(first_x, xfirst2);
|
||||
widget->y_real(first_y, yfirst2);
|
||||
RT xmin, xmax, ymin, ymax;
|
||||
if(x < xfirst2) {xmin = x; xmax = xfirst2;}
|
||||
else {xmin = xfirst2; xmax = x;};
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ protected:
|
|||
&& is_pure(e->state()))
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
x1 = x;
|
||||
y1 = y;
|
||||
x2 = x;
|
||||
|
|
@ -76,7 +77,8 @@ protected:
|
|||
} else if(e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON
|
||||
&& is_pure(e->state())){
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x),
|
||||
widget->y_real(e->y(), y);
|
||||
if(x1!=x || y1!=y) {
|
||||
widget->new_object(make_object(Line(Point(x1,y1),Point(x,y))));
|
||||
firstpoint = FALSE;
|
||||
|
|
@ -127,7 +129,8 @@ protected:
|
|||
if(firstpoint)
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
RasterOp old_raster = widget->rasterOp();//save the initial raster mode
|
||||
QColor old_color = widget->color();
|
||||
widget->setRasterOp(XorROP);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ protected:
|
|||
&& is_pure(e->state()))
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
widget->new_object(make_object(Point(x, y)));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -81,7 +81,9 @@ protected:
|
|||
if(e->button() == Qt::LeftButton && is_pure(e->state()))
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
|
||||
if(!active)
|
||||
{
|
||||
active=true;
|
||||
|
|
@ -154,7 +156,9 @@ protected:
|
|||
if (active)
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
|
||||
rubber = Point_2(x, y);
|
||||
widget->lock();
|
||||
RasterOp old_rasterop=widget->rasterOp();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ protected:
|
|||
&& is_pure(e->state()))
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
x1 = x;
|
||||
y1 = y;
|
||||
x2 = x;
|
||||
|
|
@ -73,7 +74,8 @@ protected:
|
|||
} else if(e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON
|
||||
&& is_pure(e->state())){
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
if(x1!=x || y1!=y) {
|
||||
widget->new_object(
|
||||
make_object(Segment(Point(x1,y1),Point(x,y))));
|
||||
|
|
@ -125,7 +127,8 @@ protected:
|
|||
if(firstpoint)
|
||||
{
|
||||
FT x, y;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
RasterOp old_raster = widget->rasterOp();//save the initial raster mode
|
||||
QColor old_color = widget->color();
|
||||
widget->setRasterOp(XorROP);
|
||||
|
|
|
|||
|
|
@ -93,9 +93,11 @@ private:
|
|||
{
|
||||
widget->setCursor(QCursor( QPixmap( (const char**)hand_xpm)));
|
||||
double x, y, xfirst2, yfirst2;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->xy_real(first_x, first_y, xfirst2, yfirst2);
|
||||
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
widget->x_real(first_x, xfirst2);
|
||||
widget->y_real(first_y, yfirst2);
|
||||
|
||||
double xmin, xmax, ymin, ymax, distx, disty;
|
||||
if(x < xfirst2) {xmin = x; xmax = xfirst2;}
|
||||
else {xmin = xfirst2; xmax = x;};
|
||||
|
|
@ -121,7 +123,8 @@ private:
|
|||
widget->lock();
|
||||
*widget << CGAL::GRAY;
|
||||
if(!wasrepainted) {
|
||||
widget->xy_real(x2 - first_x, y2 - first_y, xcoord, ycoord);
|
||||
widget->x_real(x2 - first_x, xcoord);
|
||||
widget->x_real(y2 - first_y, ycoord);
|
||||
CGAL_CLIB_STD::sprintf(tempc1, " dx=%20.6f", xcoord);
|
||||
CGAL_CLIB_STD::sprintf(tempc2, ", dy=%20.6f", ycoord);
|
||||
strcat(tempc1, tempc2);
|
||||
|
|
@ -130,7 +133,8 @@ private:
|
|||
widget->get_painter().drawText(x2, y2, tempc1, 49);
|
||||
*widget << CGAL::GRAY;
|
||||
}
|
||||
widget->xy_real(x - first_x, y - first_y, xcoord, ycoord);
|
||||
widget->x_real(x - first_x, xcoord);
|
||||
widget->x_real(y - first_y, ycoord);
|
||||
CGAL_CLIB_STD::sprintf(tempc1, " dx=%20.6f", xcoord);
|
||||
CGAL_CLIB_STD::sprintf(tempc2, ", dy=%20.6f", ycoord);
|
||||
strcat(tempc1, tempc2);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ public:
|
|||
{
|
||||
QString s("x=%1 y=%2");
|
||||
double xcoord, ycoord;
|
||||
widget->xy_real(e->x(), e->y(), xcoord, ycoord);
|
||||
widget->x_real(e->x(), xcoord);
|
||||
widget->y_real(e->y(), ycoord);
|
||||
qmw.statusBar()->message(s.arg(xcoord, -20, 'g', 15).
|
||||
arg(ycoord, -20,'g', 15));
|
||||
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@ private:
|
|||
void fill_toolbar(QMainWindow *mw);
|
||||
|
||||
private:
|
||||
Qt_widget *widget;
|
||||
Qt_widget_history *history;
|
||||
QButtonGroup* button_group;
|
||||
Qt_widget *widget;
|
||||
Qt_widget_history *history;
|
||||
QButtonGroup* button_group;
|
||||
// this group has no parent and is destroyed manually in the
|
||||
// destructor
|
||||
|
||||
QToolButton* nolayerBt;
|
||||
QToolButton* nolayerBt;
|
||||
};//end class
|
||||
|
||||
};//end namespace
|
||||
|
|
|
|||
|
|
@ -84,9 +84,11 @@ private:
|
|||
{
|
||||
if((e->x() != first_x) && (e->y() != first_y)) {
|
||||
double x, y, xfirst2, yfirst2;
|
||||
widget->xy_real(e->x(), e->y(), x, y);
|
||||
widget->xy_real(first_x, first_y, xfirst2, yfirst2);
|
||||
|
||||
widget->x_real(e->x(), x);
|
||||
widget->y_real(e->y(), y);
|
||||
widget->x_real(first_x, xfirst2);
|
||||
widget->y_real(first_y, yfirst2);
|
||||
|
||||
double xmin, xmax, ymin, ymax;
|
||||
if(x < xfirst2) {xmin = x; xmax = xfirst2;}
|
||||
else {xmin = xfirst2; xmax = x;};
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ Qt_widget::Qt_widget(QWidget *parent, const char *name) :
|
|||
xmax_old = xmax = 1;
|
||||
ymin_old = ymin = -1;
|
||||
ymax_old = ymax = 1;
|
||||
t = new Transformation();
|
||||
constranges=false;
|
||||
set_scales();
|
||||
emit(rangesChanged());
|
||||
|
|
@ -405,60 +404,40 @@ void Qt_widget::zoom(double ratio)
|
|||
ymin + (ymax - ymin) / 2 );
|
||||
}
|
||||
|
||||
// the methods x_real, y_real, x_pixel, y_pixel
|
||||
// are all deprecated. As soon as someone use rotations
|
||||
// this functions are not good enough
|
||||
// Users should use from now on xy_pixel, xy_real
|
||||
|
||||
#ifdef CGAL_USE_GMP
|
||||
void Qt_widget::x_real(int x, Gmpq& return_t) const
|
||||
{
|
||||
double temp_x = static_cast<double>(x);
|
||||
double xnew = xmin + temp_x/xscal;
|
||||
CGAL::Point_2<SCD> p1(xnew, 1);
|
||||
p1 = (t->inverse())(p1);
|
||||
return_t = simplest_rational_in_interval<Gmpq>(
|
||||
p1.x() - (1/xscal)/2,
|
||||
p1.x() + (1/xscal)/2);
|
||||
xmin+x/xscal-(1/xscal)/2,
|
||||
xmin+x/xscal+(1/xscal)/2);
|
||||
}
|
||||
|
||||
void Qt_widget::y_real(int y, Gmpq& return_t) const
|
||||
{
|
||||
double temp_y = static_cast<double>(y);
|
||||
double ynew = ymax - temp_y/yscal;
|
||||
CGAL::Point_2<SCD> p1(1, ynew);
|
||||
p1 = (t->inverse())(p1);
|
||||
return_t = simplest_rational_in_interval<Gmpq>(
|
||||
p1.y() - (1/yscal)/2,
|
||||
p1.y() + (1/yscal)/2);
|
||||
ymax - y/yscal-(1/yscal)/2,
|
||||
ymax - y/yscal+(1/yscal)/2);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
double Qt_widget::x_real(int x) const
|
||||
{
|
||||
double temp_x = static_cast<double>(x);
|
||||
double xnew = xmin + temp_x/xscal;
|
||||
CGAL::Point_2<SCD> p1(xnew, 1);
|
||||
p1 = (t->inverse())(p1);
|
||||
if(xscal<1)
|
||||
return (int)(p1.x());
|
||||
return(xmin+(int)(x/xscal));
|
||||
else
|
||||
return p1.x();
|
||||
return (xmin+x/xscal);
|
||||
}
|
||||
|
||||
double Qt_widget::y_real(int y) const
|
||||
{
|
||||
double temp_y = static_cast<double>(y);
|
||||
double ynew = ymax - temp_y/yscal;
|
||||
CGAL::Point_2<SCD> p1(1, ynew);
|
||||
p1 = (t->inverse())(p1);
|
||||
if(yscal<1)
|
||||
return (int)(p1.y());
|
||||
else
|
||||
return p1.y();
|
||||
if(yscal<1)
|
||||
return(ymax-(int)(y/yscal));
|
||||
else
|
||||
return (ymax-y/yscal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
double Qt_widget::x_real_dist(double d) const
|
||||
{
|
||||
return(d/xscal);
|
||||
|
|
@ -471,28 +450,14 @@ double Qt_widget::y_real_dist(double d) const
|
|||
|
||||
int Qt_widget::x_pixel(double x) const
|
||||
{
|
||||
CGAL::Point_2<SCD> p1(x, 1);
|
||||
p1 = (*t)(p1);
|
||||
return( static_cast<int>((p1.x() - xmin)*xscal));
|
||||
return( static_cast<int>((x-xmin)*xscal+0.5) );
|
||||
}
|
||||
|
||||
int Qt_widget::y_pixel(double y) const
|
||||
{
|
||||
CGAL::Point_2<SCD> p1(1, y);
|
||||
p1 = (*t)(p1);
|
||||
return( static_cast<int>((ymax - p1.y())*yscal));
|
||||
return( - static_cast<int>((y-ymax)*yscal+0.5) );
|
||||
}
|
||||
|
||||
void Qt_widget::xy_pixel(const double x, const double y,
|
||||
int &x_result, int &y_result) const
|
||||
{
|
||||
CGAL::Point_2<SCD> p1(x, y);
|
||||
p1 = (*t)(p1);
|
||||
x_result = static_cast<int>((p1.x() - xmin)*xscal);
|
||||
y_result = static_cast<int>((ymax - p1.y())*yscal);
|
||||
}
|
||||
|
||||
|
||||
int Qt_widget::x_pixel_dist(double d) const
|
||||
{
|
||||
if (d>0)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include <CGAL/IO/pixmaps/back.xpm>
|
||||
#include <CGAL/IO/pixmaps/forward.xpm>
|
||||
#include <CGAL/IO/pixmaps/mouse_coord.xpm>
|
||||
#include <CGAL/IO/pixmaps/rotation.xpm>
|
||||
|
||||
#include <qbuttongroup.h>
|
||||
#include <qiconset.h>
|
||||
|
|
@ -49,7 +48,6 @@
|
|||
#include <CGAL/IO/Qt_widget_focus.h>
|
||||
#include <CGAL/IO/Qt_widget_zoomrect.h>
|
||||
#include <CGAL/IO/Qt_widget_handtool.h>
|
||||
#include <CGAL/IO/Qt_widget_rotation_layer.h>
|
||||
#include <CGAL/IO/Qt_widget_show_mouse_coordinates.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -82,29 +80,25 @@ namespace CGAL {
|
|||
new Qt_widget_zoomrect(this, "zoomrectlayer");
|
||||
Qt_widget_handtool* handtoollayer =
|
||||
new Qt_widget_handtool(this, "handtoollayer");
|
||||
Qt_widget_rotation_layer* rotationlayer =
|
||||
new Qt_widget_rotation_layer(this, "rotation_layer");
|
||||
Qt_widget_show_mouse_coordinates* showcoordlayer = 0; // created below
|
||||
|
||||
widget->attach_standard(focuslayer);
|
||||
widget->attach_standard(zoomrectlayer);
|
||||
widget->attach_standard(handtoollayer);
|
||||
widget->attach_standard(rotationlayer);
|
||||
focuslayer->deactivate();
|
||||
zoomrectlayer->deactivate();
|
||||
handtoollayer->deactivate();
|
||||
rotationlayer->deactivate();
|
||||
|
||||
if (mw)
|
||||
{
|
||||
mw->statusBar();
|
||||
showcoordlayer =
|
||||
new Qt_widget_show_mouse_coordinates(*mw, this,
|
||||
{
|
||||
mw->statusBar();
|
||||
showcoordlayer =
|
||||
new Qt_widget_show_mouse_coordinates(*mw, this,
|
||||
"showcoordlayer");
|
||||
widget->attach_standard(showcoordlayer);
|
||||
showcoordlayer->does_eat_events = false;
|
||||
widget->setMouseTracking(true);
|
||||
}
|
||||
widget->attach_standard(showcoordlayer);
|
||||
showcoordlayer->does_eat_events = false;
|
||||
widget->setMouseTracking(true);
|
||||
}
|
||||
|
||||
const QPixmap p1(arrow_small_xpm), p2(arrow_xpm);
|
||||
const QIconSet arrow_pixmap(p1, p2);
|
||||
|
|
@ -115,9 +109,6 @@ namespace CGAL {
|
|||
const QPixmap p5(forward_small_xpm), p6(forward_xpm);
|
||||
const QIconSet forward_pixmap(p5, p6);
|
||||
|
||||
const QPixmap p7(rotation_small_xpm), p8(rotation_xpm);
|
||||
const QIconSet rotation_pixmap(p7, p8);
|
||||
|
||||
QToolButton* backBt = new QToolButton(this, "History Back");
|
||||
backBt->setIconSet(back_pixmap);
|
||||
backBt->setTextLabel("History Back");
|
||||
|
|
@ -154,22 +145,18 @@ namespace CGAL {
|
|||
nolayerBt->setIconSet(arrow_pixmap);
|
||||
nolayerBt->setTextLabel("Deactivate Standard Layer");
|
||||
|
||||
QToolButton* zoomrectBt = new QToolButton(this, "focus_on_region_layer");
|
||||
QToolButton* zoomrectBt = new QToolButton(this, "focus on region");
|
||||
zoomrectBt->setPixmap(QPixmap(zoomin_rect_xpm ));
|
||||
zoomrectBt->setTextLabel("Focus on region");
|
||||
|
||||
QToolButton* focusBt = new QToolButton(this, "focuslayer");
|
||||
QToolButton* focusBt = new QToolButton(this, "focus");
|
||||
focusBt->setPixmap(QPixmap(focus_xpm ));
|
||||
focusBt->setTextLabel("Focus on point");
|
||||
|
||||
QToolButton* handtoolBt = new QToolButton(this, "handlayer");
|
||||
QToolButton* handtoolBt = new QToolButton(this, "handtool");
|
||||
handtoolBt->setPixmap(QPixmap(hand_xpm ));
|
||||
handtoolBt->setTextLabel("Pan tool");
|
||||
|
||||
QToolButton* rotationBt = new QToolButton(this, "rotation_layer");
|
||||
rotationBt->setIconSet(rotation_pixmap);
|
||||
rotationBt->setTextLabel("Rotation tool.(EXPERIMENTAL!!!)");
|
||||
|
||||
addSeparator();
|
||||
|
||||
QToolButton* showcoordBt = new QToolButton(this, "mouse");
|
||||
|
|
@ -184,13 +171,12 @@ namespace CGAL {
|
|||
QToolButton* const button_group_list[] = { nolayerBt,
|
||||
zoomrectBt,
|
||||
focusBt,
|
||||
handtoolBt,
|
||||
rotationBt};
|
||||
for(int i=0; i<5; ++i)
|
||||
{
|
||||
button_group_list[i]->setToggleButton(true);
|
||||
button_group->insert(button_group_list[i]);
|
||||
}
|
||||
handtoolBt };
|
||||
for(int i=0; i<4; ++i)
|
||||
{
|
||||
button_group_list[i]->setToggleButton(true);
|
||||
button_group->insert(button_group_list[i]);
|
||||
}
|
||||
button_group->setExclusive(true);
|
||||
connect(button_group, SIGNAL(clicked(int)),
|
||||
this, SLOT(group_clicked(int)));
|
||||
|
|
@ -206,8 +192,6 @@ namespace CGAL {
|
|||
focuslayer, SLOT(stateChanged(int)));
|
||||
connect(handtoolBt, SIGNAL(stateChanged(int)),
|
||||
handtoollayer, SLOT(stateChanged(int)));
|
||||
connect(rotationBt, SIGNAL(stateChanged(int)),
|
||||
rotationlayer, SLOT(stateChanged(int)));
|
||||
connect(showcoordBt, SIGNAL(stateChanged(int)),
|
||||
showcoordlayer, SLOT(stateChanged(int)));
|
||||
|
||||
|
|
@ -235,17 +219,19 @@ namespace CGAL {
|
|||
// button_group.id(nolayerBt)==0.
|
||||
|
||||
if( i == id )
|
||||
{
|
||||
if( i == 0) return;
|
||||
// nolayer is on and cannot be set off like that.
|
||||
{
|
||||
if( i == 0) return;
|
||||
// nolayer is on and cannot be set off like that.
|
||||
|
||||
QToolButton* tBt =
|
||||
static_cast<QToolButton*>(button_group->find(i));
|
||||
if( tBt != 0)
|
||||
tBt->setOn(false);
|
||||
nolayerBt->setOn(true);
|
||||
id = 0;
|
||||
} else
|
||||
QToolButton* tBt =
|
||||
static_cast<QToolButton*>(button_group->find(i));
|
||||
if( tBt != 0)
|
||||
tBt->setOn(false);
|
||||
|
||||
nolayerBt->setOn(true);
|
||||
id = 0;
|
||||
}
|
||||
else
|
||||
id = i;
|
||||
}
|
||||
|
||||
|
|
@ -274,4 +260,3 @@ namespace CGAL {
|
|||
#include "Qt_widget_standard_toolbar.moc"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -2106,69 +2106,3 @@ const char * demoicon_xpm[] = {
|
|||
"oooooooooooooooo"
|
||||
};
|
||||
|
||||
|
||||
/* XPM */
|
||||
const char *rotation_small_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 2 1",
|
||||
" c opaque",
|
||||
". c None",
|
||||
/* pixels */
|
||||
"................",
|
||||
"....... .....",
|
||||
"..... ....",
|
||||
".. . .... ...",
|
||||
".. . ...... ..",
|
||||
".. ........ ..",
|
||||
".. ...... ..",
|
||||
".. ........ ..",
|
||||
"........... ...",
|
||||
"........... ...",
|
||||
".......... ....",
|
||||
"........ ....",
|
||||
"...... ......",
|
||||
"...... ........",
|
||||
"................",
|
||||
"................"
|
||||
};
|
||||
|
||||
/* XPM */
|
||||
static char *rotation_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 2 1",
|
||||
" c opaque",
|
||||
". c None",
|
||||
/* pixels */
|
||||
"................................",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................",
|
||||
"............ ..........",
|
||||
".......... .........",
|
||||
".... ... ......... .......",
|
||||
".... .. ............. ......",
|
||||
".... ............... .....",
|
||||
".... ................. .....",
|
||||
".... ............... ....",
|
||||
".... ................. ...",
|
||||
".... .................... ...",
|
||||
".... ...................... ...",
|
||||
"........................... ...",
|
||||
"........................... ...",
|
||||
"........................... ...",
|
||||
"........................... ...",
|
||||
"........................... ...",
|
||||
"........................... ...",
|
||||
".......................... ...",
|
||||
".......................... ....",
|
||||
"......................... .....",
|
||||
"........................ .....",
|
||||
"...................... ......",
|
||||
"..................... .......",
|
||||
"........... .........",
|
||||
"........... ...........",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................"
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue