Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
GLInteractor.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 #ifndef GLINTERACTOR_H
20 #define GLINTERACTOR_H
21 
22 #include <tulip/InteractorComposite.h>
23 
24 namespace tlp {
25 
26 class GlMainWidget;
27 
28 /**
29  * @brief The GLInteractorComponent class is an InteractorComponent that can do OpenGL rendering on a GlMainWidget.
30  *
31  * @warning Only GLInteractorComponent that are stored into a GLInteractorComposite will be able to do OpenGL rendering. Storing them into an InteractorComposite will have no effect.
32  *
33  * GLInteractorComponent are meant to be stored into a GLInteractorComposite
34  * When installed on a GlMainWidget, this interactor will have two new methods getting called:
35  * @list
36  * @li draw: Draws a visual feedback into the OpenGL scene. This is called after the scene was rendered
37  * @li compute: Allows the interactor to do some pre-initialisation steps before the OpenGL scene is rendered.
38  * @endlist
39  */
40 class TLP_QT_SCOPE GLInteractorComponent: public tlp::InteractorComponent {
41  Q_OBJECT
42 public slots:
43 
44  /**
45  * @brief Draws an OpenGL visual feedback for the interactor into a given GlMainWidget.
46  * This method is called after the scene was rendered.
47  * @return true if the rendering completed sucessfully
48  */
49  virtual bool draw(tlp::GlMainWidget*) {
50  return false;
51  }
52 
53  /**
54  * @brief Initializes the interactor before the scene in the given GlMainWidget is rendered
55  */
56  virtual bool compute(tlp::GlMainWidget*) {
57  return false;
58  }
59 };
60 
61 /**
62  * @brief The GLInteractorComposite class behaves like a InteractorComposite but is meant to store GLInteractorComponent.
63  * @warning Only GLInteractorComponent that are stored into a GLInteractorComposite will be able to do OpenGL rendering. Storing them into an InteractorComposite will have no effect.
64  */
65 class TLP_QT_SCOPE GLInteractorComposite: public tlp::InteractorComposite {
66  Q_OBJECT
67 
68 public:
69  GLInteractorComposite(const QIcon& icon, const QString& text="");
70 
71 public slots:
72  /**
73  * @brief Calls the compute method on every sub-components
74  * @note You can subclass this method to add custom behavior before or after components are called.
75  */
76  virtual void compute(tlp::GlMainWidget*);
77 
78  /**
79  * @brief Calls the draw method on every sub-components
80  * @note You can subclass this method to add custom behavior before or after components are called.
81  */
82  virtual void draw(tlp::GlMainWidget*);
83 };
84 
85 }
86 
87 #endif // GLINTERACTOR_H