#include "stdafx.h"
#include "DynamicDraw.h"		// For FFGetApp.
#include "FoundDoc.h"			// For g_pDoc.
#include "DynamicDrawView.h"	// For g_pView.
#include "ObjDynabase.h"			// For FCObjDynabase.
// 06.10.05 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
#include "UtilStdLib.h"			// For m1_for.
#include "UtilCoord.h"			// For mm2lg.etc.
#include "UtilBezier.h"			// For CalcBezier2.
#include "UtilGraph.h"			// For FCEditDraw.
// 06.10.05 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
#include "UtilStdLib.h"			// For m1_for.
#include "RegData.h"			// For GetOptiRegColor.
#include "FrameWnd.h"			// For FFGetMainWnd().
#include "ToolPoly.h"			// This header.

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::Select
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iClBiCmMiDgDiBfLiDiLiCkKjBeJjBpAiClDiCoKiClNiCmGiCkLiBeBiDfCiBfLiDiLiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iPpDjBnEjBeKiInKiCpAjHjIjHhAiClFiClNiDeBiDiLiDfDiDiKiDfJiDiAiCmJjFmPiNfIiBeC_xHqqkZx_
 *************************************************************************/
void FCToolPoly::Select (CDC* pDC)
{
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::Select(pDC);
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iMlLiNnNiCmMiJlMjApMiNmAjFfHiBeC_xHqqkZx_
//	m_vlgptPoly.clear();
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
} // FCToolPoly::Select.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::Unselect
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iClBiCmMiDgDiBfLiDiLiCkKjBeJjBpAiJpAiPjMiClDiCoKiClNiCmGiCkLiBeBiDfCiBfLiDiLiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiBeC_xHqqkZx_
 *************************************************************************/
void FCToolPoly::Unselect (CDC* pDC)
{
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iMlLiNnNiCmMiJlMjApMiNmAjFfHiBeC_xHqqkZx_
//	m_vlgptPoly.clear();
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::Unselect(pDC);
} // FCToolPoly::Unselect.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::GetDefaultIdleCursor
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	StateIdle_xZkqqHx_iCmFiDgGiDhEiDeIiDiLiDgHiCmJiOgHiCoNiCoKiCoJiDeKiBfLiDfMiDiLiDgOiDjDiDgIiDiLiCpAjFnEiClHiBeC_xHqqkZx_
 *			_xZkqqHx_jFfHiPiAiCmMiDeKiBfLiDfMiDiLiCmMiPoKiNiHiCmN_xHqqkZx_ NULL_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.04.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
HCURSOR FCToolPoly::GetDefaultIdleCursor () const
{
	return FFGetApp()->LoadCursor(IDC_CURSOR_TOOL_POLYLINE);
} // FCToolPoly::GetDefaultIdleCursor.

