GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_3dwidget.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_3DWIDGET_H_
25 #define GLC_3DWIDGET_H_
26 #include <QObject>
27 #include <QList>
28 #include "../glc_config.h"
29 #include "../glc_global.h"
31 
32 class GLC_3DViewInstance;
33 
36 
40 
41 class GLC_LIB_EXPORT GLC_3DWidget : public QObject
42 {
43  Q_OBJECT
44 
45  typedef QList<GLC_uint> InstanceIdList;
46 
48 
50 
51 public:
53  GLC_3DWidget(GLC_3DWidgetManagerHandle* pWidgetManagerHandle= NULL);
54 
56  GLC_3DWidget(const GLC_3DWidget& widget);
57 
59  virtual ~GLC_3DWidget();
61 
63 
65 
66 public:
68  inline GLC_uint id() const
69  {return m_Uid;}
70 
72  bool operator==(const GLC_3DWidget& widget) const;
73 
75  inline bool instanceBelongTo(GLC_uint id) const
76  {return m_InstanceIdList.contains(id);}
77 
79  inline const GLC_3DWidgetManagerHandle* widgetManagerHandle() const
80  {return m_pWidgetManagerHandle;}
81 
83  inline bool has3DWidgetManager() const
84  {return (NULL == m_pWidgetManagerHandle);}
85 
87  inline bool useOrtho() const
88  {return m_pWidgetManagerHandle->useOrtho();}
89 
91 
93 
95 
96 public:
98  virtual GLC_3DWidget& operator=(const GLC_3DWidget& widget);
99 
101  void setWidgetManager(GLC_3DWidgetManagerHandle* pWidgetManagerHandle);
102 
104  virtual void updateWidgetRep(){};
105 
107  void setVisible(bool visible);
109 
111 
113 
114 public:
115 
117  virtual glc::WidgetEventFlag select(const GLC_Point3d&, GLC_uint id);
118 
120  virtual glc::WidgetEventFlag unselect(const GLC_Point3d&, GLC_uint id);
121 
123  virtual glc::WidgetEventFlag mouseOver(const GLC_Point3d&, GLC_uint id);
124 
126  virtual glc::WidgetEventFlag mousePressed(const GLC_Point3d&, Qt::MouseButton, GLC_uint id);
127 
129  virtual glc::WidgetEventFlag mouseReleased(Qt::MouseButton);
130 
132  virtual glc::WidgetEventFlag mouseMove(const GLC_Point3d&, Qt::MouseButtons, GLC_uint id);
133 
135 
136 signals:
138  void asChanged();
139 
141 // Protected services function
143 protected:
145  virtual void create3DviewInstance()= 0;
146 
148  inline bool isEmpty() const
149  {return m_InstanceIdList.isEmpty();}
150 
152  void add3DViewInstance(const GLC_3DViewInstance& instance);
153 
155  inline GLC_3DViewInstance* instanceHandle(int index)
156  {return m_pWidgetManagerHandle->instanceHandle(m_InstanceIdList.at(index));}
157 
159  void remove3DViewInstance();
160 
162  void set3DViewInstanceVisibility(int index, bool visibility);
163 
165  inline int indexOfIntsanceId(GLC_uint id)
166  {return m_InstanceIdList.indexOf(id);}
167 
169  virtual void resetViewState()= 0;
170 
172 // Private services function
174 private:
175 
177 // Private Member
179 private:
181 
183 
186 
188  QList<GLC_uint> m_InstanceIdList;
189 
190 };
191 
192 #endif /* GLC_3DWIDGET_H_ */

©2005-2013 Laurent Ribon