From bff3e8691f3e645d349a6f4e784c076cd6bb7d32 Mon Sep 17 00:00:00 2001 From: Radu Ursu Date: Tue, 20 Jan 2004 18:25:48 +0000 Subject: [PATCH] 1.3.63 - 20/01/2004 [rursu] ---------------------------------------- I have added two new layers: Navigation_layer.h, Custom_zoom_layer.h I have updated the doc too. --- Packages/Qt_widget/changes.txt | 6 ++ .../Qt_widget_ref/Custom_zoom_layer.tex | 45 +++++++++++ .../Qt_widget_ref/Navigation_layer.tex | 47 +++++++++++ .../Qt_widget/doc_tex/Qt_widget_ref/main.tex | 2 + .../Qt_widget_ref/Custom_zoom_layer.tex | 45 +++++++++++ .../Qt_widget_ref/Navigation_layer.tex | 47 +++++++++++ .../doc_tex/support/Qt_widget_ref/main.tex | 2 + .../include/CGAL/IO/Custom_zoom_layer.h | 81 +++++++++++++++++++ .../include/CGAL/IO/Navigation_layer.h | 58 +++++++++++++ 9 files changed, 333 insertions(+) create mode 100644 Packages/Qt_widget/doc_tex/Qt_widget_ref/Custom_zoom_layer.tex create mode 100644 Packages/Qt_widget/doc_tex/Qt_widget_ref/Navigation_layer.tex create mode 100644 Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Custom_zoom_layer.tex create mode 100644 Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Navigation_layer.tex create mode 100644 Packages/Qt_widget/include/CGAL/IO/Custom_zoom_layer.h create mode 100644 Packages/Qt_widget/include/CGAL/IO/Navigation_layer.h diff --git a/Packages/Qt_widget/changes.txt b/Packages/Qt_widget/changes.txt index 92c9a44fa5b..68d7a93a544 100644 --- a/Packages/Qt_widget/changes.txt +++ b/Packages/Qt_widget/changes.txt @@ -1,3 +1,9 @@ +1.3.63 - 20/01/2004 [rursu] +---------------------------------------- + I have added two new layers: + Navigation_layer.h, Custom_zoom_layer.h + I have updated the doc too. + 1.3.62 - 21/11/2003 ---------------------------------------- We don't have time for ROTATIONS support, so we roll back the diff --git a/Packages/Qt_widget/doc_tex/Qt_widget_ref/Custom_zoom_layer.tex b/Packages/Qt_widget/doc_tex/Qt_widget_ref/Custom_zoom_layer.tex new file mode 100644 index 00000000000..a0d3d915247 --- /dev/null +++ b/Packages/Qt_widget/doc_tex/Qt_widget_ref/Custom_zoom_layer.tex @@ -0,0 +1,45 @@ +% +------------------------------------------------------------------------+ +% | CGAL Reference Manual: Reference manual for Qt_widget.tex +% +------------------------------------------------------------------------+ +% | +% | 03.01.2001 Radu Ursu +% | +% | \RCSdef{\qtwidgetRev}{$Revision$} +% | \RCSdefDate{\qtwidgetDate}{$Date$} +% +------------------------------------------------------------------------+ + +% +-----------------------------------------------------+ +\begin{ccRefClass}{Custom_zoom_layer} + +\ccInclude{CGAL/IO/Custom_zoom_layer.h} + +\ccInheritsFrom +\ccc{Custom_zoom_layer} + +\ccGlue + +\ccCreation +\ccCreationVariable{zoom_layer} +\ccSetTwoColumns{Custom_zoom_layer}{} + +\ccConstructor{Custom_zoom_layer(QObject* parent = 0, const char* name = +0);}{\ccc{parent} is the parent widget and \ccc{name} is the name you +give to this layer.} + +The standard toolbar already provide zooming functionality, but this layer + comes to complete the latest. +When this layer is attached and active, zooming functionality could be used anytime. To zoom in x2 you must press the + key on your keyboard. To zoom +out x2 you must press the - key on your keyboard. You can also use the mouse + to zoom to a region defined by one rectangle. To define the rectangle you +must press Ctrl+LeftMouseButton for the first corner of the rectangle, you +may release, then move, then press Ctrl+LeftMouseButton once again to define +the second corner. + + +\end{ccRefClass} + +% +-----------------------------------------------------+ +% EOF + + + diff --git a/Packages/Qt_widget/doc_tex/Qt_widget_ref/Navigation_layer.tex b/Packages/Qt_widget/doc_tex/Qt_widget_ref/Navigation_layer.tex new file mode 100644 index 00000000000..f667f4b6aa6 --- /dev/null +++ b/Packages/Qt_widget/doc_tex/Qt_widget_ref/Navigation_layer.tex @@ -0,0 +1,47 @@ +% +------------------------------------------------------------------------+ +% | CGAL Reference Manual: Reference manual for Qt_widget.tex +% +------------------------------------------------------------------------+ +% | +% | 03.01.2001 Radu Ursu +% | +% | \RCSdef{\qtwidgetRev}{$Revision$} +% | \RCSdefDate{\qtwidgetDate}{$Date$} +% +------------------------------------------------------------------------+ + +% +-----------------------------------------------------+ +\begin{ccRefClass}{Naviagtion_layer} + +\ccInclude{CGAL/IO/Navigation_layer.h} + +\ccInheritsFrom +\ccc{Qt_widget_layer} + +\ccGlue + +\ccCreation +\ccCreationVariable{nav_layer} +\ccSetTwoColumns{Navigation_layer}{} + +\ccConstructor{Navigation_layer(QObject* parent = 0, const char* name = +0);}{\ccc{parent} is the parent widget and \ccc{name} is the name you +give to this layer.} + +This layer is used to provide basic navigation control over the +\ccc{Qt_widget}. When this layer is attached and active, you may use +the arrows to navigate the equivalent in world coordinates of 10 pixels +in the desired direction. You can also use the PageUp, PageDown keys to +scroll the equivalent in world coordinates of half screenheight on the Y axes. + + +\end{ccRefClass} + +% +-----------------------------------------------------+ +% EOF + + + + + + + + diff --git a/Packages/Qt_widget/doc_tex/Qt_widget_ref/main.tex b/Packages/Qt_widget/doc_tex/Qt_widget_ref/main.tex index 4459da41530..25b74210501 100644 --- a/Packages/Qt_widget/doc_tex/Qt_widget_ref/main.tex +++ b/Packages/Qt_widget/doc_tex/Qt_widget_ref/main.tex @@ -21,6 +21,8 @@ \input{Qt_widget_ref/Qt_widget_get_iso_rectangle.tex} \input{Qt_widget_ref/Qt_widget_get_polygon.tex} \input{Qt_widget_ref/Qt_widget_get_simple_polygon.tex} +\input{Qt_widget_ref/Navigation_layer.tex} +\input{Qt_widget_ref/Custom_zoom_layer.tex} \input{Qt_widget_ref/Standard_toolbar.tex} \input{Qt_widget_ref/Qt_widget_history.tex} \input{Qt_widget_ref/Qt_help_window.tex} diff --git a/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Custom_zoom_layer.tex b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Custom_zoom_layer.tex new file mode 100644 index 00000000000..a0d3d915247 --- /dev/null +++ b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Custom_zoom_layer.tex @@ -0,0 +1,45 @@ +% +------------------------------------------------------------------------+ +% | CGAL Reference Manual: Reference manual for Qt_widget.tex +% +------------------------------------------------------------------------+ +% | +% | 03.01.2001 Radu Ursu +% | +% | \RCSdef{\qtwidgetRev}{$Revision$} +% | \RCSdefDate{\qtwidgetDate}{$Date$} +% +------------------------------------------------------------------------+ + +% +-----------------------------------------------------+ +\begin{ccRefClass}{Custom_zoom_layer} + +\ccInclude{CGAL/IO/Custom_zoom_layer.h} + +\ccInheritsFrom +\ccc{Custom_zoom_layer} + +\ccGlue + +\ccCreation +\ccCreationVariable{zoom_layer} +\ccSetTwoColumns{Custom_zoom_layer}{} + +\ccConstructor{Custom_zoom_layer(QObject* parent = 0, const char* name = +0);}{\ccc{parent} is the parent widget and \ccc{name} is the name you +give to this layer.} + +The standard toolbar already provide zooming functionality, but this layer + comes to complete the latest. +When this layer is attached and active, zooming functionality could be used anytime. To zoom in x2 you must press the + key on your keyboard. To zoom +out x2 you must press the - key on your keyboard. You can also use the mouse + to zoom to a region defined by one rectangle. To define the rectangle you +must press Ctrl+LeftMouseButton for the first corner of the rectangle, you +may release, then move, then press Ctrl+LeftMouseButton once again to define +the second corner. + + +\end{ccRefClass} + +% +-----------------------------------------------------+ +% EOF + + + diff --git a/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Navigation_layer.tex b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Navigation_layer.tex new file mode 100644 index 00000000000..f667f4b6aa6 --- /dev/null +++ b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/Navigation_layer.tex @@ -0,0 +1,47 @@ +% +------------------------------------------------------------------------+ +% | CGAL Reference Manual: Reference manual for Qt_widget.tex +% +------------------------------------------------------------------------+ +% | +% | 03.01.2001 Radu Ursu +% | +% | \RCSdef{\qtwidgetRev}{$Revision$} +% | \RCSdefDate{\qtwidgetDate}{$Date$} +% +------------------------------------------------------------------------+ + +% +-----------------------------------------------------+ +\begin{ccRefClass}{Naviagtion_layer} + +\ccInclude{CGAL/IO/Navigation_layer.h} + +\ccInheritsFrom +\ccc{Qt_widget_layer} + +\ccGlue + +\ccCreation +\ccCreationVariable{nav_layer} +\ccSetTwoColumns{Navigation_layer}{} + +\ccConstructor{Navigation_layer(QObject* parent = 0, const char* name = +0);}{\ccc{parent} is the parent widget and \ccc{name} is the name you +give to this layer.} + +This layer is used to provide basic navigation control over the +\ccc{Qt_widget}. When this layer is attached and active, you may use +the arrows to navigate the equivalent in world coordinates of 10 pixels +in the desired direction. You can also use the PageUp, PageDown keys to +scroll the equivalent in world coordinates of half screenheight on the Y axes. + + +\end{ccRefClass} + +% +-----------------------------------------------------+ +% EOF + + + + + + + + diff --git a/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/main.tex b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/main.tex index 4459da41530..25b74210501 100644 --- a/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/main.tex +++ b/Packages/Qt_widget/doc_tex/support/Qt_widget_ref/main.tex @@ -21,6 +21,8 @@ \input{Qt_widget_ref/Qt_widget_get_iso_rectangle.tex} \input{Qt_widget_ref/Qt_widget_get_polygon.tex} \input{Qt_widget_ref/Qt_widget_get_simple_polygon.tex} +\input{Qt_widget_ref/Navigation_layer.tex} +\input{Qt_widget_ref/Custom_zoom_layer.tex} \input{Qt_widget_ref/Standard_toolbar.tex} \input{Qt_widget_ref/Qt_widget_history.tex} \input{Qt_widget_ref/Qt_help_window.tex} diff --git a/Packages/Qt_widget/include/CGAL/IO/Custom_zoom_layer.h b/Packages/Qt_widget/include/CGAL/IO/Custom_zoom_layer.h new file mode 100644 index 00000000000..0cd8dde9e31 --- /dev/null +++ b/Packages/Qt_widget/include/CGAL/IO/Custom_zoom_layer.h @@ -0,0 +1,81 @@ +// Copyright (c) 1997-2000 Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), +// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg +// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $Source$ +// $Revision$ $Date$ +// $Name$ +// +// Author(s) : Radu Ursu + +#ifndef CGAL_CUSTOM_ZOOM_LAYER_H +#define CGAL_CUSTOM_ZOOM_LAYER_H + +#include + +class Custom_zoom_layer : public CGAL::Qt_widget_zoomrect{ +public: + Custom_zoom_layer(QObject* parent = 0, const char* name = 0) + : Qt_widget_zoomrect(parent, name){} + +protected: + void keyPressEvent(QKeyEvent *e){ + if ( e->key() == Qt::Key_Plus ){ + widget->zoom(2); + } else if ( e->key() == Qt::Key_Minus){ + widget->zoom(0.5); + } + } + void mousePressEvent(QMouseEvent *e) + { + if(e->button() == Qt::LeftButton + && (e->state() & Qt::ControlButton)) + { + if (!on_first){ + first_x = e->x(); + first_y = e->y(); + on_first = true; + } + } + } + void mouseReleaseEvent(QMouseEvent *e) + { + if(e->button() == Qt::LeftButton + && (e->state() & Qt::ControlButton)) + { + if((e->x() != first_x) && (e->y() != first_y)) { + double x, 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;}; + if(y < yfirst2) {ymin = y; ymax = yfirst2;} + else {ymin = yfirst2; ymax = y;}; + widget->set_window(xmin, xmax, ymin, ymax); + on_first = false; + } + } + } + void activating(){ + widget->setFocusPolicy(QWidget::ClickFocus); + oldcursor = widget->cursor(); + widget->setCursor(crossCursor); + } + QCursor oldcursor; +}; + +#endif \ No newline at end of file diff --git a/Packages/Qt_widget/include/CGAL/IO/Navigation_layer.h b/Packages/Qt_widget/include/CGAL/IO/Navigation_layer.h new file mode 100644 index 00000000000..04896c61f11 --- /dev/null +++ b/Packages/Qt_widget/include/CGAL/IO/Navigation_layer.h @@ -0,0 +1,58 @@ +// Copyright (c) 1997-2000 Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), +// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg +// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), +// and Tel-Aviv University (Israel). All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $Source$ +// $Revision$ $Date$ +// $Name$ +// +// Author(s) : Radu Ursu + +#ifndef CGAL_NAVIGATION_LAYER_H +#define CGAL_NAVIGATION_LAYER_H + +#include + +class Navigation_layer : public CGAL::Qt_widget_layer { +public: + Navigation_layer(QObject *parent=0, const char* name=0) + : Qt_widget_layer(parent, name){} + void draw(){}; +protected: + void keyPressEvent(QKeyEvent *e){ + const double dx = widget->x_real(10) - widget->x_real(0); + const double dy = widget->y_real(10) - widget->y_real(0); + const double ypage = widget->y_max() - widget->y_min(); + if ( e->key() == Qt::Key_Left ){ + widget->move_center(dx, 0); + } else if ( e->key() == Qt::Key_Right ){ + widget->move_center(-dx, 0); + } else if ( e->key() == Qt::Key_Down ){ + widget->move_center(0, -dy); + } else if ( e->key() == Qt::Key_Up ){ + widget->move_center(0, dy); + } else if ( e->key() == Qt::Key_Prior ){ //PageUp + widget->move_center(0, -ypage/2); + } else if ( e->key() == Qt::Key_Next ){ //PageDown + widget->move_center(0, ypage/2); + } + } + void activating(){ + widget->setFocusPolicy(QWidget::ClickFocus); + } +}; + +#endif \ No newline at end of file