glc_3dwidget.cpp
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 #include "glc_3dwidget.h"
00027
00028
00029 GLC_3DWidget::GLC_3DWidget(GLC_3DWidgetManagerHandle* pWidgetManagerHandle)
00030 : QObject()
00031 , m_Uid(glc::GLC_Gen3DWidgetID())
00032 , m_pWidgetManagerHandle(pWidgetManagerHandle)
00033 , m_InstanceIdList()
00034 {
00035
00036 }
00037
00038 GLC_3DWidget::GLC_3DWidget(const GLC_3DWidget& widget)
00039 : QObject()
00040 , m_Uid(glc::GLC_Gen3DWidgetID())
00041 , m_pWidgetManagerHandle(widget.m_pWidgetManagerHandle)
00042 , m_InstanceIdList()
00043 {
00044
00045 const int size= widget.m_InstanceIdList.size();
00046 for (int i= 0; i < size; ++i)
00047 {
00048 GLC_3DViewInstance newInstance(widget.m_pWidgetManagerHandle->instanceHandle(widget.m_InstanceIdList.at(i))->deepCopy());
00049 GLC_uint newId= newInstance.id();
00050 m_InstanceIdList.append(newId);
00051 m_pWidgetManagerHandle->add3DViewInstance(newInstance, m_Uid);
00052 }
00053 }
00054
00055 GLC_3DWidget::~GLC_3DWidget()
00056 {
00057 remove3DViewInstance();
00058 }
00059
00060 bool GLC_3DWidget::operator==(const GLC_3DWidget& widget) const
00061 {
00062 return this == &widget;
00063 }
00064
00065 GLC_3DWidget& GLC_3DWidget::operator=(const GLC_3DWidget& widget)
00066 {
00067 if (this != &widget)
00068 {
00069 remove3DViewInstance();
00070
00071 m_Uid= widget.m_Uid;
00072 m_pWidgetManagerHandle= widget.m_pWidgetManagerHandle;
00073 m_InstanceIdList= widget.m_InstanceIdList;
00074
00075
00076 const int size= widget.m_InstanceIdList.size();
00077 for (int i= 0; i < size; ++i)
00078 {
00079 GLC_3DViewInstance newInstance(widget.m_pWidgetManagerHandle->instanceHandle(widget.m_InstanceIdList.at(i))->deepCopy());
00080 GLC_uint newId= newInstance.id();
00081 m_InstanceIdList.append(newId);
00082 m_pWidgetManagerHandle->add3DViewInstance(newInstance, m_Uid);
00083 }
00084 }
00085 return *this;
00086 }
00087
00088 void GLC_3DWidget::setWidgetManager(GLC_3DWidgetManagerHandle* pWidgetManagerHandle)
00089 {
00090 if (NULL != m_pWidgetManagerHandle)
00091 {
00092 m_pWidgetManagerHandle->take(m_Uid);
00093 remove3DViewInstance();
00094 }
00095 m_pWidgetManagerHandle= pWidgetManagerHandle;
00096
00097 create3DviewInstance();
00098 }
00099
00101
00103 glc::WidgetEventFlag GLC_3DWidget::select(const GLC_Point3d&, GLC_uint)
00104 {
00105 return glc::IgnoreEvent;
00106 }
00107
00108 glc::WidgetEventFlag GLC_3DWidget::unselect(const GLC_Point3d&, GLC_uint)
00109 {
00110 return glc::IgnoreEvent;
00111 }
00112
00113 glc::WidgetEventFlag GLC_3DWidget::mouseOver(const GLC_Point3d&, GLC_uint)
00114 {
00115 return glc::IgnoreEvent;
00116 }
00117
00118 glc::WidgetEventFlag GLC_3DWidget::mousePressed(const GLC_Point3d&, Qt::MouseButton, GLC_uint)
00119 {
00120 return glc::IgnoreEvent;
00121 }
00122
00123 glc::WidgetEventFlag GLC_3DWidget::mouseReleased(Qt::MouseButton)
00124 {
00125 return glc::IgnoreEvent;
00126 }
00127
00128 glc::WidgetEventFlag GLC_3DWidget::mouseMove(const GLC_Point3d&, Qt::MouseButtons, GLC_uint)
00129 {
00130 return glc::IgnoreEvent;
00131 }
00132
00133
00135
00137 void GLC_3DWidget::add3DViewInstance(const GLC_3DViewInstance& instance)
00138 {
00139 m_pWidgetManagerHandle->add3DViewInstance(instance, m_Uid);
00140 const GLC_uint instanceId= instance.id();
00141 m_InstanceIdList.append(instanceId);
00142 }
00143
00144 void GLC_3DWidget::remove3DViewInstance()
00145 {
00146 if (NULL != m_pWidgetManagerHandle)
00147 {
00148 const int size= m_InstanceIdList.size();
00149 for (int i= 0; i < size; ++i)
00150 {
00151 m_pWidgetManagerHandle->remove3DViewInstance(m_InstanceIdList.at(i));
00152 }
00153 }
00154 }
00155
00156 void GLC_3DWidget::set3DViewInstanceVisibility(int index, bool visibility)
00157 {
00158 m_pWidgetManagerHandle->instanceHandle(m_InstanceIdList[index])->setVisibility(visibility);
00159 }
00160
00161