00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef QGLVIEWER_SPINNING_FRAME_H
00026 #define QGLVIEWER_SPINNING_FRAME_H
00027
00028 #include <qstring.h>
00029 #include <qtimer.h>
00030
00031 #include "frame.h"
00032
00033 namespace qglviewer {
00034
00092 class QGLVIEWER_EXPORT SpinningFrame : public Frame
00093 {
00094 Q_OBJECT
00095
00096 public:
00097 SpinningFrame();
00099 virtual ~SpinningFrame() {};
00100
00101 signals:
00117 void spinned();
00118
00119 public:
00120 virtual QDomElement domElement(const QString& name, QDomDocument& doc) const;
00121 virtual void initFromDOMElement(const QDomElement& de);
00122
00125 public slots:
00126
00128 void setSpinningQuaternion(const Quaternion& q) { spinningQuaternion_ = q; };
00129
00132 void setRotationCenter(const Vec& center) { rotationCenter_ = center; };
00133 void setRotateAroundCenter(const bool rac=true) { rotatesAroundCenter_ = rac; };
00134 void freezeOrientation(const bool fo=true) { frozenOrientation_ = fo; };
00135
00136 public:
00143 Quaternion spinningQuaternion() const { return spinningQuaternion_; };
00144
00148 Vec rotationCenter() const { return rotationCenter_; };
00149 bool rotatesAroundCenter() const { return rotatesAroundCenter_; }
00150 bool orientationIsFrozen() const { return frozenOrientation_; };
00152
00153
00156 public slots:
00157 virtual void startSpinning(const int msecs = -1);
00159 virtual void stopSpinning() { timer_.stop(); isSpinning_ = false; };
00165 void setUpdateInterval(const int msecs) { updateInterval_ = msecs; };
00166 public:
00168 bool isSpinning() const { return isSpinning_; };
00172 int updateInterval() const { return updateInterval_; };
00174
00175 protected slots:
00176 void updateFrame();
00177
00178 private:
00179
00180
00181 SpinningFrame(const SpinningFrame& sf);
00182 SpinningFrame& operator=(const SpinningFrame& sf);
00183
00184
00185 bool isSpinning_;
00186 QTimer timer_;
00187 int updateInterval_;
00188
00189
00190 Quaternion spinningQuaternion_;
00191 Vec rotationCenter_;
00192 bool rotatesAroundCenter_;
00193 bool frozenOrientation_;
00194 };
00195
00196 }
00197
00198 #endif // QGLVIEWER_SPINNING_FRAME_H