void ccPointPairRegistrationDlg::addManualAlignedPoint()
{
	ccAskThreeDoubleValuesDlg ptsDlg("x", "y", "z", -1.0e12, 1.0e12, s_last_ax, s_last_ay, s_last_az, 8, "Add aligned point", this);

	//if the aligned entity is shifted, the user has the choice to input virtual point either
	//in the original coordinate system or the shifted one
	bool alignIsShifted = (m_aligned.entity && ccHObjectCaster::ToGenericPointCloud(m_aligned.entity)->isShifted());
	if (alignIsShifted)
		ptsDlg.showCheckbox("Not shifted",s_last_a_isGlobal,s_aligned_tooltip);

	if (!ptsDlg.exec())
		return;

	//save values for current session
	s_last_ax = ptsDlg.doubleSpinBox1->value();
	s_last_ay = ptsDlg.doubleSpinBox2->value();
	s_last_az = ptsDlg.doubleSpinBox3->value();
	bool shifted = true;
	if (alignIsShifted)
	{
		s_last_a_isGlobal = ptsDlg.getCheckboxState();
		shifted = !s_last_a_isGlobal;
	}

	CCVector3d P(s_last_ax,s_last_ay,s_last_az);

	addAlignedPoint(P,0,shifted);
}
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();
}