Remove the using namespace from the impl files

This commit is contained in:
Maxime Gimeno 2018-06-06 16:15:55 +02:00
parent 1969ee9853
commit c4b28fd000
10 changed files with 218 additions and 192 deletions

View File

@ -32,7 +32,8 @@
#include <CGAL/Qt/domUtils.h> #include <CGAL/Qt/domUtils.h>
#include <CGAL/Qt/keyFrameInterpolator.h> #include <CGAL/Qt/keyFrameInterpolator.h>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
/*! Default constructor. /*! Default constructor.
@ -2534,4 +2535,4 @@ void Camera::getFrustum(double frustum[6])
frustum[4] = n; frustum[4] = n;
frustum[5] = f; frustum[5] = f;
} }
}}//end of namespace

View File

@ -31,7 +31,9 @@
#include <CGAL/Qt/manipulatedCameraFrame.h> #include <CGAL/Qt/manipulatedCameraFrame.h>
#include <CGAL/Qt/camera.h> #include <CGAL/Qt/camera.h>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Constraint // // Constraint //
@ -296,3 +298,5 @@ void CameraConstraint::constrainRotation(Quaternion &rotation,
break; break;
} }
} }
}}//end namespace

View File

@ -32,7 +32,9 @@
#include <CGAL/Qt/domUtils.h> #include <CGAL/Qt/domUtils.h>
#include <math.h> #include <math.h>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
/*! Creates a default Frame. /*! Creates a default Frame.
@ -1181,3 +1183,4 @@ void Frame::projectOnLine(const Vec &origin, const Vec &direction) {
proj.projectOnAxis(direction); proj.projectOnAxis(direction);
translate(shift - proj); translate(shift - proj);
} }
}}

View File

@ -29,7 +29,9 @@
#include <CGAL/Qt/keyFrameInterpolator.h> #include <CGAL/Qt/keyFrameInterpolator.h>
#include <CGAL/Qt/domUtils.h> #include <CGAL/Qt/domUtils.h>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
/*! Creates a KeyFrameInterpolator, with \p frame as associated frame(). /*! Creates a KeyFrameInterpolator, with \p frame as associated frame().
@ -579,5 +581,6 @@ void KeyFrameInterpolator::KeyFrame::flipOrientationIfNeeded(
if (Quaternion::dot(prev, q_) < 0.0) if (Quaternion::dot(prev, q_) < 0.0)
q_.negate(); q_.negate();
} }
#endif // DOXYGEN #endif // DOXYGEN
}}

View File

@ -34,7 +34,8 @@
#include <QMouseEvent> #include <QMouseEvent>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
/*! Default constructor. /*! Default constructor.
@ -483,3 +484,5 @@ ManipulatedCameraFrame::pitchYawQuaternion(int x, int y,
camera->screenWidth()); camera->screenWidth());
return rotY * rotX; return rotY * rotX;
} }
}}

View File

@ -36,7 +36,9 @@
#include <QMouseEvent> #include <QMouseEvent>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
/*! Default constructor. /*! Default constructor.
@ -587,3 +589,4 @@ ManipulatedFrame::deformedBallQuaternion(int x, int y, qreal cx, qreal cy,
return Quaternion(axis, angle); return Quaternion(axis, angle);
} }
#endif // DOXYGEN #endif // DOXYGEN
}}

View File

@ -29,7 +29,9 @@
#include <CGAL/Qt/mouseGrabber.h> #include <CGAL/Qt/mouseGrabber.h>
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
// Static private variable // Static private variable
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
@ -91,3 +93,4 @@ void MouseGrabber::clearMouseGrabberPool(bool autoDelete) {
qDeleteAll(MouseGrabber::MouseGrabberPool()); qDeleteAll(MouseGrabber::MouseGrabberPool());
MouseGrabber::MouseGrabberPool().clear(); MouseGrabber::MouseGrabberPool().clear();
} }
}}

View File

@ -55,8 +55,7 @@
#include <QOpenGLFramebufferObject> #include <QOpenGLFramebufferObject>
#include <QFileDialog> #include <QFileDialog>
using namespace CGAL::qglviewer; namespace CGAL{
// Static private variable // Static private variable
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
QList<CGAL::QGLViewer *> &CGAL::QGLViewer::QGLViewerPool() { QList<CGAL::QGLViewer *> &CGAL::QGLViewer::QGLViewerPool() {
@ -100,7 +99,7 @@ void CGAL::QGLViewer::defaultConstructor() {
CGAL::QGLViewer::QGLViewerPool().replace(poolIndex, this); CGAL::QGLViewer::QGLViewerPool().replace(poolIndex, this);
else else
CGAL::QGLViewer::QGLViewerPool().append(this); CGAL::QGLViewer::QGLViewerPool().append(this);
camera_ = new Camera(this); camera_ = new qglviewer::Camera(this);
setCamera(camera()); setCamera(camera());
setDefaultShortcuts(); setDefaultShortcuts();
@ -575,58 +574,58 @@ void CGAL::QGLViewer::setCameraIsEdited(bool edit) {
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setDefaultShortcuts() { void CGAL::QGLViewer::setDefaultShortcuts() {
// D e f a u l t a c c e l e r a t o r s // D e f a u l t a c c e l e r a t o r s
setShortcut(DRAW_AXIS, ::Qt::Key_A); setShortcut(qglviewer::DRAW_AXIS, ::Qt::Key_A);
setShortcut(DRAW_GRID, ::Qt::Key_G); setShortcut(qglviewer::DRAW_GRID, ::Qt::Key_G);
setShortcut(DISPLAY_FPS, ::Qt::Key_F); setShortcut(qglviewer::DISPLAY_FPS, ::Qt::Key_F);
setShortcut(ENABLE_TEXT, ::Qt::SHIFT + ::Qt::Key_Question); setShortcut(qglviewer::ENABLE_TEXT, ::Qt::SHIFT + ::Qt::Key_Question);
setShortcut(EXIT_VIEWER, ::Qt::Key_Escape); setShortcut(qglviewer::EXIT_VIEWER, ::Qt::Key_Escape);
setShortcut(CAMERA_MODE, ::Qt::Key_Space); setShortcut(qglviewer::CAMERA_MODE, ::Qt::Key_Space);
setShortcut(FULL_SCREEN, ::Qt::ALT + ::Qt::Key_Return); setShortcut(qglviewer::FULL_SCREEN, ::Qt::ALT + ::Qt::Key_Return);
setShortcut(STEREO, ::Qt::Key_S); setShortcut(qglviewer::STEREO, ::Qt::Key_S);
setShortcut(ANIMATION, ::Qt::Key_Return); setShortcut(qglviewer::ANIMATION, ::Qt::Key_Return);
setShortcut(HELP, ::Qt::Key_H); setShortcut(qglviewer::HELP, ::Qt::Key_H);
setShortcut(EDIT_CAMERA, ::Qt::Key_C); setShortcut(qglviewer::EDIT_CAMERA, ::Qt::Key_C);
setShortcut(MOVE_CAMERA_LEFT, ::Qt::Key_Left); setShortcut(qglviewer::MOVE_CAMERA_LEFT, ::Qt::Key_Left);
setShortcut(MOVE_CAMERA_RIGHT, ::Qt::Key_Right); setShortcut(qglviewer::MOVE_CAMERA_RIGHT, ::Qt::Key_Right);
setShortcut(MOVE_CAMERA_UP, ::Qt::Key_Up); setShortcut(qglviewer::MOVE_CAMERA_UP, ::Qt::Key_Up);
setShortcut(MOVE_CAMERA_DOWN, ::Qt::Key_Down); setShortcut(qglviewer::MOVE_CAMERA_DOWN, ::Qt::Key_Down);
setShortcut(INCREASE_FLYSPEED, ::Qt::Key_Plus); setShortcut(qglviewer::INCREASE_FLYSPEED, ::Qt::Key_Plus);
setShortcut(DECREASE_FLYSPEED, ::Qt::Key_Minus); setShortcut(qglviewer::DECREASE_FLYSPEED, ::Qt::Key_Minus);
keyboardActionDescription_[DISPLAY_FPS] = keyboardActionDescription_[qglviewer::DISPLAY_FPS] =
tr("Toggles the display of the FPS", "DISPLAY_FPS action description"); tr("Toggles the display of the FPS", "DISPLAY_FPS action description");
keyboardActionDescription_[FULL_SCREEN] = keyboardActionDescription_[qglviewer::FULL_SCREEN] =
tr("Toggles full screen display", "FULL_SCREEN action description"); tr("Toggles full screen display", "FULL_SCREEN action description");
keyboardActionDescription_[DRAW_AXIS] = tr( keyboardActionDescription_[qglviewer::DRAW_AXIS] = tr(
"Toggles the display of the world axis", "DRAW_AXIS action description"); "Toggles the display of the world axis", "DRAW_AXIS action description");
keyboardActionDescription_[DRAW_GRID] = keyboardActionDescription_[qglviewer::DRAW_GRID] =
tr("Toggles the display of the XY grid", "DRAW_GRID action description"); tr("Toggles the display of the XY grid", "DRAW_GRID action description");
keyboardActionDescription_[CAMERA_MODE] = tr( keyboardActionDescription_[qglviewer::CAMERA_MODE] = tr(
"Changes camera mode (observe or fly)", "CAMERA_MODE action description"); "Changes camera mode (observe or fly)", "CAMERA_MODE action description");
keyboardActionDescription_[STEREO] = keyboardActionDescription_[qglviewer::STEREO] =
tr("Toggles stereo display", "STEREO action description"); tr("Toggles stereo display", "STEREO action description");
keyboardActionDescription_[HELP] = keyboardActionDescription_[qglviewer::HELP] =
tr("Opens this help window", "HELP action description"); tr("Opens this help window", "HELP action description");
keyboardActionDescription_[ANIMATION] = keyboardActionDescription_[qglviewer::ANIMATION] =
tr("Starts/stops the animation", "ANIMATION action description"); tr("Starts/stops the animation", "ANIMATION action description");
keyboardActionDescription_[EDIT_CAMERA] = keyboardActionDescription_[qglviewer::EDIT_CAMERA] =
tr("Toggles camera paths display", tr("Toggles camera paths display",
"EDIT_CAMERA action description"); // TODO change "EDIT_CAMERA action description"); // TODO change
keyboardActionDescription_[ENABLE_TEXT] = keyboardActionDescription_[qglviewer::ENABLE_TEXT] =
tr("Toggles the display of the text", "ENABLE_TEXT action description"); tr("Toggles the display of the text", "ENABLE_TEXT action description");
keyboardActionDescription_[EXIT_VIEWER] = keyboardActionDescription_[qglviewer::EXIT_VIEWER] =
tr("Exits program", "EXIT_VIEWER action description"); tr("Exits program", "EXIT_VIEWER action description");
keyboardActionDescription_[MOVE_CAMERA_LEFT] = keyboardActionDescription_[qglviewer::MOVE_CAMERA_LEFT] =
tr("Moves camera left", "MOVE_CAMERA_LEFT action description"); tr("Moves camera left", "MOVE_CAMERA_LEFT action description");
keyboardActionDescription_[MOVE_CAMERA_RIGHT] = keyboardActionDescription_[qglviewer::MOVE_CAMERA_RIGHT] =
tr("Moves camera right", "MOVE_CAMERA_RIGHT action description"); tr("Moves camera right", "MOVE_CAMERA_RIGHT action description");
keyboardActionDescription_[MOVE_CAMERA_UP] = keyboardActionDescription_[qglviewer::MOVE_CAMERA_UP] =
tr("Moves camera up", "MOVE_CAMERA_UP action description"); tr("Moves camera up", "MOVE_CAMERA_UP action description");
keyboardActionDescription_[MOVE_CAMERA_DOWN] = keyboardActionDescription_[qglviewer::MOVE_CAMERA_DOWN] =
tr("Moves camera down", "MOVE_CAMERA_DOWN action description"); tr("Moves camera down", "MOVE_CAMERA_DOWN action description");
keyboardActionDescription_[INCREASE_FLYSPEED] = keyboardActionDescription_[qglviewer::INCREASE_FLYSPEED] =
tr("Increases fly speed", "INCREASE_FLYSPEED action description"); tr("Increases fly speed", "INCREASE_FLYSPEED action description");
keyboardActionDescription_[DECREASE_FLYSPEED] = keyboardActionDescription_[qglviewer::DECREASE_FLYSPEED] =
tr("Decreases fly speed", "DECREASE_FLYSPEED action description"); tr("Decreases fly speed", "DECREASE_FLYSPEED action description");
// K e y f r a m e s s h o r t c u t k e y s // K e y f r a m e s s h o r t c u t k e y s
@ -655,38 +654,38 @@ void CGAL::QGLViewer::setDefaultMouseBindings() {
//#CONNECTION# toggleCameraMode() //#CONNECTION# toggleCameraMode()
for (int handler = 0; handler < 2; ++handler) { for (int handler = 0; handler < 2; ++handler) {
MouseHandler mh = (MouseHandler)(handler); qglviewer::MouseHandler mh = (qglviewer::MouseHandler)(handler);
::Qt::KeyboardModifiers modifiers = ::Qt::KeyboardModifiers modifiers =
(mh == FRAME) ? frameKeyboardModifiers : cameraKeyboardModifiers; (mh == qglviewer::FRAME) ? frameKeyboardModifiers : cameraKeyboardModifiers;
setMouseBinding(modifiers, ::Qt::LeftButton, mh, ROTATE); setMouseBinding(modifiers, ::Qt::LeftButton, mh, qglviewer::ROTATE);
setMouseBinding(modifiers, ::Qt::MidButton, mh, ZOOM); setMouseBinding(modifiers, ::Qt::MidButton, mh, qglviewer::ZOOM);
setMouseBinding(modifiers, ::Qt::RightButton, mh, TRANSLATE); setMouseBinding(modifiers, ::Qt::RightButton, mh, qglviewer::TRANSLATE);
setMouseBinding(::Qt::Key_R, modifiers, ::Qt::LeftButton, mh, SCREEN_ROTATE); setMouseBinding(::Qt::Key_R, modifiers, ::Qt::LeftButton, mh, qglviewer::SCREEN_ROTATE);
setWheelBinding(modifiers, mh, ZOOM); setWheelBinding(modifiers, mh, qglviewer::ZOOM);
} }
// Z o o m o n r e g i o n // Z o o m o n r e g i o n
setMouseBinding(::Qt::ShiftModifier, ::Qt::MidButton, CAMERA, ZOOM_ON_REGION); setMouseBinding(::Qt::ShiftModifier, ::Qt::MidButton, qglviewer::CAMERA, qglviewer::ZOOM_ON_REGION);
// S e l e c t // S e l e c t
setMouseBinding(::Qt::ShiftModifier, ::Qt::LeftButton, SELECT); setMouseBinding(::Qt::ShiftModifier, ::Qt::LeftButton, qglviewer::SELECT);
setMouseBinding(::Qt::ShiftModifier, ::Qt::RightButton, RAP_FROM_PIXEL); setMouseBinding(::Qt::ShiftModifier, ::Qt::RightButton, qglviewer::RAP_FROM_PIXEL);
// D o u b l e c l i c k // D o u b l e c l i c k
setMouseBinding(::Qt::NoModifier, ::Qt::LeftButton, ALIGN_CAMERA, true); setMouseBinding(::Qt::NoModifier, ::Qt::LeftButton, qglviewer::ALIGN_CAMERA, true);
setMouseBinding(::Qt::NoModifier, ::Qt::MidButton, SHOW_ENTIRE_SCENE, true); setMouseBinding(::Qt::NoModifier, ::Qt::MidButton, qglviewer::SHOW_ENTIRE_SCENE, true);
setMouseBinding(::Qt::NoModifier, ::Qt::RightButton, CENTER_SCENE, true); setMouseBinding(::Qt::NoModifier, ::Qt::RightButton, qglviewer::CENTER_SCENE, true);
setMouseBinding(frameKeyboardModifiers, ::Qt::LeftButton, ALIGN_FRAME, true); setMouseBinding(frameKeyboardModifiers, ::Qt::LeftButton, qglviewer::ALIGN_FRAME, true);
// middle double click makes no sense for manipulated frame // middle double click makes no sense for manipulated frame
setMouseBinding(frameKeyboardModifiers, ::Qt::RightButton, CENTER_FRAME, true); setMouseBinding(frameKeyboardModifiers, ::Qt::RightButton, qglviewer::CENTER_FRAME, true);
// A c t i o n s w i t h k e y m o d i f i e r s // A c t i o n s w i t h k e y m o d i f i e r s
setMouseBinding(::Qt::Key_Z, ::Qt::NoModifier, ::Qt::LeftButton, ZOOM_ON_PIXEL); setMouseBinding(::Qt::Key_Z, ::Qt::NoModifier, ::Qt::LeftButton, qglviewer::ZOOM_ON_PIXEL);
setMouseBinding(::Qt::Key_Z, ::Qt::NoModifier, ::Qt::RightButton, ZOOM_TO_FIT); setMouseBinding(::Qt::Key_Z, ::Qt::NoModifier, ::Qt::RightButton, qglviewer::ZOOM_TO_FIT);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// Specific Mac bindings for touchpads. Two fingers emulate a wheelEvent which // Specific Mac bindings for touchpads. Two fingers emulate a wheelEvent which
@ -696,12 +695,12 @@ void CGAL::QGLViewer::setDefaultMouseBindings() {
// override previous settings. // override previous settings.
const ::Qt::KeyboardModifiers macKeyboardModifiers = ::Qt::AltModifier; const ::Qt::KeyboardModifiers macKeyboardModifiers = ::Qt::AltModifier;
setMouseBinding(macKeyboardModifiers, ::Qt::LeftButton, CAMERA, TRANSLATE); setMouseBinding(macKeyboardModifiers, ::Qt::LeftButton, qglviewer::CAMERA, qglviewer::TRANSLATE);
setMouseBinding(macKeyboardModifiers, ::Qt::LeftButton, CENTER_SCENE, true); setMouseBinding(macKeyboardModifiers, ::Qt::LeftButton, qglviewer::CENTER_SCENE, true);
setMouseBinding(frameKeyboardModifiers | macKeyboardModifiers, ::Qt::LeftButton, setMouseBinding(frameKeyboardModifiers | macKeyboardModifiers, ::Qt::LeftButton,
CENTER_FRAME, true); qglviewer::CENTER_FRAME, true);
setMouseBinding(frameKeyboardModifiers | macKeyboardModifiers, ::Qt::LeftButton, setMouseBinding(frameKeyboardModifiers | macKeyboardModifiers, ::Qt::LeftButton,
FRAME, TRANSLATE); qglviewer::FRAME, qglviewer::TRANSLATE);
#endif #endif
} }
@ -727,7 +726,7 @@ CGAL::qglviewer::KeyFrameInterpolator::interpolated() signals are connected to t
viewer update() slot. The connections with the previous viewer's camera are viewer update() slot. The connections with the previous viewer's camera are
removed. */ removed. */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setCamera(Camera *const camera) { void CGAL::QGLViewer::setCamera(qglviewer::Camera *const camera) {
if (!camera) if (!camera)
return; return;
@ -753,7 +752,7 @@ void CGAL::QGLViewer::setCamera(Camera *const camera) {
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::connectAllCameraKFIInterpolatedSignals(bool connection) { void CGAL::QGLViewer::connectAllCameraKFIInterpolatedSignals(bool connection) {
for (QMap<unsigned int, KeyFrameInterpolator *>::ConstIterator for (QMap<unsigned int, qglviewer::KeyFrameInterpolator *>::ConstIterator
it = camera()->kfi_.begin(), it = camera()->kfi_.begin(),
end = camera()->kfi_.end(); end = camera()->kfi_.end();
it != end; ++it) { it != end; ++it) {
@ -812,7 +811,7 @@ void CGAL::QGLViewer::renderText(int x, int y, const QString &str,
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::renderText(double x, double y, double z, const QString &str, void CGAL::QGLViewer::renderText(double x, double y, double z, const QString &str,
const QFont &font) { const QFont &font) {
const Vec proj = camera_->projectedCoordinatesOf(Vec(x, y, z)); const qglviewer::Vec proj = camera_->projectedCoordinatesOf(qglviewer::Vec(x, y, z));
renderText(proj.x, proj.y, str, font); renderText(proj.x, proj.y, str, font);
} }
#endif #endif
@ -1157,52 +1156,52 @@ static QString mouseButtonsString(::Qt::MouseButtons b) {
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::performClickAction(ClickAction ca, const QMouseEvent *const e) { void CGAL::QGLViewer::performClickAction(qglviewer::ClickAction ca, const QMouseEvent *const e) {
// Note: action that need it should call update(). // Note: action that need it should call update().
switch (ca) { switch (ca) {
// # CONNECTION setMouseBinding prevents adding NO_CLICK_ACTION in // # CONNECTION setMouseBinding prevents adding NO_CLICK_ACTION in
// clickBinding_ This case should hence not be possible. Prevents unused case // clickBinding_ This case should hence not be possible. Prevents unused case
// warning. // warning.
case NO_CLICK_ACTION: case qglviewer::NO_CLICK_ACTION:
break; break;
case ZOOM_ON_PIXEL: case qglviewer::ZOOM_ON_PIXEL:
camera()->interpolateToZoomOnPixel(e->pos()); camera()->interpolateToZoomOnPixel(e->pos());
break; break;
case ZOOM_TO_FIT: case qglviewer::ZOOM_TO_FIT:
camera()->interpolateToFitScene(); camera()->interpolateToFitScene();
break; break;
case SELECT: case qglviewer::SELECT:
select(e); select(e);
update(); update();
break; break;
case RAP_FROM_PIXEL: case qglviewer::RAP_FROM_PIXEL:
if (!camera()->setPivotPointFromPixel(e->pos())) if (!camera()->setPivotPointFromPixel(e->pos()))
camera()->setPivotPoint(sceneCenter()); camera()->setPivotPoint(sceneCenter());
setVisualHintsMask(1); setVisualHintsMask(1);
update(); update();
break; break;
case RAP_IS_CENTER: case qglviewer::RAP_IS_CENTER:
camera()->setPivotPoint(sceneCenter()); camera()->setPivotPoint(sceneCenter());
setVisualHintsMask(1); setVisualHintsMask(1);
update(); update();
break; break;
case CENTER_FRAME: case qglviewer::CENTER_FRAME:
if (manipulatedFrame()) if (manipulatedFrame())
manipulatedFrame()->projectOnLine(camera()->position(), manipulatedFrame()->projectOnLine(camera()->position(),
camera()->viewDirection()); camera()->viewDirection());
break; break;
case CENTER_SCENE: case qglviewer::CENTER_SCENE:
camera()->centerScene(); camera()->centerScene();
break; break;
case SHOW_ENTIRE_SCENE: case qglviewer::SHOW_ENTIRE_SCENE:
camera()->showEntireScene(); camera()->showEntireScene();
break; break;
case ALIGN_FRAME: case qglviewer::ALIGN_FRAME:
if (manipulatedFrame()) if (manipulatedFrame())
manipulatedFrame()->alignWithFrame(camera()->frame()); manipulatedFrame()->alignWithFrame(camera()->frame());
break; break;
case ALIGN_CAMERA: case qglviewer::ALIGN_CAMERA:
Frame *frame = new Frame(); qglviewer::Frame *frame = new qglviewer::Frame();
frame->setTranslation(camera()->pivotPoint()); frame->setTranslation(camera()->pivotPoint());
camera()->frame()->alignWithFrame(frame, true); camera()->frame()->alignWithFrame(frame, true);
delete frame; delete frame;
@ -1244,13 +1243,13 @@ void CGAL::QGLViewer::mousePressEvent(QMouseEvent *e) {
it = mouseBinding_.begin(), it = mouseBinding_.begin(),
end = mouseBinding_.end(); end = mouseBinding_.end();
it != end; ++it) it != end; ++it)
if ((it.value().handler == FRAME) && (it.key().button == e->button())) { if ((it.value().handler == qglviewer::FRAME) && (it.key().button == e->button())) {
ManipulatedFrame *mf = qglviewer::ManipulatedFrame *mf =
dynamic_cast<ManipulatedFrame *>(mouseGrabber()); dynamic_cast<qglviewer::ManipulatedFrame *>(mouseGrabber());
if (mouseGrabberIsAManipulatedCameraFrame_) { if (mouseGrabberIsAManipulatedCameraFrame_) {
mf->ManipulatedFrame::startAction(it.value().action, mf->qglviewer::ManipulatedFrame::startAction(it.value().action,
it.value().withConstraint); it.value().withConstraint);
mf->ManipulatedFrame::mousePressEvent(e, camera()); mf->qglviewer::ManipulatedFrame::mousePressEvent(e, camera());
} else { } else {
mf->startAction(it.value().action, it.value().withConstraint); mf->startAction(it.value().action, it.value().withConstraint);
mf->mousePressEvent(e, camera()); mf->mousePressEvent(e, camera());
@ -1268,11 +1267,11 @@ void CGAL::QGLViewer::mousePressEvent(QMouseEvent *e) {
if (mouseBinding_.contains(mbp)) { if (mouseBinding_.contains(mbp)) {
MouseActionPrivate map = mouseBinding_[mbp]; MouseActionPrivate map = mouseBinding_[mbp];
switch (map.handler) { switch (map.handler) {
case CAMERA: case qglviewer::CAMERA:
camera()->frame()->startAction(map.action, map.withConstraint); camera()->frame()->startAction(map.action, map.withConstraint);
camera()->frame()->mousePressEvent(e, camera()); camera()->frame()->mousePressEvent(e, camera());
break; break;
case FRAME: case qglviewer::FRAME:
if (manipulatedFrame()) { if (manipulatedFrame()) {
if (manipulatedFrameIsACamera_) { if (manipulatedFrameIsACamera_) {
manipulatedFrame()->ManipulatedFrame::startAction( manipulatedFrame()->ManipulatedFrame::startAction(
@ -1285,7 +1284,7 @@ void CGAL::QGLViewer::mousePressEvent(QMouseEvent *e) {
} }
break; break;
} }
if (map.action == SCREEN_ROTATE) if (map.action == qglviewer::SCREEN_ROTATE)
// Display visual hint line // Display visual hint line
update(); update();
} else } else
@ -1334,8 +1333,8 @@ void CGAL::QGLViewer::mouseMoveEvent(QMouseEvent *e) {
mouseGrabber()->checkIfGrabsMouse(e->x(), e->y(), camera()); mouseGrabber()->checkIfGrabsMouse(e->x(), e->y(), camera());
if (mouseGrabber()->grabsMouse()) if (mouseGrabber()->grabsMouse())
if (mouseGrabberIsAManipulatedCameraFrame_) if (mouseGrabberIsAManipulatedCameraFrame_)
(dynamic_cast<ManipulatedFrame *>(mouseGrabber())) (dynamic_cast<qglviewer::ManipulatedFrame *>(mouseGrabber()))
->ManipulatedFrame::mouseMoveEvent(e, camera()); ->qglviewer::ManipulatedFrame::mouseMoveEvent(e, camera());
else else
mouseGrabber()->mouseMoveEvent(e, camera()); mouseGrabber()->mouseMoveEvent(e, camera());
else else
@ -1349,7 +1348,7 @@ void CGAL::QGLViewer::mouseMoveEvent(QMouseEvent *e) {
camera()->frame()->mouseMoveEvent(e, camera()); camera()->frame()->mouseMoveEvent(e, camera());
// #CONNECTION# manipulatedCameraFrame::mouseMoveEvent specific if at the // #CONNECTION# manipulatedCameraFrame::mouseMoveEvent specific if at the
// beginning // beginning
if (camera()->frame()->action_ == ZOOM_ON_REGION) if (camera()->frame()->action_ == qglviewer::ZOOM_ON_REGION)
update(); update();
} else // ! } else // !
if ((manipulatedFrame()) && (manipulatedFrame()->isManipulated())) if ((manipulatedFrame()) && (manipulatedFrame()->isManipulated()))
@ -1358,7 +1357,7 @@ void CGAL::QGLViewer::mouseMoveEvent(QMouseEvent *e) {
else else
manipulatedFrame()->mouseMoveEvent(e, camera()); manipulatedFrame()->mouseMoveEvent(e, camera());
else if (hasMouseTracking()) { else if (hasMouseTracking()) {
Q_FOREACH (MouseGrabber *mg, MouseGrabber::MouseGrabberPool()) { Q_FOREACH (qglviewer::MouseGrabber *mg, qglviewer::MouseGrabber::MouseGrabberPool()) {
mg->checkIfGrabsMouse(e->x(), e->y(), camera()); mg->checkIfGrabsMouse(e->x(), e->y(), camera());
if (mg->grabsMouse()) { if (mg->grabsMouse()) {
setMouseGrabber(mg); setMouseGrabber(mg);
@ -1384,8 +1383,8 @@ CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::mouseReleaseEvent(QMouseEvent *e) { void CGAL::QGLViewer::mouseReleaseEvent(QMouseEvent *e) {
if (mouseGrabber()) { if (mouseGrabber()) {
if (mouseGrabberIsAManipulatedCameraFrame_) if (mouseGrabberIsAManipulatedCameraFrame_)
(dynamic_cast<ManipulatedFrame *>(mouseGrabber())) (dynamic_cast<qglviewer::ManipulatedFrame *>(mouseGrabber()))
->ManipulatedFrame::mouseReleaseEvent(e, camera()); ->qglviewer::ManipulatedFrame::mouseReleaseEvent(e, camera());
else else
mouseGrabber()->mouseReleaseEvent(e, camera()); mouseGrabber()->mouseReleaseEvent(e, camera());
mouseGrabber()->checkIfGrabsMouse(e->x(), e->y(), camera()); mouseGrabber()->checkIfGrabsMouse(e->x(), e->y(), camera());
@ -1421,13 +1420,13 @@ void CGAL::QGLViewer::wheelEvent(QWheelEvent *e) {
it = wheelBinding_.begin(), it = wheelBinding_.begin(),
end = wheelBinding_.end(); end = wheelBinding_.end();
it != end; ++it) it != end; ++it)
if (it.value().handler == FRAME) { if (it.value().handler == qglviewer::FRAME) {
ManipulatedFrame *mf = qglviewer::ManipulatedFrame *mf =
dynamic_cast<ManipulatedFrame *>(mouseGrabber()); dynamic_cast<qglviewer::ManipulatedFrame *>(mouseGrabber());
if (mouseGrabberIsAManipulatedCameraFrame_) { if (mouseGrabberIsAManipulatedCameraFrame_) {
mf->ManipulatedFrame::startAction(it.value().action, mf->qglviewer::ManipulatedFrame::startAction(it.value().action,
it.value().withConstraint); it.value().withConstraint);
mf->ManipulatedFrame::wheelEvent(e, camera()); mf->qglviewer::ManipulatedFrame::wheelEvent(e, camera());
} else { } else {
mf->startAction(it.value().action, it.value().withConstraint); mf->startAction(it.value().action, it.value().withConstraint);
mf->wheelEvent(e, camera()); mf->wheelEvent(e, camera());
@ -1444,11 +1443,11 @@ void CGAL::QGLViewer::wheelEvent(QWheelEvent *e) {
if (wheelBinding_.contains(wbp)) { if (wheelBinding_.contains(wbp)) {
MouseActionPrivate map = wheelBinding_[wbp]; MouseActionPrivate map = wheelBinding_[wbp];
switch (map.handler) { switch (map.handler) {
case CAMERA: case qglviewer::CAMERA:
camera()->frame()->startAction(map.action, map.withConstraint); camera()->frame()->startAction(map.action, map.withConstraint);
camera()->frame()->wheelEvent(e, camera()); camera()->frame()->wheelEvent(e, camera());
break; break;
case FRAME: case qglviewer::FRAME:
if (manipulatedFrame()) { if (manipulatedFrame()) {
if (manipulatedFrameIsACamera_) { if (manipulatedFrameIsACamera_) {
manipulatedFrame()->ManipulatedFrame::startAction( manipulatedFrame()->ManipulatedFrame::startAction(
@ -1544,16 +1543,16 @@ CGAL::qglviewer::MouseGrabber::checkIfGrabsMouse() test performed by mouseMoveEv
If the MouseGrabber is disabled (see mouseGrabberIsEnabled()), this method If the MouseGrabber is disabled (see mouseGrabberIsEnabled()), this method
silently does nothing. */ silently does nothing. */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setMouseGrabber(MouseGrabber *mouseGrabber) { void CGAL::QGLViewer::setMouseGrabber(qglviewer::MouseGrabber *mouseGrabber) {
if (!mouseGrabberIsEnabled(mouseGrabber)) if (!mouseGrabberIsEnabled(mouseGrabber))
return; return;
mouseGrabber_ = mouseGrabber; mouseGrabber_ = mouseGrabber;
mouseGrabberIsAManipulatedFrame_ = mouseGrabberIsAManipulatedFrame_ =
(dynamic_cast<ManipulatedFrame *>(mouseGrabber) != NULL); (dynamic_cast<qglviewer::ManipulatedFrame *>(mouseGrabber) != NULL);
mouseGrabberIsAManipulatedCameraFrame_ = mouseGrabberIsAManipulatedCameraFrame_ =
((dynamic_cast<ManipulatedCameraFrame *>(mouseGrabber) != NULL) && ((dynamic_cast<qglviewer::ManipulatedCameraFrame *>(mouseGrabber) != NULL) &&
(mouseGrabber != camera()->frame())); (mouseGrabber != camera()->frame()));
Q_EMIT mouseGrabberChanged(mouseGrabber); Q_EMIT mouseGrabberChanged(mouseGrabber);
} }
@ -1569,7 +1568,7 @@ void CGAL::QGLViewer::setMouseGrabberIsEnabled(
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
QString CGAL::QGLViewer::mouseActionString(MouseAction ma) { QString CGAL::QGLViewer::mouseActionString(qglviewer::MouseAction ma) {
switch (ma) { switch (ma) {
case CGAL::qglviewer::NO_MOUSE_ACTION: case CGAL::qglviewer::NO_MOUSE_ACTION:
return QString::null; return QString::null;
@ -1828,10 +1827,10 @@ QString CGAL::QGLViewer::mouseString() const {
if (!text.isNull()) { if (!text.isNull()) {
switch (itmb.value().handler) { switch (itmb.value().handler) {
case CAMERA: case qglviewer::CAMERA:
text += " " + tr("camera", "Suffix after action"); text += " " + tr("camera", "Suffix after action");
break; break;
case FRAME: case qglviewer::FRAME:
text += " " + tr("manipulated frame", "Suffix after action"); text += " " + tr("manipulated frame", "Suffix after action");
break; break;
} }
@ -1852,10 +1851,10 @@ QString CGAL::QGLViewer::mouseString() const {
if (!text.isNull()) { if (!text.isNull()) {
switch (itw.value().handler) { switch (itw.value().handler) {
case CAMERA: case qglviewer::CAMERA:
text += " " + tr("camera", "Suffix after action"); text += " " + tr("camera", "Suffix after action");
break; break;
case FRAME: case qglviewer::FRAME:
text += " " + tr("manipulated frame", "Suffix after action"); text += " " + tr("manipulated frame", "Suffix after action");
break; break;
} }
@ -1866,7 +1865,7 @@ QString CGAL::QGLViewer::mouseString() const {
mouseBinding[cbp] = text; mouseBinding[cbp] = text;
} }
for (QMap<ClickBindingPrivate, ClickAction>::ConstIterator for (QMap<ClickBindingPrivate, qglviewer::ClickAction>::ConstIterator
itcb = clickBinding_.begin(), itcb = clickBinding_.begin(),
endcb = clickBinding_.end(); endcb = clickBinding_.end();
itcb != endcb; ++itcb) itcb != endcb; ++itcb)
@ -2017,13 +2016,13 @@ QString CGAL::QGLViewer::keyboardString() const {
} }
// 3 - KeyboardAction bindings description // 3 - KeyboardAction bindings description
for (QMap<KeyboardAction, unsigned int>::ConstIterator for (QMap<qglviewer::KeyboardAction, unsigned int>::ConstIterator
it = keyboardBinding_.begin(), it = keyboardBinding_.begin(),
end = keyboardBinding_.end(); end = keyboardBinding_.end();
it != end; ++it) it != end; ++it)
if ((it.value() != 0) && if ((it.value() != 0) &&
((!cameraIsInRotateMode()) || ((!cameraIsInRotateMode()) ||
((it.key() != INCREASE_FLYSPEED) && (it.key() != DECREASE_FLYSPEED)))) ((it.key() != qglviewer::INCREASE_FLYSPEED) && (it.key() != qglviewer::DECREASE_FLYSPEED))))
keyDescription[it.value()] = keyboardActionDescription_[it.key()]; keyDescription[it.value()] = keyboardActionDescription_[it.key()];
// Add to text in sorted order // Add to text in sorted order
@ -2191,7 +2190,7 @@ void CGAL::QGLViewer::keyPressEvent(QKeyEvent *e) {
const ::Qt::KeyboardModifiers modifiers = e->modifiers(); const ::Qt::KeyboardModifiers modifiers = e->modifiers();
QMap<KeyboardAction, unsigned int>::ConstIterator it = keyboardBinding_ QMap<qglviewer::KeyboardAction, unsigned int>::ConstIterator it = keyboardBinding_
.begin(), .begin(),
end = end =
keyboardBinding_.end(); keyboardBinding_.end();
@ -2215,7 +2214,7 @@ void CGAL::QGLViewer::keyPressEvent(QKeyEvent *e) {
else { else {
// Stop previous interpolation before starting a new one. // Stop previous interpolation before starting a new one.
if (index != previousPathId_) { if (index != previousPathId_) {
KeyFrameInterpolator *previous = qglviewer::KeyFrameInterpolator *previous =
camera()->keyFrameInterpolator(previousPathId_); camera()->keyFrameInterpolator(previousPathId_);
if ((previous) && (previous->interpolationIsStarted())) if ((previous) && (previous->interpolationIsStarted()))
previous->resetInterpolation(); previous->resetInterpolation();
@ -2269,71 +2268,71 @@ void CGAL::QGLViewer::keyReleaseEvent(QKeyEvent *e) {
} }
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::handleKeyboardAction(KeyboardAction id) { void CGAL::QGLViewer::handleKeyboardAction(qglviewer::KeyboardAction id) {
switch (id) { switch (id) {
case DRAW_AXIS: case qglviewer::DRAW_AXIS:
toggleAxisIsDrawn(); toggleAxisIsDrawn();
break; break;
case DRAW_GRID: case qglviewer::DRAW_GRID:
toggleGridIsDrawn(); toggleGridIsDrawn();
break; break;
case DISPLAY_FPS: case qglviewer::DISPLAY_FPS:
toggleFPSIsDisplayed(); toggleFPSIsDisplayed();
break; break;
case ENABLE_TEXT: case qglviewer::ENABLE_TEXT:
toggleTextIsEnabled(); toggleTextIsEnabled();
break; break;
case EXIT_VIEWER: case qglviewer::EXIT_VIEWER:
saveStateToFileForAllViewers(); saveStateToFileForAllViewers();
qApp->closeAllWindows(); qApp->closeAllWindows();
break; break;
case FULL_SCREEN: case qglviewer::FULL_SCREEN:
toggleFullScreen(); toggleFullScreen();
break; break;
case STEREO: case qglviewer::STEREO:
toggleStereoDisplay(); toggleStereoDisplay();
break; break;
case ANIMATION: case qglviewer::ANIMATION:
toggleAnimation(); toggleAnimation();
break; break;
case HELP: case qglviewer::HELP:
help(); help();
break; break;
case EDIT_CAMERA: case qglviewer::EDIT_CAMERA:
toggleCameraIsEdited(); toggleCameraIsEdited();
break; break;
case CAMERA_MODE: case qglviewer::CAMERA_MODE:
toggleCameraMode(); toggleCameraMode();
displayMessage(cameraIsInRotateMode() displayMessage(cameraIsInRotateMode()
? tr("Camera in observer mode", "Feedback message") ? tr("Camera in observer mode", "Feedback message")
: tr("Camera in fly mode", "Feedback message")); : tr("Camera in fly mode", "Feedback message"));
break; break;
case MOVE_CAMERA_LEFT: case qglviewer::MOVE_CAMERA_LEFT:
camera()->frame()->translate(camera()->frame()->inverseTransformOf( camera()->frame()->translate(camera()->frame()->inverseTransformOf(
Vec(-10.0 * camera()->flySpeed(), 0.0, 0.0))); qglviewer::Vec(-10.0 * camera()->flySpeed(), 0.0, 0.0)));
update(); update();
break; break;
case MOVE_CAMERA_RIGHT: case qglviewer::MOVE_CAMERA_RIGHT:
camera()->frame()->translate(camera()->frame()->inverseTransformOf( camera()->frame()->translate(camera()->frame()->inverseTransformOf(
Vec(10.0 * camera()->flySpeed(), 0.0, 0.0))); qglviewer::Vec(10.0 * camera()->flySpeed(), 0.0, 0.0)));
update(); update();
break; break;
case MOVE_CAMERA_UP: case qglviewer::MOVE_CAMERA_UP:
camera()->frame()->translate(camera()->frame()->inverseTransformOf( camera()->frame()->translate(camera()->frame()->inverseTransformOf(
Vec(0.0, 10.0 * camera()->flySpeed(), 0.0))); qglviewer::Vec(0.0, 10.0 * camera()->flySpeed(), 0.0)));
update(); update();
break; break;
case MOVE_CAMERA_DOWN: case qglviewer::MOVE_CAMERA_DOWN:
camera()->frame()->translate(camera()->frame()->inverseTransformOf( camera()->frame()->translate(camera()->frame()->inverseTransformOf(
Vec(0.0, -10.0 * camera()->flySpeed(), 0.0))); qglviewer::Vec(0.0, -10.0 * camera()->flySpeed(), 0.0)));
update(); update();
break; break;
case INCREASE_FLYSPEED: case qglviewer::INCREASE_FLYSPEED:
camera()->setFlySpeed(camera()->flySpeed() * 1.5); camera()->setFlySpeed(camera()->flySpeed() * 1.5);
break; break;
case DECREASE_FLYSPEED: case qglviewer::DECREASE_FLYSPEED:
camera()->setFlySpeed(camera()->flySpeed() / 1.5); camera()->setFlySpeed(camera()->flySpeed() / 1.5);
break; break;
} }
@ -2372,7 +2371,7 @@ Only one shortcut can be assigned to a given CGAL::QGLViewer::KeyboardAction (ne
bindings replace previous ones). If several KeyboardAction are binded to the bindings replace previous ones). If several KeyboardAction are binded to the
same shortcut, only one of them is active. */ same shortcut, only one of them is active. */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setShortcut(KeyboardAction action, unsigned int key) { void CGAL::QGLViewer::setShortcut(qglviewer::KeyboardAction action, unsigned int key) {
keyboardBinding_[action] = key; keyboardBinding_[action] = key;
} }
@ -2394,7 +2393,7 @@ See the <a href="../keyboard.html">keyboard page</a> for details and default
values and the <a href="../examples/keyboardAndMouse.html">keyboardAndMouse</a> values and the <a href="../examples/keyboardAndMouse.html">keyboardAndMouse</a>
example for a practical illustration. */ example for a practical illustration. */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
unsigned int CGAL::QGLViewer::shortcut(KeyboardAction action) const { unsigned int CGAL::QGLViewer::shortcut(qglviewer::KeyboardAction action) const {
if (keyboardBinding_.contains(action)) if (keyboardBinding_.contains(action))
return keyboardBinding_[action]; return keyboardBinding_[action];
else else
@ -2506,8 +2505,8 @@ CGAL_INLINE_FUNCTION
action). */ action). */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setMouseBinding(::Qt::KeyboardModifiers modifiers, void CGAL::QGLViewer::setMouseBinding(::Qt::KeyboardModifiers modifiers,
::Qt::MouseButton button, MouseHandler handler, ::Qt::MouseButton button, qglviewer::MouseHandler handler,
MouseAction action, bool withConstraint) { qglviewer::MouseAction action, bool withConstraint) {
setMouseBinding(::Qt::Key(0), modifiers, button, handler, action, setMouseBinding(::Qt::Key(0), modifiers, button, handler, action,
withConstraint); withConstraint);
} }
@ -2553,12 +2552,12 @@ See also setMouseBinding(::Qt::KeyboardModifiers, ::Qt::MouseButtons, ClickActio
bool, int), setWheelBinding() and clearMouseBindings(). */ bool, int), setWheelBinding() and clearMouseBindings(). */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers modifiers, void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers modifiers,
::Qt::MouseButton button, MouseHandler handler, ::Qt::MouseButton button, qglviewer::MouseHandler handler,
MouseAction action, bool withConstraint) { qglviewer::MouseAction action, bool withConstraint) {
if ((handler == FRAME) && if ((handler == qglviewer::FRAME) &&
((action == MOVE_FORWARD) || (action == MOVE_BACKWARD) || ((action == qglviewer::MOVE_FORWARD) || (action == qglviewer::MOVE_BACKWARD) ||
(action == ROLL) || (action == LOOK_AROUND) || (action == qglviewer::ROLL) || (action == qglviewer::LOOK_AROUND) ||
(action == ZOOM_ON_REGION))) { (action == qglviewer::ZOOM_ON_REGION))) {
qWarning("Cannot bind %s to FRAME", qWarning("Cannot bind %s to FRAME",
mouseActionString(action).toLatin1().constData()); mouseActionString(action).toLatin1().constData());
return; return;
@ -2575,7 +2574,7 @@ void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers mod
map.withConstraint = withConstraint; map.withConstraint = withConstraint;
MouseBindingPrivate mbp(modifiers, button, key); MouseBindingPrivate mbp(modifiers, button, key);
if (action == NO_MOUSE_ACTION) if (action == qglviewer::NO_MOUSE_ACTION)
mouseBinding_.remove(mbp); mouseBinding_.remove(mbp);
else else
mouseBinding_.insert(mbp, map); mouseBinding_.insert(mbp, map);
@ -2593,7 +2592,7 @@ void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers mod
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setMouseBinding(::Qt::KeyboardModifiers modifiers, void CGAL::QGLViewer::setMouseBinding(::Qt::KeyboardModifiers modifiers,
::Qt::MouseButton button, ClickAction action, ::Qt::MouseButton button, qglviewer::ClickAction action,
bool doubleClick, bool doubleClick,
::Qt::MouseButtons buttonsBefore) { ::Qt::MouseButtons buttonsBefore) {
setMouseBinding(::Qt::Key(0), modifiers, button, action, doubleClick, setMouseBinding(::Qt::Key(0), modifiers, button, action, doubleClick,
@ -2628,7 +2627,7 @@ MouseAction, bool), setWheelBinding() and clearMouseBindings().
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers modifiers, void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers modifiers,
::Qt::MouseButton button, ClickAction action, ::Qt::MouseButton button, qglviewer::ClickAction action,
bool doubleClick, bool doubleClick,
::Qt::MouseButtons buttonsBefore) { ::Qt::MouseButtons buttonsBefore) {
if ((buttonsBefore != ::Qt::NoButton) && !doubleClick) { if ((buttonsBefore != ::Qt::NoButton) && !doubleClick) {
@ -2645,7 +2644,7 @@ void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers mod
ClickBindingPrivate cbp(modifiers, button, doubleClick, buttonsBefore, key); ClickBindingPrivate cbp(modifiers, button, doubleClick, buttonsBefore, key);
// #CONNECTION performClickAction comment on NO_CLICK_ACTION // #CONNECTION performClickAction comment on NO_CLICK_ACTION
if (action == NO_CLICK_ACTION) if (action == qglviewer::NO_CLICK_ACTION)
clickBinding_.remove(cbp); clickBinding_.remove(cbp);
else else
clickBinding_.insert(cbp, action); clickBinding_.insert(cbp, action);
@ -2663,7 +2662,7 @@ void CGAL::QGLViewer::setMouseBinding(::Qt::Key key, ::Qt::KeyboardModifiers mod
to be pressed to activate this action). */ to be pressed to activate this action). */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setWheelBinding(::Qt::KeyboardModifiers modifiers, void CGAL::QGLViewer::setWheelBinding(::Qt::KeyboardModifiers modifiers,
MouseHandler handler, MouseAction action, qglviewer::MouseHandler handler, qglviewer::MouseAction action,
bool withConstraint) { bool withConstraint) {
setWheelBinding(::Qt::Key(0), modifiers, handler, action, withConstraint); setWheelBinding(::Qt::Key(0), modifiers, handler, action, withConstraint);
} }
@ -2682,18 +2681,18 @@ CGAL::QGLViewer::MOVE_FORWARD moves at a constant speed defined by
CGAL::qglviewer::Camera::flySpeed(). */ CGAL::qglviewer::Camera::flySpeed(). */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setWheelBinding(::Qt::Key key, ::Qt::KeyboardModifiers modifiers, void CGAL::QGLViewer::setWheelBinding(::Qt::Key key, ::Qt::KeyboardModifiers modifiers,
MouseHandler handler, MouseAction action, qglviewer::MouseHandler handler, qglviewer::MouseAction action,
bool withConstraint) { bool withConstraint) {
//#CONNECTION# ManipulatedFrame::wheelEvent and //#CONNECTION# ManipulatedFrame::wheelEvent and
// ManipulatedCameraFrame::wheelEvent switches // ManipulatedCameraFrame::wheelEvent switches
if ((action != ZOOM) && (action != MOVE_FORWARD) && if ((action != qglviewer::ZOOM) && (action != qglviewer::MOVE_FORWARD) &&
(action != MOVE_BACKWARD) && (action != NO_MOUSE_ACTION)) { (action != qglviewer::MOVE_BACKWARD) && (action != qglviewer::NO_MOUSE_ACTION)) {
qWarning("Cannot bind %s to wheel", qWarning("Cannot bind %s to wheel",
mouseActionString(action).toLatin1().constData()); mouseActionString(action).toLatin1().constData());
return; return;
} }
if ((handler == FRAME) && (action != ZOOM) && (action != NO_MOUSE_ACTION)) { if ((handler == qglviewer::FRAME) && (action != qglviewer::ZOOM) && (action != qglviewer::NO_MOUSE_ACTION)) {
qWarning("Cannot bind %s to FRAME wheel", qWarning("Cannot bind %s to FRAME wheel",
mouseActionString(action).toLatin1().constData()); mouseActionString(action).toLatin1().constData());
return; return;
@ -2705,7 +2704,7 @@ void CGAL::QGLViewer::setWheelBinding(::Qt::Key key, ::Qt::KeyboardModifiers mod
map.withConstraint = withConstraint; map.withConstraint = withConstraint;
WheelBindingPrivate wbp(modifiers, key); WheelBindingPrivate wbp(modifiers, key);
if (action == NO_MOUSE_ACTION) if (action == qglviewer::NO_MOUSE_ACTION)
wheelBinding_.remove(wbp); wheelBinding_.remove(wbp);
else else
wheelBinding_[wbp] = map; wheelBinding_[wbp] = map;
@ -2750,14 +2749,14 @@ if (ma != CGAL::QGLViewer::NO_MOUSE_ACTION) ...
Use mouseHandler() to know which object (CGAL::QGLViewer::CAMERA or CGAL::QGLViewer::FRAME) Use mouseHandler() to know which object (CGAL::QGLViewer::CAMERA or CGAL::QGLViewer::FRAME)
will execute this action. */ will execute this action. */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
MouseAction CGAL::QGLViewer::mouseAction(::Qt::Key key, qglviewer::MouseAction CGAL::QGLViewer::mouseAction(::Qt::Key key,
::Qt::KeyboardModifiers modifiers, ::Qt::KeyboardModifiers modifiers,
::Qt::MouseButton button) const { ::Qt::MouseButton button) const {
MouseBindingPrivate mbp(modifiers, button, key); MouseBindingPrivate mbp(modifiers, button, key);
if (mouseBinding_.contains(mbp)) if (mouseBinding_.contains(mbp))
return mouseBinding_[mbp].action; return mouseBinding_[mbp].action;
else else
return NO_MOUSE_ACTION; return qglviewer::NO_MOUSE_ACTION;
} }
@ -2798,7 +2797,7 @@ them is returned.
See also setMouseBinding(), getClickActionBinding() and getMouseActionBinding(). See also setMouseBinding(), getClickActionBinding() and getMouseActionBinding().
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::getWheelActionBinding(MouseHandler handler, MouseAction action, void CGAL::QGLViewer::getWheelActionBinding(qglviewer::MouseHandler handler, qglviewer::MouseAction action,
bool withConstraint, ::Qt::Key &key, bool withConstraint, ::Qt::Key &key,
::Qt::KeyboardModifiers &modifiers) const { ::Qt::KeyboardModifiers &modifiers) const {
for (QMap<WheelBindingPrivate, MouseActionPrivate>::ConstIterator for (QMap<WheelBindingPrivate, MouseActionPrivate>::ConstIterator
@ -2827,7 +2826,7 @@ MouseAction, one of them is returned.
See also setMouseBinding(), getClickActionBinding() and getWheelActionBinding(). See also setMouseBinding(), getClickActionBinding() and getWheelActionBinding().
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::getMouseActionBinding(MouseHandler handler, MouseAction action, void CGAL::QGLViewer::getMouseActionBinding(qglviewer::MouseHandler handler, qglviewer::MouseAction action,
bool withConstraint, ::Qt::Key &key, bool withConstraint, ::Qt::Key &key,
::Qt::KeyboardModifiers &modifiers, ::Qt::KeyboardModifiers &modifiers,
::Qt::MouseButton &button) const { ::Qt::MouseButton &button) const {
@ -2857,14 +2856,14 @@ setWheelBinding().
Same as mouseAction(), but for the wheel action. See also wheelHandler(). Same as mouseAction(), but for the wheel action. See also wheelHandler().
*/ */
MouseAction qglviewer::MouseAction
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
CGAL::QGLViewer::wheelAction(::Qt::Key key, ::Qt::KeyboardModifiers modifiers) const { CGAL::QGLViewer::wheelAction(::Qt::Key key, ::Qt::KeyboardModifiers modifiers) const {
WheelBindingPrivate wbp(modifiers, key); WheelBindingPrivate wbp(modifiers, key);
if (wheelBinding_.contains(wbp)) if (wheelBinding_.contains(wbp))
return wheelBinding_[wbp].action; return wheelBinding_[wbp].action;
else else
return NO_MOUSE_ACTION; return qglviewer::NO_MOUSE_ACTION;
} }
/*! Returns the MouseHandler (if any) that receives wheel events when the \p /*! Returns the MouseHandler (if any) that receives wheel events when the \p
@ -2896,7 +2895,7 @@ CGAL::QGLViewer::clickAction(::Qt::Key key, ::Qt::KeyboardModifiers modifiers,
if (clickBinding_.contains(cbp)) if (clickBinding_.contains(cbp))
return clickBinding_[cbp]; return clickBinding_[cbp];
else else
return NO_CLICK_ACTION; return qglviewer::NO_CLICK_ACTION;
} }
/*! Returns the mouse and keyboard state that triggers \p action. /*! Returns the mouse and keyboard state that triggers \p action.
@ -2909,12 +2908,12 @@ buttons trigger in the ClickAction, one of them is returned.
See also setMouseBinding(), getMouseActionBinding() and getWheelActionBinding(). See also setMouseBinding(), getMouseActionBinding() and getWheelActionBinding().
*/ */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::getClickActionBinding(ClickAction action, ::Qt::Key &key, void CGAL::QGLViewer::getClickActionBinding(qglviewer::ClickAction action, ::Qt::Key &key,
::Qt::KeyboardModifiers &modifiers, ::Qt::KeyboardModifiers &modifiers,
::Qt::MouseButton &button, ::Qt::MouseButton &button,
bool &doubleClick, bool &doubleClick,
::Qt::MouseButtons &buttonsBefore) const { ::Qt::MouseButtons &buttonsBefore) const {
for (QMap<ClickBindingPrivate, ClickAction>::ConstIterator for (QMap<ClickBindingPrivate, qglviewer::ClickAction>::ConstIterator
it = clickBinding_.begin(), it = clickBinding_.begin(),
end = clickBinding_.end(); end = clickBinding_.end();
it != end; ++it) it != end; ++it)
@ -2943,7 +2942,7 @@ bool CGAL::QGLViewer::cameraIsInRotateMode() const {
::Qt::Key key; ::Qt::Key key;
::Qt::KeyboardModifiers modifiers; ::Qt::KeyboardModifiers modifiers;
::Qt::MouseButton button; ::Qt::MouseButton button;
getMouseActionBinding(CAMERA, ROTATE, true /*constraint*/, key, modifiers, getMouseActionBinding(qglviewer::CAMERA, qglviewer::ROTATE, true /*constraint*/, key, modifiers,
button); button);
return button != ::Qt::NoButton; return button != ::Qt::NoButton;
} }
@ -2967,12 +2966,12 @@ void CGAL::QGLViewer::toggleCameraMode() {
::Qt::Key key; ::Qt::Key key;
::Qt::KeyboardModifiers modifiers; ::Qt::KeyboardModifiers modifiers;
::Qt::MouseButton button; ::Qt::MouseButton button;
getMouseActionBinding(CAMERA, ROTATE, true /*constraint*/, key, modifiers, getMouseActionBinding(qglviewer::CAMERA, qglviewer::ROTATE, true /*constraint*/, key, modifiers,
button); button);
bool rotateMode = button != ::Qt::NoButton; bool rotateMode = button != ::Qt::NoButton;
if (!rotateMode) { if (!rotateMode) {
getMouseActionBinding(CAMERA, MOVE_FORWARD, true /*constraint*/, key, getMouseActionBinding(qglviewer::CAMERA, qglviewer::MOVE_FORWARD, true /*constraint*/, key,
modifiers, button); modifiers, button);
} }
@ -2981,31 +2980,31 @@ void CGAL::QGLViewer::toggleCameraMode() {
camera()->frame()->updateSceneUpVector(); camera()->frame()->updateSceneUpVector();
camera()->frame()->stopSpinning(); camera()->frame()->stopSpinning();
setMouseBinding(modifiers, ::Qt::LeftButton, CAMERA, MOVE_FORWARD); setMouseBinding(modifiers, ::Qt::LeftButton, qglviewer::CAMERA, qglviewer::MOVE_FORWARD);
setMouseBinding(modifiers, ::Qt::MidButton, CAMERA, LOOK_AROUND); setMouseBinding(modifiers, ::Qt::MidButton, qglviewer::CAMERA, qglviewer::LOOK_AROUND);
setMouseBinding(modifiers, ::Qt::RightButton, CAMERA, MOVE_BACKWARD); setMouseBinding(modifiers, ::Qt::RightButton, qglviewer::CAMERA, qglviewer::MOVE_BACKWARD);
setMouseBinding(::Qt::Key_R, modifiers, ::Qt::LeftButton, CAMERA, ROLL); setMouseBinding(::Qt::Key_R, modifiers, ::Qt::LeftButton, qglviewer::CAMERA, qglviewer::ROLL);
setMouseBinding(::Qt::NoModifier, ::Qt::LeftButton, NO_CLICK_ACTION, true); setMouseBinding(::Qt::NoModifier, ::Qt::LeftButton, qglviewer::NO_CLICK_ACTION, true);
setMouseBinding(::Qt::NoModifier, ::Qt::MidButton, NO_CLICK_ACTION, true); setMouseBinding(::Qt::NoModifier, ::Qt::MidButton, qglviewer::NO_CLICK_ACTION, true);
setMouseBinding(::Qt::NoModifier, ::Qt::RightButton, NO_CLICK_ACTION, true); setMouseBinding(::Qt::NoModifier, ::Qt::RightButton, qglviewer::NO_CLICK_ACTION, true);
setWheelBinding(modifiers, CAMERA, MOVE_FORWARD); setWheelBinding(modifiers, qglviewer::CAMERA, qglviewer::MOVE_FORWARD);
} else { } else {
// Should stop flyTimer. But unlikely and not easy. // Should stop flyTimer. But unlikely and not easy.
setMouseBinding(modifiers, ::Qt::LeftButton, CAMERA, ROTATE); setMouseBinding(modifiers, ::Qt::LeftButton, qglviewer::CAMERA, qglviewer::ROTATE);
setMouseBinding(modifiers, ::Qt::MidButton, CAMERA, ZOOM); setMouseBinding(modifiers, ::Qt::MidButton, qglviewer::CAMERA, qglviewer::ZOOM);
setMouseBinding(modifiers, ::Qt::RightButton, CAMERA, TRANSLATE); setMouseBinding(modifiers, ::Qt::RightButton, qglviewer::CAMERA, qglviewer::TRANSLATE);
setMouseBinding(::Qt::Key_R, modifiers, ::Qt::LeftButton, CAMERA, setMouseBinding(::Qt::Key_R, modifiers, ::Qt::LeftButton, qglviewer::CAMERA,
SCREEN_ROTATE); qglviewer::SCREEN_ROTATE);
setMouseBinding(::Qt::NoModifier, ::Qt::LeftButton, ALIGN_CAMERA, true); setMouseBinding(::Qt::NoModifier, ::Qt::LeftButton, qglviewer::ALIGN_CAMERA, true);
setMouseBinding(::Qt::NoModifier, ::Qt::MidButton, SHOW_ENTIRE_SCENE, true); setMouseBinding(::Qt::NoModifier, ::Qt::MidButton, qglviewer::SHOW_ENTIRE_SCENE, true);
setMouseBinding(::Qt::NoModifier, ::Qt::RightButton, CENTER_SCENE, true); setMouseBinding(::Qt::NoModifier, ::Qt::RightButton, qglviewer::CENTER_SCENE, true);
setWheelBinding(modifiers, CAMERA, ZOOM); setWheelBinding(modifiers, qglviewer::CAMERA, qglviewer::ZOOM);
} }
} }
@ -3026,7 +3025,7 @@ Note that a CGAL::qglviewer::ManipulatedCameraFrame can be set as the
manipulatedFrame(): it is possible to manipulate the camera of a first viewer in manipulatedFrame(): it is possible to manipulate the camera of a first viewer in
a second viewer. */ a second viewer. */
CGAL_INLINE_FUNCTION CGAL_INLINE_FUNCTION
void CGAL::QGLViewer::setManipulatedFrame(ManipulatedFrame *frame) { void CGAL::QGLViewer::setManipulatedFrame(qglviewer::ManipulatedFrame *frame) {
if (manipulatedFrame()) { if (manipulatedFrame()) {
manipulatedFrame()->stopSpinning(); manipulatedFrame()->stopSpinning();
@ -3041,7 +3040,7 @@ void CGAL::QGLViewer::setManipulatedFrame(ManipulatedFrame *frame) {
manipulatedFrameIsACamera_ = manipulatedFrameIsACamera_ =
((manipulatedFrame() != camera()->frame()) && ((manipulatedFrame() != camera()->frame()) &&
(dynamic_cast<ManipulatedCameraFrame *>(manipulatedFrame()) != NULL)); (dynamic_cast<qglviewer::ManipulatedCameraFrame *>(manipulatedFrame()) != NULL));
if (manipulatedFrame()) { if (manipulatedFrame()) {
// Prevent multiple connections, that would result in useless display // Prevent multiple connections, that would result in useless display
@ -4076,3 +4075,4 @@ void CGAL::QGLViewer::saveSnapshot()
} }
}

View File

@ -32,7 +32,9 @@
#include <stdlib.h> // RAND_MAX #include <stdlib.h> // RAND_MAX
// All the methods are declared inline in Quaternion.h // All the methods are declared inline in Quaternion.h
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
/*! Constructs a Quaternion that will rotate from the \p from direction to the /*! Constructs a Quaternion that will rotate from the \p from direction to the
\p to direction. \p to direction.
@ -554,3 +556,4 @@ Quaternion Quaternion::randomQuaternion() {
qreal t2 = 2.0 * CGAL_PI * (rand() / (qreal)RAND_MAX); qreal t2 = 2.0 * CGAL_PI * (rand() / (qreal)RAND_MAX);
return Quaternion(sin(t1) * r1, cos(t1) * r1, sin(t2) * r2, cos(t2) * r2); return Quaternion(sin(t1) * r1, cos(t1) * r1, sin(t2) * r2, cos(t2) * r2);
} }
}}

View File

@ -32,7 +32,9 @@
// Most of the methods are declared inline in vec.h // Most of the methods are declared inline in vec.h
using namespace CGAL::qglviewer; namespace CGAL{
namespace qglviewer{
/*! Projects the Vec on the axis of direction \p direction that passes through /*! Projects the Vec on the axis of direction \p direction that passes through
the origin. the origin.
@ -176,3 +178,4 @@ CGAL_INLINE_FUNCTION
std::ostream &operator<<(std::ostream &o, const Vec &v) { std::ostream &operator<<(std::ostream &o, const Vec &v) {
return o << v.x << '\t' << v.y << '\t' << v.z; return o << v.x << '\t' << v.y << '\t' << v.z;
} }
}}