glc_3dwidgetmanagerhandle.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00025
00026 #ifndef GLC_3DWIDGETMANAGERHANDLE_H_
00027 #define GLC_3DWIDGETMANAGERHANDLE_H_
00028
00029 #include "../glc_config.h"
00030 #include "../sceneGraph/glc_3dviewcollection.h"
00031 #include "../viewport/glc_viewport.h"
00032
00033 class GLC_3DVIewInstance;
00034 class GLC_3DWidget;
00035
00036 class GLC_LIB_EXPORT GLC_3DWidgetManagerHandle
00037 {
00038
00040
00042
00043 public:
00045 GLC_3DWidgetManagerHandle(GLC_Viewport* pViewport);
00046
00048 ~GLC_3DWidgetManagerHandle();
00050
00052
00054
00055 public:
00057 inline bool isOrphan() const
00058 {return 0 == m_Count;}
00059
00061 inline GLC_3DViewInstance* instanceHandle(GLC_uint id)
00062 {return m_Collection.instanceHandle(id);}
00063
00065 inline bool hasAnActiveWidget() const
00066 {return 0 != m_Active3DWidgetId;}
00067
00069 inline const GLC_Camera* cameraHandle() const
00070 {return m_pViewport->cameraHandle();}
00071
00073 inline GLC_BoundingBox boundingBox()
00074 {return m_Collection.boundingBox();}
00075
00077 inline bool useOrtho() const
00078 {return m_pViewport->useOrtho();}
00079
00081 double viewportTangent() const
00082 {return m_pViewport->viewTangent();}
00083
00085 inline GLC_Viewport* viewport() const
00086 {return m_pViewport;}
00087
00089
00091
00093
00094 public:
00096 inline void increment()
00097 {++m_Count;}
00098
00100 inline void decrement()
00101 {--m_Count;}
00102
00104 void add3DWidget(GLC_3DWidget* p3DWidget);
00105
00107
00108 void remove3DWidget(GLC_uint id);
00109
00111
00112 GLC_3DWidget* take(GLC_uint id);
00113
00115 void add3DViewInstance(const GLC_3DViewInstance& instance, GLC_uint widgetId);
00116
00118 void remove3DViewInstance(GLC_uint id);
00119
00121 void clear();
00122
00124
00125
00127
00128 public:
00130 glc::WidgetEventFlag mouseDoubleClickEvent(QMouseEvent * pEvent);
00131
00133 glc::WidgetEventFlag mouseMoveEvent(QMouseEvent * pEvent);
00134
00136 glc::WidgetEventFlag mousePressEvent(QMouseEvent * pEvent);
00137
00139 glc::WidgetEventFlag mouseReleaseEvent(QMouseEvent * pEvent);
00140
00142
00144
00146
00147 public:
00149 void render();
00150
00152
00154
00156 private:
00158 QPair<GLC_uint, GLC_Point3d> select(QMouseEvent* event);
00159
00161
00163 private:
00165 GLC_3DViewCollection m_Collection;
00166
00168 int m_Count;
00169
00171 QHash<GLC_uint, GLC_3DWidget*> m_3DWidgetHash;
00172
00174 QHash<GLC_uint, GLC_uint> m_MapBetweenInstanceWidget;
00175
00177 GLC_Viewport* m_pViewport;
00178
00180 GLC_uint m_Active3DWidgetId;
00181
00183 GLC_uint m_Preselected3DWidgetId;
00184
00186 GLC_Matrix4x4 m_PreviousViewMatrix;
00187
00188 };
00189
00190 #endif