00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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);
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
00156 float flySpeed_;
00157 float driveSpeed_;
00158 Vec flyUpVector_;
00159 QTimer flyTimer_;
00160
00161 Vec revolveAroundPoint_;
00162 };
00163
00164 }
00165
00166 #endif // QGLVIEWER_MANIPULATED_CAMERA_FRAME_H