Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/animation.h
00001 /**********************************************************************
00002   Animation - Basic animation interface
00003 
00004   Copyright (c) 2009 Tim Vandermeersch
00005   Copyright (c) 2009 Geoff Hutchison
00006   Copyright (c) 2009 Marcus D. Hanwell
00007 
00008   This file is part of the Avogadro molecular editor project.
00009   For more information, see <http://avogadro.openmolecules.net/>
00010 
00011   Some code is based on Open Babel
00012   For more information, see <http://openbabel.sourceforge.net/>
00013 
00014   This program is free software; you can redistribute it and/or modify
00015   it under the terms of the GNU General Public License as published by
00016   the Free Software Foundation version 2 of the License.
00017 
00018   This program is distributed in the hope that it will be useful,
00019   but WITHOUT ANY WARRANTY; without even the implied warranty of
00020   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021   GNU General Public License for more details.
00022  ***********************************************************************/
00023 
00024 #ifndef ANIMATION_H
00025 #define ANIMATION_H
00026 
00027 #include "global.h"
00028 
00029 #include <QObject>
00030 
00031 #include <Eigen/Core>
00032 
00033 #include <vector>
00034 
00035 class QTimeLine;
00036 
00037 namespace Avogadro {
00038 
00039   class Molecule;
00040 
00058   class AnimationPrivate;
00059   class A_EXPORT Animation : public QObject
00060   {
00061     Q_OBJECT
00062 
00063     public:
00070       Animation(QObject *parent=0);
00074       virtual ~Animation();
00075     
00079       void setMolecule(Molecule *molecule);
00087       void setFrames(std::vector< std::vector< Eigen::Vector3d> *> frames);
00088 
00092       int fps() const;
00096       int loopCount() const;
00100       int numFrames() const;
00104       bool dynamicBonds() const;
00105 
00106     Q_SIGNALS:
00110       void frameChanged(int);
00111 
00112     public Q_SLOTS:
00116       void setFps(int fps);
00120       void setLoopCount(int loops);
00124       void setFrame(int i);
00125 
00129       void setDynamicBonds(bool enable);
00130 
00134       void start();
00138       void pause();
00142       void stop();
00143 
00144     private:
00145       AnimationPrivate * const d;
00146       
00147       Molecule *m_molecule;
00148       QTimeLine *m_timeLine;
00149       std::vector< std::vector< Eigen::Vector3d> *> m_originalConformers;
00150       std::vector< std::vector< Eigen::Vector3d> *> m_frames;
00151   };
00152 
00153 } // end namespace Avogadro
00154 
00155 #endif