00001 /**************************************************************************** 00002 00003 Copyright (C) 2002-2013 Gilles Debunne. All rights reserved. 00004 00005 This file is part of the QGLViewer library version 2.4.0. 00006 00007 http://www.libqglviewer.com - contact@libqglviewer.com 00008 00009 This file may be used under the terms of the GNU General Public License 00010 versions 2.0 or 3.0 as published by the Free Software Foundation and 00011 appearing in the LICENSE file included in the packaging of this file. 00012 In addition, as a special exception, Gilles Debunne gives you certain 00013 additional rights, described in the file GPL_EXCEPTION in this package. 00014 00015 libQGLViewer uses dual licensing. Commercial/proprietary software must 00016 purchase a libQGLViewer Commercial License. 00017 00018 This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00019 WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00020 00021 *****************************************************************************/ 00022 00023 #ifndef QGLVIEWER_MANIPULATED_CAMERA_FRAME_H 00024 #define QGLVIEWER_MANIPULATED_CAMERA_FRAME_H 00025 00026 #include "manipulatedFrame.h" 00027 00028 namespace qglviewer { 00047 class QGLVIEWER_EXPORT ManipulatedCameraFrame : public ManipulatedFrame 00048 { 00049 #ifndef DOXYGEN 00050 friend class Camera; 00051 friend class ::QGLViewer; 00052 #endif 00053 00054 Q_OBJECT 00055 00056 public: 00057 ManipulatedCameraFrame(); 00059 virtual ~ManipulatedCameraFrame() {}; 00060 00061 ManipulatedCameraFrame(const ManipulatedCameraFrame& mcf); 00062 ManipulatedCameraFrame& operator=(const ManipulatedCameraFrame& mcf); 00063 00066 public: 00075 Vec revolveAroundPoint() const { return revolveAroundPoint_; } 00077 void setRevolveAroundPoint(const Vec& revolveAroundPoint) { revolveAroundPoint_ = revolveAroundPoint; } 00079 00082 public Q_SLOTS: 00087 void setFlySpeed(float speed) { flySpeed_ = speed; }; 00088 00093 void setFlyUpVector(const Vec& up) { flyUpVector_ = up; }; 00094 00095 public: 00104 float flySpeed() const { return flySpeed_; }; 00105 00116 Vec flyUpVector() const { return flyUpVector_; }; 00118 00121 protected: 00122 virtual void mouseReleaseEvent(QMouseEvent* const event, Camera* const camera); 00123 virtual void mouseMoveEvent (QMouseEvent* const event, Camera* const camera); 00124 virtual void wheelEvent (QWheelEvent* const event, Camera* const camera); 00126 00129 protected Q_SLOTS: 00130 virtual void spin(); 00132 00135 public: 00136 virtual QDomElement domElement(const QString& name, QDomDocument& document) const; 00137 public Q_SLOTS: 00138 virtual void initFromDOMElement(const QDomElement& element); 00140 00141 #ifndef DOXYGEN 00142 protected: 00143 virtual void startAction(int ma, bool withConstraint=true); // int is really a QGLViewer::MouseAction 00144 #endif 00145 00146 private Q_SLOTS: 00147 virtual void flyUpdate(); 00148 00149 private: 00150 void updateFlyUpVector(); 00151 Quaternion turnQuaternion(int x, const Camera* const camera); 00152 Quaternion pitchYawQuaternion(int x, int y, const Camera* const camera); 00153 00154 private: 00155 // Fly mode data 00156 float flySpeed_; 00157 float driveSpeed_; 00158 Vec flyUpVector_; 00159 QTimer flyTimer_; 00160 00161 Vec revolveAroundPoint_; 00162 }; 00163 00164 } // namespace qglviewer 00165 00166 #endif // QGLVIEWER_MANIPULATED_CAMERA_FRAME_H