Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

spinningFrame.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the QGLViewer library
00004  Copyright (C) 2002-2004  Gilles Debunne (Gilles.Debunne@imag.fr)
00005  Version 1.3.5 Release 8. Packaged on Monday December 22, 2003.
00006 
00007  http://www-imagis.imag.fr/Membres/Gilles.Debunne/CODE/QGLViewer
00008 
00009  libQGLViewer is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  libQGLViewer is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with libQGLViewer; if not, write to the Free Software
00021  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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     // Copy constructor and opertor= are declared private and undefined.
00180     // Prevents anyone from trying to use them.
00181     SpinningFrame(const SpinningFrame& sf);
00182     SpinningFrame& operator=(const SpinningFrame& sf);
00183   
00184     // T i m e r
00185     bool isSpinning_;
00186     QTimer timer_;
00187     int updateInterval_; // in msecs
00188 
00189     // S p i n n i n g   p a r a m a t e r s
00190     Quaternion spinningQuaternion_;
00191     Vec rotationCenter_;
00192     bool rotatesAroundCenter_;
00193     bool frozenOrientation_;
00194   };
00195 
00196 } // namespace qglviewer
00197 
00198 #endif // QGLVIEWER_SPINNING_FRAME_H

Generated on Fri Feb 27 12:01:39 2004 for Glitch by doxygen 1.3.2