vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Controller.h
Go to the documentation of this file.
1 #ifndef _DA_CONTROLLER_H
2 #define _DA_CONTROLLER_H
3 
4 
5 #include "PoA.h"
6 #include "DATool.h"
7 
8 using namespace vrecko;
9 
10 namespace APDYNAMICART
11 {
12 
13 
15 
17 
29 typedef std::vector<DATool*> DATools;
30 
31 class Controller : public Ability, public osg::Referenced
32 {
33 public:
34 
44  Controller(const char* controllerID, const char* description, PoAType type);
45  ~Controller();
46 
48 
57  virtual void activateTool() = 0;
58 
59 
61  /*
62  * - clear all PoA objects
63  * - reset tools setting
64  *
65  */
66  virtual void clear() = 0;
67 
68  void clearAllPoAs();
69 
71 
76  virtual void createMenuStructure( osg::ref_ptr<vreckoUtils::MenuBase> parentMenu ) const = 0;
77 
79 
83  virtual void deactivateTool() = 0;
84 
86 
89  virtual void debugKeyPressed() = 0;
90 
91  const char* getDescription(void) const { return _description; }
92 
94  const PoAType getType(void) const { return _type; }
95 
96  static const PoAType getType(std::string type);
97 
99  const char* getPoAsName(void) const { return this->_poasName; }
100 
102  float getDaareaScale() const { return _artArea->getScale().x(); }
103 
105 
108  virtual void guiItemClicked(const char* itemID) = 0;
109 
110  virtual void initialize(DAEnvironment* p_dae, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parameters = NULL) = 0;
111 
113  inline bool isEmpty() { return _poas->empty(); }
114 
116  virtual void load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parametersNode, XERCES_CPP_NAMESPACE_QUALIFIER DOMNodeList* poaNodeList) = 0;
117 
118 
120 
124  virtual void guiSliderChanged(const char* sliderID, float sliderPos) = 0;
125 
131  void preInitialize();
132  void postInitialize();
133 
135  void removePoA(PoA* toRemove);
136 
137 
139  virtual void save(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* Document, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *controllerNode) = 0;
140 
141  //TODO REMOVE
143 
149  //virtual void setDAEnvironment(DAEnvironment* p_dae) { this->_daEnvironment = p_dae; }
150 
151 
152  virtual DAToolType getNextToolType();
153 
155 
162  virtual void switchTools(DAToolType newType);
163 
165 
168  virtual void turnOn() = 0;
169 
171 
174  virtual void turnOff(void) = 0;
175 
177  /*
178  * check all PoAs and do something (e.g. delete PoA) if needed
179  *
180  */
181  virtual void update() = 0;
182  std::vector<ref_ptr_PoA>* getPoAs() { return this->_poas; }
183  virtual void setColour( osg::Vec4 newColour );
184 
185  virtual void switchGUIVisibility() = 0;
186 
187 protected:
189  void initTools();
190 
192  const char* _description;
193 
195  const PoAType _type;
196 
199  const char* _poasName;
200 
203 
206 
208  std::vector<ref_ptr_PoA>* _poas;
209 
212 
215 
216 };
217 
218 //not used ?
219 //typedef osg::ref_ptr<Controller> ref_ptr_Controller;
220 
221 }
222 #endif // _DA_CONTROLLER_H