Ginga  0.13.6
 All Classes Namespaces Functions Variables
AnimationController.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef _ANIMATIONCONTROLLER_H_
51 #define _ANIMATIONCONTROLLER_H_
52 
53 #include "../model/AttributionEvent.h"
54 using namespace ::br::pucrio::telemidia::ginga::ncl::model::event;
55 
56 #include "ncl/animation/Animation.h"
57 using namespace ::br::pucrio::telemidia::ncl::animation;
58 
59 #include "system/thread/Thread.h"
60 using namespace ::br::pucrio::telemidia::ginga::core::system::thread;
61 
62 #include "../adapters/FormatterPlayerAdapter.h"
63 #include "../adapters/PlayerAdapterManager.h"
64 using namespace ::br::pucrio::telemidia::ginga::ncl::adapters;
65 
66 #include "../model/ExecutionObject.h"
67 using namespace ::br::pucrio::telemidia::ginga::ncl::model::components;
68 
69 namespace br {
70 namespace pucrio {
71 namespace telemidia {
72 namespace ginga {
73 namespace ncl {
74 namespace animation {
75  class AnimationController : public Thread {
76  private:
77  PlayerAdapterManager* pManager;
78  FormatterPlayerAdapter* player; //useful if media is playing
79  ExecutionObject* execObj; //useful if the object isn't playing
80  //or it's a Ginga Settings Node.
81 
82  AttributionEvent* event; //attribution event
83 
84  //useful when the animation is over a region
85  LayoutRegion* initRegion;
86  LayoutRegion* targetRegion;
87 
88  string propName; //name of the property (can be a group
89  //of properties like bounds, location,
90  //etc.)
91 
92  bool isExecObjAnim;
93 
94  //animation parameters
95  vector <string>* params; //parameters passe by the author
96  vector <string> propertySingleNames;
97  vector <double> initValues;
98  vector <string> strTargetValues;
99  vector <double> targetValues;
100 
101  double initTime;
102  double duration;
103 
104  int stepSize; //this would be a vector
105 
106  private:
108  ExecutionObject* execObj,
109  PlayerAdapterManager* pManager,
110  FormatterPlayerAdapter* player,
111  AttributionEvent* event,
112  string value,
113  Animation* anim);
114 
115  virtual ~AnimationController();
116 
117  public:
118  static void startAnimation(
119  ExecutionObject* execObj,
120  PlayerAdapterManager* pManager,
121  FormatterPlayerAdapter* player,
122  AttributionEvent* event,
123  string value,
124  Animation* anim);
125 
126  private:
127  string previousValues;
128 
139  void run();
140 
145  bool loadInitValues();
146 
152  bool loadTargetValues();
153 
154  bool animeStep();
155 
159  double getSinglePropertyTarget(int i);
160 
169  bool updateTargetRegion();
170 
178  bool ungroupProperty();
179 
180  bool isExecutionObjectProperty(string name);
181 
182  };
183 }
184 }
185 }
186 }
187 }
188 }
189 
190 #endif // _ANIMATIONCONTROLLER_H_