OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SurfacePlugin.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef _SURFACE_PLUGIN_H_
9 #define _SURFACE_PLUGIN_H_
10 
11 #include <util/common.h>
12 
13 #include "ModuleFeedbackPlugin.h"
14 #include "ModuleFeedbackManager.h"
15 #include "coVRPlugin.h"
16 
17 class coVRPlugin;
18 
19 namespace osg
20 {
21 class Group;
22 class Node;
23 class MatrixTransform;
24 class Switch;
25 };
26 
27 #include <osg/Matrix>
28 #include <osg/Vec3>
29 
30 #include <OpenVRUI/coMenu.h>
31 class RenderObject;
32 class PLUGIN_UTILEXPORT SurfacePlugin : public coVRPlugin, public ModuleFeedbackPlugin, public coMenuFocusListener
33 {
34 public:
35  SurfacePlugin(const char *iconname, string sectionName);
36  virtual ~SurfacePlugin();
37  void VerwaltePointer(bool show);
38  void GetPoint(osg::Vec3 &vect) const;
39  void GetNormal(osg::Vec3 &vect) const;
40  void SubstitutePointer(const char *iconname);
41 
42  void AddObject(const char *objName, RenderObject *colorOrText);
43  void AddNode(const char *objName, osg::Node *node);
44  void AddContainer(const char *contName, const char *objName);
45  void RemoveObject(const char *objName);
46  void RemoveNode(osg::Node *);
47  RenderObject *GetColor(const char *objName);
48  osg::Node *GetNode(const char *objName);
49  void ToggleVisibility(string objName);
50  virtual void SuppressOther3DTex(ModuleFeedbackManager *);
51  virtual void DeleteInteractor(coInteractor *i);
52  void GetPointerParams(float &angle, float &scaleFactor, float &displacement);
53  void AddFixedIcon();
54  void RemoveFixedIcon();
55  virtual void preFrame()
56  {
57  ModuleFeedbackPlugin::preFrame();
58  };
59  // Change Pointer state: true=active, false=non-active
60  void setActive(bool isActive);
61 
62 protected:
63  virtual void focusEvent(bool focus, coMenu *menu);
64  coVRPlugin *_module;
65 
66 private:
67  map<string, osg::Node *> _findNode; // object, node
68  map<osg::Node *, string> _findNodeSym; // object, node
69  map<osg::Node *, osg::Group *> _parentNode; // object, parent object
70 
71  map<string, string> _findObject; // container, object
72  map<string, string> _findObjectSym; // object, container
73 
74  map<string, RenderObject *> _findColor; // object, colorObject
75 
76  // pointer
77  osg::Switch *readPointer(const char *basename);
78  bool _show;
79  osg::Group *_rootNode;
80  osg::MatrixTransform *_scale;
81  osg::MatrixTransform *_fixed_scale;
82  osg::Matrix *_fixed_matrix;
83  osg::Matrix *_matrix;
84  osg::Switch *_pointer; // pointer icon
85  float _cos_angle;
86  float _sin_angle;
87  float _angle; // degrees
88  float _displacement;
89  float _scaleFactor;
90  bool _inFocus;
91  string _iconName;
92 };
93 #endif
OpenCOVER plugin interface, derive plugins from coVRPlugin.
coVRPlugin * _module
Definition: SurfacePlugin.h:64
virtual void preFrame()
Definition: SurfacePlugin.h:55
Definition: SurfacePlugin.h:32