OpenWalnut  1.5.0dev
WQtNavGLWidget.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WQTNAVGLWIDGET_H
26 #define WQTNAVGLWIDGET_H
27 
28 #include <map>
29 #include <memory>
30 #include <string>
31 
32 #include <QDockWidget>
33 #include <QSlider>
34 
35 #include "WQtGLDockWidget.h"
36 #include "controlPanel/WPropertyDoubleWidget.h"
37 #include "core/common/WPropertyVariable.h"
38 #include "core/graphicsEngine/WGEGroupNode.h"
39 
40 /**
41  * container widget to hold as GL widget and a slider
42  */
44 {
45  Q_OBJECT
46 
47 public:
48  /**
49  * default constructor
50  *
51  * \param viewTitle Title will be used as view title
52  * \param dockTitle The title of the dock widget.
53  * \param parent The widget that manages this widget
54  * \param sliderTitle Name of the slider corresponding to the property it manipulates
55  * \param shareWidget this widget will share OpenGL display lists and texture objects with shareWidget
56  */
57  WQtNavGLWidget( QString viewTitle, QString dockTitle, QWidget* parent, std::string sliderTitle="pos", const QWidget * shareWidget = 0 );
58 
59  /**
60  * destructor.
61  */
62  virtual ~WQtNavGLWidget();
63 
64  /**
65  * Set the title of the slider used in this nav widget
66  *
67  * \param title the title
68  */
69  void setSliderTitle( std::string title );
70 
71  /**
72  * Sets the property to control by the slider.
73  *
74  * \param prop the property
75  */
76  void setSliderProperty( std::shared_ptr< WPropertyBase > prop );
77 
78  /**
79  * Remove the property to control by the slider.
80  *
81  * \param prop the property
82  */
83  void removeSliderProperty( std::shared_ptr< WPropertyBase > prop );
84 
85 protected:
86 private:
87  /**
88  * The slider's title.
89  */
90  QString m_sliderTitle;
91 
92  /**
93  * the scene which is displayed by the GL widget
94  */
95  osg::ref_ptr< WGEGroupNode > m_scene;
96 
97  /**
98  * Update slider if property changed.
99  */
101 
102  /**
103  * Map holding the widgets for module properties added automatically. So they can be removed again automatically
104  * if the module is removed.
105  */
106  std::map< std::shared_ptr< WPropertyBase >, WPropertyDoubleWidget* > propertyWidgetMap;
107 };
108 
109 #endif // WQTNAVGLWIDGET_H
Implements a property widget for WPropDouble.
Dock widget containing only a GLWidget.
container widget to hold as GL widget and a slider
osg::ref_ptr< WGEGroupNode > m_scene
the scene which is displayed by the GL widget
WQtNavGLWidget(QString viewTitle, QString dockTitle, QWidget *parent, std::string sliderTitle="pos", const QWidget *shareWidget=0)
default constructor
void removeSliderProperty(std::shared_ptr< WPropertyBase > prop)
Remove the property to control by the slider.
void setSliderProperty(std::shared_ptr< WPropertyBase > prop)
Sets the property to control by the slider.
void setSliderTitle(std::string title)
Set the title of the slider used in this nav widget.
void handleChangedPropertyValue()
Update slider if property changed.
std::map< std::shared_ptr< WPropertyBase >, WPropertyDoubleWidget * > propertyWidgetMap
Map holding the widgets for module properties added automatically.
QString m_sliderTitle
The slider's title.
virtual ~WQtNavGLWidget()
destructor.