vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DATool.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "PoA.h"
4 #include <vreckoUtils\Observer.h>
5 
6 using namespace vrecko;
7 
8 namespace APDYNAMICART
9 {
10 
11 // DATool type enumeration
12 typedef enum DAToolType {
24 };
25 
27 
34 class DATool : public Ability, public vreckoUtils::Observable, public osg::Referenced {
35 public:
36 
37  DATool(const char* abilityName);
38  ~DATool();
39 
40 
42  /*
43  * Called when user want to use tool - paint with brush, deform with magnet, ...
44  * Called from appropriate controller, when "UseTool" event is evoked
45  *
46  * \param _poa PoA object that tool will work with
47  */
48  virtual void activate() = 0;
49 
50 
52  /*
53  *
54  * \param parent Parent EO - usually left or right virtual hand
55  * \param fileName file with geometry of cursor (.3ds, .obj, ...)
56  *
57  */
58  void createCursor(EnvironmentObject* parent, string fileName);
59 
60 
61 
63  /*
64  * Called when user want to stop using tool
65  *
66  */
67  virtual void deactivate() = 0;
68 
69 
70  EnvironmentObject* getCursor() {return this->_cursor; }
71  DAToolType getType() {return toolType; }
72 
73  osg::Vec3* getSize() {return this->size; }
74 
75  bool isActive() { return this->active; }
76 
78  void setSize(osg::Vec3 p_size);
79 
81  void setPoA(osg::ref_ptr<PoA> newPoa) { this->_poa = newPoa; }
82 
84  /*
85  * Called when user switch from another tool to this tool.
86  * if necessary, add new interconnections - "running" tool will receive events... e.g. about position and orientation of hand.
87  * Show visual cursor of tool, if exists.
88  *
89  */
90  virtual void turnOn() = 0;
91 
93  /*
94  * Called when user switch from this tool to another tool.
95  * Delete existing interconnections - "stoped" tool doesn't need to receive any events
96  * Hide visual cursor, if exists
97  *
98  */
99  virtual void turnOff() = 0;
100 
101 
102 protected:
103 
106 
109 
111  bool active;
112 
113  osg::ref_ptr<PoA> _poa;
114 
116 
120  osg::ref_ptr<EnvironmentObject> _cursor;
121 
123  osg::Vec3 *size;
124 
125 };
126 
127 }