Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 #ifndef GLINTERACTOR_H 00020 #define GLINTERACTOR_H 00021 00022 #include <tulip/InteractorComposite.h> 00023 00024 #include <QIcon> 00025 00026 namespace tlp { 00027 00028 class GlMainWidget; 00029 00030 /** 00031 * @brief The GLInteractorComponent class is an InteractorComponent that can do OpenGL rendering on a GlMainWidget. 00032 * 00033 * @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. 00034 * 00035 * GLInteractorComponent are meant to be stored into a GLInteractorComposite 00036 * When installed on a GlMainWidget, this interactor will have two new methods getting called: 00037 * @list 00038 * @li draw: Draws a visual feedback into the OpenGL scene. This is called after the scene was rendered 00039 * @li compute: Allows the interactor to do some pre-initialisation steps before the OpenGL scene is rendered. 00040 * @endlist 00041 */ 00042 class TLP_QT_SCOPE GLInteractorComponent: public tlp::InteractorComponent { 00043 Q_OBJECT 00044 public slots: 00045 00046 /** 00047 * @brief Draws an OpenGL visual feedback for the interactor into a given GlMainWidget. 00048 * This method is called after the scene was rendered. 00049 * @return true if the rendering completed sucessfully 00050 */ 00051 virtual bool draw(tlp::GlMainWidget*) { 00052 return false; 00053 } 00054 00055 /** 00056 * @brief Initializes the interactor before the scene in the given GlMainWidget is rendered 00057 */ 00058 virtual bool compute(tlp::GlMainWidget*) { 00059 return false; 00060 } 00061 }; 00062 00063 /** 00064 * @brief The GLInteractorComposite class behaves like a InteractorComposite but is meant to store GLInteractorComponent. 00065 * @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. 00066 */ 00067 class TLP_QT_SCOPE GLInteractorComposite: public tlp::InteractorComposite { 00068 Q_OBJECT 00069 00070 public: 00071 GLInteractorComposite(const QIcon& icon, const QString& text=""); 00072 00073 public slots: 00074 /** 00075 * @brief Calls the compute method on every sub-components 00076 * @note You can subclass this method to add custom behavior before or after components are called. 00077 */ 00078 virtual void compute(tlp::GlMainWidget*); 00079 00080 /** 00081 * @brief Calls the draw method on every sub-components 00082 * @note You can subclass this method to add custom behavior before or after components are called. 00083 */ 00084 virtual void draw(tlp::GlMainWidget*); 00085 }; 00086 00087 } 00088 00089 #endif // GLINTERACTOR_H