//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::CalcEditLine
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iJlMjApMiCpAiMhGiOfKiClHiCoJiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	lBeginIndex	:_xZkqqHx_iJlMjApMiCpAjFgAiJoGiClHiCoJjEmNiImNiCmMiBeBiNmFiPiJiCmMjIeBiMiLjDfPiDeDiDjDiDgGiDgCiDeOiDfIiCpA_xHqqkZx_
// *						 _xZkqqHx_iOhHjCoIiBeC_xHqqkZx_
// *			lJointCount	:_xZkqqHx_iJlMjApMiCpAjFgAiJoGiClHiCoJjEmNiImNiCmMjIeBiMiLjDfPjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//void FCToolPoly::CalcEditLine (long lBeginIndex, long lJointCount)
//{
//	// _xZkqqHx_iJoGjGmKiCmMjFgAiJoGjHmMiIoGiCpAiOoGjDlOiBeC_xHqqkZx_
//	CRect lgrtView;
//	g_pView->GetClientRectLG(lgrtView);
//	// _xZkqqHx_iJlMjApMiNmAjFfHjEhKjHpBiCpAiDeOiDiKiDeBiBeC_xHqqkZx_
//	m_vlgptPoly.clear();
//	//----- _xZkqqHx_iJlMjApMiCpAiMhGiOfK_xHqqkZx_ -----
//	::CalcBezier2(	m_vlgptPoly,
//					(const FCPolyJoint*)m_pjvJoint.begin(),
//					m_pjvJoint.size(),
//					GetReferenceObject()->GetStdPenWeight(),
//					lBeginIndex,
//					lJointCount,
//					g_->lgdPrecision,
//					g_->dZoom,
//					&lgrtView, 1,
//					::StdMinRatio(lgrtView));
//} // FCToolPoly::CalcEditLine.
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::DrawEditLine
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jBePiJpBiMhGiOfKiClFiClNiJlMjApMiCpAjFgAiJoGiBgJiPmBiLiOiBgKiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGiBgJiPmBiLiOiBgKjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiBeC_xHqqkZx_
 *			lCount	:_xZkqqHx_iCkCiCkNiCmCjBePiCmMiDhIiDfHiDeGiCnMiCmFjFgAiJoGiBgJiPmBiLiOiBgKiClHiCoJiCkJiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::DrawEditLine (CDC* pDC, long lCount)
{
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	// _xZkqqHx_iJlMjApMiCkKjGlDiCkCiCmIiCoHiCmOjFjMiLeBiBeC_xHqqkZx_
//	if (m_vlgptPoly.empty()) return;
//
//	// _xZkqqHx_iPeDjAlDjApMjFgAiJoGjHhAiDeOiDiJiDfIiCpAiNoMjAkMiBeC_xHqqkZx_
//	// const _xZkqqHx_iCmJjBmOiJjOiClFiCmEiBeB_xHqqkZx_GetReferenceObject _xZkqqHx_iCpA_xHqqkZx_ const _xZkqqHx_iCmJiBeC_xHqqkZx_
//	FCEditDraw eDraw(pDC, mm2lg(GetReferenceObject()->GetStdPenWeight()));
//	//----- _xZkqqHx_iJlMjApMiCpAjFgAiJoGiBgJiPmBiLiOiBgK_xHqqkZx_ -----
//	eDraw.Polyline(m_vlgptPoly.begin(), m_vlgptPoly.size());
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	// _xZkqqHx_iMlLiNnNiCmMiJlMjApMiNmAjFfHiBeC_xHqqkZx_
	CPointVector vlgptPoly;
	// _xZkqqHx_iJoGjGmKiCmMjFgAiJoGjHmMiIoGiCpAiOoGjDlOiBeC_xHqqkZx_
	CRect lgrtView;
	g_pView->GetClientRectLG(lgrtView);
	// _xZkqqHx_iPeDjAlDjApMjFgAiJoGjHhAiDeOiDiJiDfIiCpAiNoMjAkMiBeC_xHqqkZx_
	// const _xZkqqHx_iCmJjBmOiJjOiClFiCmEiBeB_xHqqkZx_GetReferenceObject _xZkqqHx_iCpA_xHqqkZx_ const _xZkqqHx_iCmJiBeC_xHqqkZx_
	FCEditDraw eDraw(pDC, mm2lg(GetReferenceObject()->GetStdPenWeight()));
	//----- _xZkqqHx_iJlMjApMiCpAiMhGiOfK_xHqqkZx_ -----
	while (lCount != 0)
	{
		// 1 < lCount _xZkqqHx_iCmMiPoKiNiHiCmFiCoAiBeBiDhIiDfHiDeGiCpAjIeBjBlBiClDiClJiClI_xHqqkZx_
		// _xZkqqHx_iCfAiDfKiDePiDiBiDjDiDgHiClCiCmGiCmJjFgAiJoGiClHiCoJiBeCiDfDiDhOiCpAiOgDiClDiCmIiCkCiClNiCnPiBeC_xHqqkZx_
		::CalcBezier2(	vlgptPoly,
						(const FCPolyJoint*)m_pjvJoint.begin(),
						m_pjvJoint.size(),
						GetReferenceObject()->GetStdPenWeight(),
						m_pjvJoint.size() - 1 - lCount,
						1,
						g_->lgdPrecision,
						g_->dZoom,
						&lgrtView, 1,
						::StdMinRatio(lgrtView));
		//----- _xZkqqHx_iJlMjApMiCpAjFgAiJoGiBgJiPmBiLiOiBgK_xHqqkZx_ -----
		eDraw.Polyline(vlgptPoly.begin(), vlgptPoly.size());
		lCount--;
	}
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
} // FCToolPoly::DrawEditLine.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateStartJoint
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jIeBiMiLjDfPjAnNjCoIiKeKiOgOiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateStartJoint (CDC* pDC)
{
	TRACE(_T("StateStartJoint\r\n"));
	// OnLButtonUp_xZkqqHx_iCnMiCmFiClBiCmM_xHqqkZx_Window_xZkqqHx_iCmJiDeDiDhIiDjDiDgHiBeC_xHqqkZx_
	::FFSetCapture(g_pView->m_hWnd);
	m_pjvJoint.clear();
	// _xZkqqHx_iNmFiPiJiCmMjDfPiCmGiJlMjDfPiCpAiLeMjIfOiBeC_xHqqkZx_
	m_pjvJoint.push_back(FCPolyJoint(FDJT_BTH_PULL_0, m_mmptCnv,
									DBLPoint(0,0), DBLPoint(0,0)));
	m_pjvJoint.push_back(FCPolyJoint(FDJT_BTH_PULL_0, m_mmptCnv,
									DBLPoint(0,0), DBLPoint(0,0)));
	//----- _xZkqqHx_iDhNiDeFiDfIiDeKiBfLiDfMiDiLiCmMjAkHiMmAjApMiCpAjAnNjCoIiClHiCoJ_xHqqkZx_ -----
	m_mmptFix = m_mmptCnv;
	m_mmlnvAry.clear();
	m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(0, 1)));
	m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, 0)));
	m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, 1)));
	m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, -1)));
	// _xZkqqHx_iOkJjDkOiDfIiDeOiDiNiBfLiDiLiBgJiJoGjGmKiCpAiCmNiCnNiPgPiClFiClNiOjOiBgKiCpAiCgOiCgNiBeC_xHqqkZx_
	g_pView->SetAutoScroll(TRUE);
} // FCToolPoly::StateStartJoint.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateSetJoint
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jIeBiMiLjDfPjAnNjCoIiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateSetJoint (CDC* pDC)
{
	TRACE(_T("StateSetJoint\r\n"));
	// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDhNiBfLiDeOiCpAiPmBiLiOiBeC_xHqqkZx_
	DrawMark(pDC, TRUE);
//----- 06.12.26 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	if (m_pjvJoint[m_pjvJoint.size() - 1].m_mmptPivot !=
//		m_pjvJoint[m_pjvJoint.size() - 2].m_mmptPivot)
//----- 06.12.26 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	// _xZkqqHx_iClBiClBiCmFiCmN_xHqqkZx_ rougheq _xZkqqHx_iCpAiOgHiCkEiBeCiCoNiClIiCkJiCmIiIoBiCkCiCmFiClHiCoIjElCiCkPiCoJiPoKiNiHiCkKiCkAiCoJiClNiCnPiBeC_xHqqkZx_
	if (!rougheq(m_pjvJoint[m_pjvJoint.size() - 1].m_mmptPivot,
				m_pjvJoint[m_pjvJoint.size() - 2].m_mmptPivot))
//----- 06.12.26 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
	//----- _xZkqqHx_jBePiJpBiCfBjDfPiCkKiIoBiCkEiImKjChFiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jAfGiClFiCkCiJlMjDfPiCpAiLeMjIfOiBeC_xHqqkZx_
		m_pjvJoint.push_back(FCPolyJoint(FDJT_BTH_PULL_0,
										m_pjvJoint.back().m_mmptPivot,
										DBLPoint(0,0), DBLPoint(0,0)));
		//----- _xZkqqHx_iDhNiDeFiDfIiDeKiBfLiDfMiDiLiCmMjAkHiMmAjApMiCpAjAnNjCoIiClHiCoJ_xHqqkZx_ -----
		m_mmptFix = m_pjvJoint[m_pjvJoint.size() - 2].m_mmptPivot;
		m_mmlnvAry.clear();
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(0, 1)));
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, 0)));
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, 1)));
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, -1)));
	} else
	//----- _xZkqqHx_jBePiJpBiCfBjDfPiCkKjDkPiClGiImKjChFiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jBePiJpBiCmMiJlMjApMiCpAiMhGiOfKiBjFiPmBiLiOiBeC_xHqqkZx_
		DrawEditLine(pDC, 1);
	}
} // FCToolPoly::StateSetJoint.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateUnsetJoint
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jIeBiMiLjDfPiJpAiPjMiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.04.25 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateUnsetJoint (CDC* pDC)
{
	// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDhNiBfLiDeOiCpAiPmBiLiOiBeC_xHqqkZx_
	DrawMark(pDC, TRUE);
	if (m_pjvJoint.size() != 2)
	//----- _xZkqqHx_iOgOjDfPiCmMiCnNiCmFiCmNiCmIiCkCiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jBePiBfIiJpBiCnMiCmFiCmMiJlMjApMiCpAiMhGiOfKiBjFiPmBiLiOiBeC_xHqqkZx_
		DrawEditLine(pDC, 2);
		// _xZkqqHx_iJlMjDfPiCpAiIoKiCmCiNoNiPjMiBeC_xHqqkZx_
		m_pjvJoint.pop_back();
		//----- _xZkqqHx_iDhNiDeFiDfIiDeKiBfLiDfMiDiLiCmMjAkHiMmAjApMiCpAjAnNjCoIiClHiCoJ_xHqqkZx_ -----
		m_mmptFix = m_pjvJoint[m_pjvJoint.size() - 2].m_mmptPivot;
		m_mmlnvAry.clear();
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(0, 1)));
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, 0)));
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, 1)));
		m_mmlnvAry.push_back(DBLLine(m_mmptFix, m_mmptFix + DBLPoint(1, -1)));
	} else
	//----- _xZkqqHx_iOgOjDfPiCmMiCnNiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jBePiJpBiCmMiJlMjApMiCpAiMhGiOfKiBjFiPmBiLiOiBeC_xHqqkZx_
		DrawEditLine(pDC, 1);
	}
} // FCToolPoly::StateUnsetJoint.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateEraseJoint
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLiPmBiLiOiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.04.25 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateEraseJoint (CDC* pDC)
{
	// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDhNiBfLiDeOiCpAiPmBiLiOiBeC_xHqqkZx_
	DrawMark(pDC, TRUE);
	// _xZkqqHx_jBePiJpBiCmMiJlMjApMiCpAiPmBiLiOiBeC_xHqqkZx_
	DrawEditLine(pDC, 1);
} // FCToolPoly::StateEraseJoint.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateDrawJoint
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLjFfMiOkGiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateDrawJoint (CDC* pDC)
{
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	TRACE(_T("StateDrawJoint\r\n"));
//	// _xZkqqHx_jAfGiClFiCkCiDhNiBfLiDeOiNmAjFfHjAnNjCoIiBeC_xHqqkZx_
//	m_mmptMarkNew = m_mmptCnv;
//	// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDhNiBfLiDeOiCpAiPmBiLiOiBeC_xHqqkZx_
//	DrawMark(pDC, TRUE);
//	// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDhNiBfLiDeOiCpAjFgAiJoGiBeC_xHqqkZx_
//	DrawMark(pDC, FALSE);
//	// _xZkqqHx_jBePiJpBiCmMiJlMjApMiCpAiPmBiLiOiBeC_xHqqkZx_
//	DrawEditLine(pDC);
//	// _xZkqqHx_jAfGiClFiCkCiOlCjDfPiCpAjAnNjCoIiBeC_xHqqkZx_
//	m_pjvJoint.back().m_mmptPivot = m_mmptCnv;
//	DrawEditLine(pDC);
//	// _xZkqqHx_iDiLiBfLiDiJiBfLiDhNiDeFiDfIiDhNiBfLiDeKiBfLjFfMiOkGiBeCiDhNiBfLiDeOiImKjChFiCmJjFfMiOkGiBeC_xHqqkZx_
//	FFGetMainWnd()->MoveRulerMMK(1, m_mmptMarkNew);
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	TRACE(_T("StateDrawJoint\r\n"));
	// _xZkqqHx_jAfGiClFiCkCiDhNiBfLiDeOiNmAjFfHjAnNjCoIiBeC_xHqqkZx_
	m_mmptMarkNew = m_mmptCnv;
	// _xZkqqHx_iDfOiBfLiDfBiDgCiDgHiDhNiBfLiDeOiCpAjFgAiJoGiBeC_xHqqkZx_
	DrawMark(pDC, FALSE);
	// _xZkqqHx_jAfGiClFiCkCiOlCjDfPiCpAjAnNjCoIiBeC_xHqqkZx_
	m_pjvJoint.back().m_mmptPivot = m_mmptCnv;
	DrawEditLine(pDC, 1);
	// _xZkqqHx_iDiLiBfLiDiJiBfLiDhNiDeFiDfIiDhNiBfLiDeKiBfLjFfMiOkGiBeCiDhNiBfLiDeOiImKjChFiCmJjFfMiOkGiBeC_xHqqkZx_
	FFGetMainWnd()->MoveRulerMMK(1, m_mmptMarkNew);
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
} // FCToolPoly::StateDrawJoint.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateCreateObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiNoMjAkMiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateCreateObject (CDC* pDC)
{
	TRACE(_T("StateCreateObject\r\n"));
//----- 06.12.09 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	// _xZkqqHx_iMlLiNnNiCmMiJlMjApMiCpAiPmBiLiOiBeCjFjEjFgJiCkKiNoMjAkMiCmFiCkLiCmIiCkJiCmBiClNiOjOiCmJiBeBiJlMjApMiCpAiOgDiClDiCmIiCkCiInHiBeC_xHqqkZx_
//	OnDraw(pDC);
//	// _xZkqqHx_iMlLiNnNjBeJjBpAjCiGiCmMjFjEjFgJiCmMjBeJjBpAiDhNiBfLiDeOiCmNiNmEjFfMiOkGiBeC_xHqqkZx_
//	FCToolBase::OnDraw(pDC);
//----- 06.12.09 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	// _xZkqqHx_iMlLiNnNiCmMiJlMjApMiCpAiPmBiLiOiBeCjFjEjFgJiCkKiNoMjAkMiCmFiCkLiCmIiCkJiCmBiClNiOjOiCmJiBeBiJlMjApMiCpAiOgDiClDiCmIiCkCiInHiBeC_xHqqkZx_
	OnDrawState(pDC, GetCurrentState());
//----- 06.12.09 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
	// _xZkqqHx_jBePiJpBiCfBjDfPiCkKjDkPiClGiImKjChFiCmIiCoHiCmOiNmFiMoDiCmMjDfPiCpAjGjFiPmBiBeC_xHqqkZx_
	if (m_pjvJoint[m_pjvJoint.size() - 1].m_mmptPivot ==
		m_pjvJoint[m_pjvJoint.size() - 2].m_mmptPivot) m_pjvJoint.pop_back();

	if (1 < m_pjvJoint.size())
	//----- _xZkqqHx_jIeBiMiLjDfPiCkKjDpBiCmCiImIiPoDiCkAiCoJiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iLeMjIfOiDfKiDgCiDfGiDiHiDjDiKeKiOgOiBeC_xHqqkZx_
		g_pDoc->SessionBegin();
		// _xZkqqHx_jAfGiLeLjFjEjFgJiCmMiNoMjAkMiBeFiPiJiKpKiJlLiBeFjDgPjIfOiBeC_xHqqkZx_
//----- 06.10.05 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//		FCObjDynabase* pObj = CreateNewObject();
//----- 06.10.05 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
		ObjDynabaseVector vNewObj;
		CreateNewObject(vNewObj);
//----- 06.10.05 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
		// _xZkqqHx_iLeMjIfOiDfKiDgCiDfGiDiHiDjDiCmMiPeJjHlJiBeC_xHqqkZx_
		g_pDoc->SessionEnd();
// 06.10.05 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//		if (pObj != NULL)
		if (!vNewObj.empty())
		{
			// _xZkqqHx_iCnMiClIiMlLiNnNjBeJjBpAjCiGiCmMjFjEjFgJiCpAiJpAiPjMiBeCiDhNiBfLiDeOiCpAiPmBiClHiBeC_xHqqkZx_
			g_pView->ClearSelectObj(pDC);
			// _xZkqqHx_jAfGiClFiCkCjFjEjFgJiCpAjBeJjBpAiPpDjBnEiCmJiBeCiDhNiBfLiDeOiCmNjFgAiJoGiClFiCmIiCkCiBeC_xHqqkZx_RgnDraw_xZkqqHx_iCmFjFgAiJoGiClHiCoJiBeC_xHqqkZx_
//----- 06.10.05 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//			g_pView->AppendSelectObj(pObj);
//			g_pView->AddRgn(pObj);
//----- 06.10.05 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
			g_pView->AppendSelectObj(vNewObj);
			mdef_const_iterator(ObjDynabaseVector, iObj);
			m1_for (iObj, vNewObj)
				g_pView->AddRgn(*iObj);
//----- 06.10.05 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
		}
	}
