GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_3dwidgetmanagerhandle.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
23 
24 #ifndef GLC_3DWIDGETMANAGERHANDLE_H_
25 #define GLC_3DWIDGETMANAGERHANDLE_H_
26 
27 #include "../glc_config.h"
28 #include "../sceneGraph/glc_3dviewcollection.h"
29 #include "../viewport/glc_viewport.h"
30 
31 class GLC_3DVIewInstance;
32 class GLC_3DWidget;
33 
35 {
36 
38 
40 
41 public:
44 
48 
50 
52 
53 public:
55  inline bool isOrphan() const
56  {return 0 == m_Count;}
57 
59  inline GLC_3DViewInstance* instanceHandle(GLC_uint id)
60  {return m_Collection.instanceHandle(id);}
61 
63  inline bool hasAnActiveWidget() const
64  {return 0 != m_Active3DWidgetId;}
65 
67  inline const GLC_Camera* cameraHandle() const
68  {return m_pViewport->cameraHandle();}
69 
71  inline GLC_BoundingBox boundingBox()
72  {return m_Collection.boundingBox();}
73 
75  inline bool useOrtho() const
76  {return m_pViewport->useOrtho();}
77 
79  double viewportTangent() const
80  {return m_pViewport->viewTangent();}
81 
83  inline GLC_Viewport* viewport() const
84  {return m_pViewport;}
85 
87  inline bool contains3DWidget(GLC_uint id) const
88  {return m_3DWidgetHash.contains(id);}
89 
91  inline GLC_3DWidget* widget(GLC_uint id) const
92  {return m_3DWidgetHash.value(id);}
93 
95  inline bool isEmpty() const
96  {return m_3DWidgetHash.isEmpty();}
97 
99 
101 
103 
104 public:
106  inline void increment()
107  {++m_Count;}
108 
110  inline void decrement()
111  {--m_Count;}
112 
114  void add3DWidget(GLC_3DWidget* p3DWidget);
115 
117 
118  void remove3DWidget(GLC_uint id);
119 
121 
122  GLC_3DWidget* take(GLC_uint id);
123 
125  void add3DViewInstance(const GLC_3DViewInstance& instance, GLC_uint widgetId);
126 
128  void remove3DViewInstance(GLC_uint id);
129 
131  void clear();
132 
134  void setWidgetVisible(GLC_uint id, bool visible);
135 
137 
138 
140 
141 public:
143  glc::WidgetEventFlag mouseDoubleClickEvent(QMouseEvent * pEvent);
144 
146  glc::WidgetEventFlag mouseMoveEvent(QMouseEvent * pEvent);
147 
149  glc::WidgetEventFlag mousePressEvent(QMouseEvent * pEvent);
150 
152  glc::WidgetEventFlag mouseReleaseEvent(QMouseEvent * pEvent);
153 
155 
157 
159 
160 public:
162  void render();
163 
165 
167 // Private services function
169 private:
171  QPair<GLC_uint, GLC_Point3d> select(QMouseEvent* event);
172 
174 // Private Member
176 private:
179 
181  int m_Count;
182 
184  QHash<GLC_uint, GLC_3DWidget*> m_3DWidgetHash;
185 
187  QHash<GLC_uint, GLC_uint> m_MapBetweenInstanceWidget;
188 
191 
194 
197 };
198 
199 #endif /* GLC_3DWIDGETMANAGERHANDLE_H_ */

©2005-2013 Laurent Ribon