OpenCOVER
ModuleFeedbackManager.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 MODULE_FEEDBACK_MANAGER_H_
9#define MODULE_FEEDBACK_MANAGER_H_
10
11#include <util/coTypes.h>
12
13#include <string>
14
15#include <cover/ui/Owner.h>
16namespace opencover {
17namespace ui {
18class Menu;
19class Action;
20class Button;
21}
22}
23
24class cp3dplane;
25
26namespace opencover
27{
28class RenderObject;
29class ColorBar;
30class coInteractor;
31}
32
33#include <osg/Node>
34#include <osg/Geode>
35#include <osg/MatrixTransform>
36
37// this class manages the interaction (menu and execution)
38// of a module (but not the icon)
39
40namespace opencover
41{
42
43class PLUGIN_UTILEXPORT ModuleFeedbackManager
44 : public ui::Owner
45{
46public:
48 ModuleFeedbackManager(const RenderObject *, const RenderObject *, const char *pluginName);
50
51 // returns true if inter comes from the same module: used in
52 // ModuleFeedbackPlugin::add for adding or updating an entry in
53 // ModuleFeedbackPlugin::_ComplexModuleList
54 bool compare(coInteractor *inter);
55 // returns true if name is an object name from the same module:
56 // used in ModuleFeedbackPlugin::remove for deleting an entry
57 // in ModuleFeedbackPlugin::_ComplexModuleList
58 bool compare(const char *name);
59 // returns true if this moduelFeedbackManager is for the same plugin
60 bool comparePlugin(const char *pluginName);
61
62 // called for menu update when a new object is received
63 virtual void update(const RenderObject *container, coInteractor *);
64 virtual void update(const RenderObject *container, const RenderObject *);
65
66 // empty implementation
67 virtual void preFrame();
68
69 // empty implementation of 3DTex functionality
70 virtual void update3DTex(std::string, cp3dplane *, const char *cmName);
71
72 std::string ModuleName(const char *) const;
73 std::string ModuleName()
74 {
75 return moduleName_;
76 };
77
78 // set checkbox and and hide geometry
79 void setHideFromGui(bool);
80
81 // set the case name and put item into this menu
82 void setCaseFromGui(const char *casename);
83
84 // set the a new name
85 void setNameFromGui(const char *casename);
86
87 // show/hide geometry
88 virtual void hideGeometry(bool);
89
90 //Transform geometry
91 void setMatrix(float *row0, float *row1, float *row2, float *row3);
92
93 //Transform geometry
94 void addNodeToCase(osg::Node *node);
95
96 //enable feed back to Colors module
98
99 // do hide button functionality
100 virtual void triggerHide(bool state);
101
103 {
104 return inter_;
105 }
107
108protected:
109 // helper for constructor
111 void registerObjAtUi(std::string name);
112
113 // helper for update
115 void updateColorBar(const RenderObject *container);
116
117 // gets either from attribute OBJECTNAME or from the module name
118 // a suggestion for the menu name, the result is kept in _menuName
119 //std::string suggestMenuName();
120 std::string getMenuName() const;
121
122 ui::Menu *menu_ = nullptr; // the menu for the interaction of the module managed by the instance of this class
123 ui::Button *hideCheckbox_ = nullptr; // hide geometry
124 ui::Button *syncCheckbox_ = nullptr; // sync interaction
125 ui::Action *newButton_ = nullptr; // copy this module
126 ui::Action *deleteButton_ = nullptr; // delete this module
127 ui::Button *executeCheckbox_ = nullptr; // execute module button
128 //ui::coSubMenuItem *colorsButton_; // open colorbar
129 opencover::coInteractor *inter_ = nullptr; // the last interaction got from the module at issue
130 bool inExecute_; // switch checkbox off when new object arrived
131 std::string menuName_; // name associated to _menuItem: its updated when a new object is received
132
133 // Overload this function if you want to do anything before an EXEC
134 // call is sent to a module. Always call it before doing an EXEC call!
136
137 // search the corresponding node in sg
138 osg::Node *findMyNode();
139 std::vector<osg::Geode *> findMyGeode();
140
141 std::string geomObjectName_;
143 std::string attrObjectName_;
144 std::string attrPartName_;
145
146 std::string initialObjectName_; //we have to save it for the grmsg, because _inter is not always valid
147 osg::ref_ptr<osg::MatrixTransform> geometryCaseDCS_;
148
149private:
150 // it is used in ModuleFeedbackManager::compare(const char *name)
151 std::string moduleName_;
152
153 std::string pName_;
154
155 ui::Menu *coviseMenu_ = nullptr;
156 ui::Menu *parentMenu_ = nullptr;
157 ui::Menu *caseMenu_ = nullptr;
158 std::string caseName_;
159
160 std::string visItemName_; //"Tracer_1..."
161 std::string visMenuName_; // "Tracer_1"
162 void sendHideMsg(bool);
163 std::vector<osg::Geode *> findRecMyGeode(osg::Node *node);
164 osg::ref_ptr<osg::Node> myNode_;
165 osg::ref_ptr<osg::Group> myNodesParent_;
166};
167}
168#endif
Definition: ARToolKit.h:33
abstract feedback class for interacting with parameters of visualization modules (e....
Definition: coInteractor.h:37
base class for data received from visualization systems (e.g. COVISE or Vistle)
Definition: RenderObject.h:147
Definition: ModuleFeedbackManager.h:45
virtual void preExecCB(opencover::coInteractor *)
Definition: ModuleFeedbackManager.h:135
virtual void update(const RenderObject *container, coInteractor *)
opencover::coInteractor * getInteractor()
Definition: ModuleFeedbackManager.h:102
void setCaseFromGui(const char *casename)
ModuleFeedbackManager(const RenderObject *, const RenderObject *, const char *pluginName)
std::string menuName_
Definition: ModuleFeedbackManager.h:131
bool compare(const char *name)
void setNameFromGui(const char *casename)
virtual void hideGeometry(bool)
osg::ref_ptr< osg::MatrixTransform > geometryCaseDCS_
Definition: ModuleFeedbackManager.h:147
std::string geomObjectName_
Definition: ModuleFeedbackManager.h:141
virtual void update3DTex(std::string, cp3dplane *, const char *cmName)
std::vector< osg::Geode * > findMyGeode()
ModuleFeedbackManager(const opencover::RenderObject *, opencover::coInteractor *, const char *pluginName)
std::string attrObjectName_
Definition: ModuleFeedbackManager.h:143
virtual void triggerHide(bool state)
bool compare(coInteractor *inter)
std::string containerObjectName_
Definition: ModuleFeedbackManager.h:142
void addColorbarInteractor(coInteractor *i)
bool inExecute_
Definition: ModuleFeedbackManager.h:130
void updateColorBar(const RenderObject *container)
void addNodeToCase(osg::Node *node)
virtual void update(const RenderObject *container, const RenderObject *)
std::string ModuleName()
Definition: ModuleFeedbackManager.h:73
void setMatrix(float *row0, float *row1, float *row2, float *row3)
void registerObjAtUi(std::string name)
std::string initialObjectName_
Definition: ModuleFeedbackManager.h:146
std::string ModuleName(const char *) const
bool comparePlugin(const char *pluginName)
std::string attrPartName_
Definition: ModuleFeedbackManager.h:144
std::string getMenuName() const