//----- 01.11.02 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	// _xZkqqHx_iPeJjHlJjDfPiDeKiBfLiDfMiDiLiCpAjFgAiJoGiBeC_xHqqkZx_STATE_TERMINATE_JOINT _xZkqqHx_iMoDiCmJiBeBiDeKiBfLiDfMiDiLiCkK_xHqqkZx_
	// _xZkqqHx_jFgAiJoGiClDiCoKiClNiPpDjBnEiCmJiClHiCoJiClNiCnPiBeC_xHqqkZx_
	DrawMark(pDC, FALSE);
//----- 01.11.02 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
} // FCToolPoly::StateCreateObject.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateTerminateJoint
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jIeBiMiLjDfPjAnNjCoIiPeJjHlJiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.31 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateTerminateJoint (CDC* pDC)
{
	TRACE(_T("StateTerminateJoint\r\n"));
	// _xZkqqHx_iOkJjDkOiDfIiDeOiDiNiBfLiDiLiBgJiJoGjGmKiCpAiCmNiCnNiPgPiClFiClNiOjOiBgKiCpAiDeJiDhEiBeC_xHqqkZx_
	g_pView->SetAutoScroll(FALSE);
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iMlLiNnNiCmMiJlMjApMiNmAjFfHiBeC_xHqqkZx_RgnRedraw_xZkqqHx_jBePiCmJjAnNjCoIiClFiCmIiCkCiCmGiBeBiClBiCmM_xHqqkZx_OnDraw_xZkqqHx_iCmFiMoLjDkOiNoMiBeC_xHqqkZx_
//	m_vlgptPoly.clear();
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	m_pjvJoint.clear();
//----- 02.06.07 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (_xZkqqHx_iDiKiDjDiDeOjBlNiKhAjApMiDgDiBfLiDiLiCpA_xHqqkZx_DBL_xZkqqHx_iDeOiDiKiDgCiDeOiCmFiDiNiDgCiDeOiClFiCmEjIeBjBlBiNoMjAkMiClHiCoJiCmGiCkLiBeB_xHqqkZx_Shift_xZkqqHx_iDeMiBfLiCpAiJjPiClFiCmIiCkKiCoH_xHqqkZx_StateIdle_xZkqqHx_iCmNjDkOiNoMiCkKjFmP_xHqqkZx_)-----
	// _xZkqqHx_iDhNiDeFiDfIiDeKiBfLiDfMiDiLiCmMjAkHiMmAjApMiCpAiPmBiLiOiBeC_xHqqkZx_
	m_mmlnvAry.clear();
//----- 02.06.07 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (_xZkqqHx_iDiKiDjDiDeOjBlNiKhAjApMiDgDiBfLiDiLiCpA_xHqqkZx_DBL_xZkqqHx_iDeOiDiKiDgCiDeOiCmFiDiNiDgCiDeOiClFiCmEjIeBjBlBiNoMjAkMiClHiCoJiCmGiCkLiBeB_xHqqkZx_Shift_xZkqqHx_iDeMiBfLiCpAiJjPiClFiCmIiCkKiCoH_xHqqkZx_StateIdle_xZkqqHx_iCmNjDkOiNoMiCkKjFmP_xHqqkZx_)-----
	// _xZkqqHx_iDiKiBfLiDfHiDiHiDjDiCpAiNmEjFgAiJoGiBeC_xHqqkZx_
	g_pView->SendRgnRedraw();
	// _xZkqqHx_iDgDiBfLiDiLiDfKiDgCiDfGiDiHiDjDiPeJjHlJiBeC_xHqqkZx_
	EndOfSession();
	::FFReleaseCapture();	// _xZkqqHx_iDhNiDeFiDfIiCmMiDgIiDiJiDgCiDePiCmMiKeKiOgOiCmJiCoGiCmBiCmEiOgOiCnMiCmBiClNiDhNiDeFiDfIiCmM_xHqqkZx_
							// _xZkqqHx_jFnPiKgMiCpAiJpAiPjMiClFiCnMiClHiBeC_xHqqkZx_
} // FCToolPoly::StateTerminateJoint.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolPoly::StateAbortJointByButton
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jIeBiMiLjDfPjAnNjCoIjCiGiOhOiPiIjHjNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.01.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolPoly::StateAbortJointByButton (CDC* pDC)
{
	TRACE(_T("StateAbortJointByButton\r\n"));
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	// _xZkqqHx_iMlLiNnNiCmMiJlMjApMiNmAjFfHiBeC_xHqqkZx_
//	m_vlgptPoly.clear();
//----- 05.04.25 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
	m_pjvJoint.clear();
	::FFReleaseCapture();	// _xZkqqHx_iDhNiDeFiDfIiCmMiDgIiDiJiDgCiDePiCmMiKeKiOgOiCmJiCoGiCmBiCmEiOgOiCnMiCmBiClNiDhNiDeFiDfIiCmM_xHqqkZx_
							// _xZkqqHx_jFnPiKgMiCpAiJpAiPjMiClFiCnMiClHiBeC_xHqqkZx_
} // FCToolPoly::StateAbortJointByButton.

