Tulip  5.2.1
Large graphs analysis and drawing
GLInteractor.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
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 #include <QIcon>
25 
26 namespace tlp {
27 
28 class GlMainWidget;
29 
30 /**
31  * @brief The GLInteractorComponent class is an InteractorComponent that can do OpenGL rendering on
32  * a GlMainWidget.
33  *
34  * @warning Only GLInteractorComponent that are stored into a GLInteractorComposite will be able to
35  * do OpenGL rendering. Storing them into an InteractorComposite will have no effect.
36  *
37  * GLInteractorComponent are meant to be stored into a GLInteractorComposite
38  * When installed on a GlMainWidget, this interactor will have two new methods getting called:
39  * @list
40  * @li draw: Draws a visual feedback into the OpenGL scene. This is called after the scene was
41  * rendered
42  * @li compute: Allows the interactor to do some pre-initialisation steps before the OpenGL scene is
43  * rendered.
44  * @endlist
45  */
46 class TLP_QT_SCOPE GLInteractorComponent : public tlp::InteractorComponent {
47  Q_OBJECT
48 public slots:
49 
50  /**
51  * @brief Draws an OpenGL visual feedback for the interactor into a given GlMainWidget.
52  * This method is called after the scene was rendered.
53  * @return true if the rendering completed sucessfully
54  */
55  virtual bool draw(tlp::GlMainWidget *) {
56  return false;
57  }
58 
59  /**
60  * @brief Initializes the interactor before the scene in the given GlMainWidget is rendered
61  */
62  virtual bool compute(tlp::GlMainWidget *) {
63  return false;
64  }
65 };
66 
67 /**
68  * @brief The GLInteractorComposite class behaves like a InteractorComposite but is meant to store
69  * GLInteractorComponent.
70  * @warning Only GLInteractorComponent that are stored into a GLInteractorComposite will be able to
71  * do OpenGL rendering. Storing them into an InteractorComposite will have no effect.
72  */
73 class TLP_QT_SCOPE GLInteractorComposite : public tlp::InteractorComposite {
74  Q_OBJECT
75 
76 public:
77  GLInteractorComposite(const QIcon &icon, const QString &text = "");
78 
79 public slots:
80  /**
81  * @brief Calls the compute method on every sub-components
82  * @note You can subclass this method to add custom behavior before or after components are
83  * called.
84  */
85  virtual void compute(tlp::GlMainWidget *);
86 
87  /**
88  * @brief Calls the draw method on every sub-components
89  * @note You can subclass this method to add custom behavior before or after components are
90  * called.
91  */
92  virtual void draw(tlp::GlMainWidget *);
93 };
94 } // namespace tlp
95 
96 #endif // GLINTERACTOR_H
The GLInteractorComposite class behaves like a InteractorComposite but is meant to store GLInteractor...
Definition: GLInteractor.h:73
virtual bool compute(tlp::GlMainWidget *)
Initializes the interactor before the scene in the given GlMainWidget is rendered.
Definition: GLInteractor.h:62
virtual bool draw(tlp::GlMainWidget *)
Draws an OpenGL visual feedback for the interactor into a given GlMainWidget. This method is called a...
Definition: GLInteractor.h:55
The GLInteractorComponent class is an InteractorComponent that can do OpenGL rendering on a GlMainWid...
Definition: GLInteractor.h:46
This widget provide a simple system to visualize data/graph with OpenGL 3D engine.
Definition: GlMainWidget.h:66