Ejemplo n.º 1
0
glc::WidgetEventFlag GLC_CuttingPlane::select(const GLC_Point3d& pos, GLC_uint)
{
	Q_ASSERT(NULL == m_pCurrentManipulator);
	Q_ASSERT(TranslationManipulator == m_CurrentManipulator);

	//! Create the default manipulator
	GLC_Viewport* pViewport= GLC_3DWidget::widgetManagerHandle()->viewport();
	m_pCurrentManipulator= new GLC_PullManipulator(pViewport, m_Normal);

	m_pCurrentManipulator->enterManipulateState(pos);
	m_CurrentNavigatorPosition= pos;

	GLC_3DWidget::set3DViewInstanceVisibility(1, true);

	updateWidgetRep();

	return glc::BlockedEvent;
}
glc::WidgetEventFlag GLC_CuttingPlane::mousePressed(const GLC_Point3d& pos, Qt::MouseButton button, GLC_uint id)
{
	glc::WidgetEventFlag returnFlag= glc::IgnoreEvent;
	if (button == Qt::LeftButton)
	{
		const int selectedInstanceIndex= GLC_3DWidget::indexOfIntsanceId(id);
		if (selectedInstanceIndex > 0)
		{
			m_SelectionIndex= selectedInstanceIndex;
			if (m_CurrentManipulator == RotationManipulator)
			{
				delete m_pCurrentManipulator;
				m_pCurrentManipulator= rotationNavigator(selectedInstanceIndex);
			}
			m_pCurrentManipulator->enterManipulateState(pos);
		}
		else
		{
			if (NULL != m_pCurrentManipulator)
			{
				if (m_CurrentManipulator == RotationManipulator)
				{
					delete m_pCurrentManipulator;
					m_pCurrentManipulator= NULL;
				}
				else
				{
					m_pCurrentManipulator->enterManipulateState(pos);
				}

			}
			m_CurrentNavigatorPosition= pos;
			updateWidgetRep();
		}

		returnFlag= glc::BlockedEvent;
	}

	return returnFlag;
}