Exemplo n.º 1
0
void ccPointPairRegistrationDlg::addManualRefPoint()
{
	ccAskThreeDoubleValuesDlg ptsDlg("x", "y", "z", -1.0e12, 1.0e12, s_last_rx, s_last_ry, s_last_rz, 8, "Add reference point", this);

	//if the reference entity is shifted, the user has the choice to input virtual
	//points either in the original coordinate system or the shifted one
	//(if there's no reference entity, we use a 'global'	one by default)
	bool refIsShifted = (m_reference.entity && ccHObjectCaster::ToGenericPointCloud(m_reference.entity)->isShifted());
	if (refIsShifted)
		ptsDlg.showCheckbox("Not shifted",s_last_r_isGlobal,s_aligned_tooltip);

	if (!ptsDlg.exec())
		return;

	//save values for current session
	s_last_rx = ptsDlg.doubleSpinBox1->value();
	s_last_ry = ptsDlg.doubleSpinBox2->value();
	s_last_rz = ptsDlg.doubleSpinBox3->value();
	bool shifted = (m_reference.entity != 0);
	if (refIsShifted)
	{
		s_last_r_isGlobal = ptsDlg.getCheckboxState();
		shifted = !s_last_r_isGlobal;
	}

	CCVector3d P(s_last_rx,s_last_ry,s_last_rz);

	addReferencePoint(P,0,shifted);
}
Exemplo n.º 2
0
void ccPointPairRegistrationDlg::processPickedItem(ccHObject* entity, unsigned itemIndex, int x, int y, const CCVector3& P)
{
	if (!m_associatedWin)
		return;
	
	//no point picking when paused!
	if (m_paused)
		return;

	if (!entity)
		return;

	CCVector3d pin = CCVector3d::fromArray(P.u);

	if (entity == m_aligned.entity)
	{
		addAlignedPoint(pin, m_aligned.entity, true); //picked points are always shifted by default
	}
	else if (entity == m_reference.entity)
	{
		addReferencePoint(pin, m_reference.entity, true); //picked points are always shifted by default
	}
	else
	{
		assert(false);
		return;
	}
	m_associatedWin->redraw();
}
void ccPointPairRegistrationDlg::onItemPicked(const PickedItem& pi)
{
	if (!m_associatedWin)
		return;
	
	//no point picking when paused!
	if (m_paused)
		return;

	if (!pi.entity)
		return;

	CCVector3d pin = CCVector3d::fromArray(pi.P3D.u);

	if (pi.entity == m_aligned.entity)
	{
		addAlignedPoint(pin, m_aligned.entity, true); //picked points are always shifted by default
	}
	else if (pi.entity == m_reference.entity)
	{
		addReferencePoint(pin, m_reference.entity, true); //picked points are always shifted by default
	}
	else
	{
		assert(false);
		return;
	}
	m_associatedWin->redraw();
}