#include "stdafx.h"
// 02.06.06 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ (_xZkqqHx_iDiMiDeDiDiEiBfLiCmMjFnCiPfHiMkAiCpAjBfDjFjEjGjFiPmB_xHqqkZx_->Undo->_xZkqqHx_jBlNiKhAjApMiDgDiBfLiDiLiCpAjBeJjBpA_xHqqkZx_->Redo->_xZkqqHx_jBlNiKhAjApMiCpAiNoMjAkMiClHiCoJiCmGjHiOiClPiCoJ_xHqqkZx_)
#include "DynamicDraw.h"			// For FFCanCreateObject.
#include "FoundDoc.h"			// For g_pDoc.
#include "DynamicDrawView.h"	// For g_pView.
#include "ObjPoly.h"			// For FCObjPoly.
#include "UtilCoord.h"			// For mm2lg.etc.
#include "UtilBezier.h"			// For CalcBezier2.
#include "UtilGraph.h"			// For FCEditDraw.
#include "RegData.h"			// For GetOptiRegColor.
#include "ToolBasePolyCreate.h"	// This header.

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


/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::FCToolBasePolyCreate
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfO_xHqqkZx_.
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	98.11.16 Fukushiro M. _xZkqqHx_iDfCiDiBiDjDiDgHiNoMjAkM_xHqqkZx_
 *************************************************************************/
FCToolBasePolyCreate::FCToolBasePolyCreate ()
{
// 05.07.15 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	m_objpReference = NULL;
	m_pjvJoint.clear();
} // FCToolBasePolyCreate::FCToolBasePolyCreate.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::CreateInsideObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jDoAjFjEjFjEjFgJiCpAiNoMjAkMiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jDoAjFjEjFjEjFgJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.07.15 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCObjDynabase* FCToolBasePolyCreate::CreateInsideObject ()
{
	return new FCObjPoly();
} // FCToolBasePolyCreate::CreateInsideObject.

//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::OnViewCreate
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	CFCDynamicDrawView::OnCreate_xZkqqHx_iCkJiCoH_xHqqkZx_Call.Tool_xZkqqHx_iCmMiPiJiKpKiJlL_xHqqkZx_.
// *************************************************************************/
//void FCToolBasePolyCreate::OnViewCreate ()
//{
//	BASE_CLASS::OnViewCreate();
//	//----- _xZkqqHx_iDiKiDhEiDeAiDiMiDjDiDfIjFjEjFgJiCmMiNoMjAkM_xHqqkZx_ -----
//	m_objpReference = new FCObjPoly();
//} // FCToolBasePolyCreate::OnViewCreate.
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::OnViewDestroy
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	CFCDynamicDrawView::OnDestroy_xZkqqHx_iCkJiCoH_xHqqkZx_Call.Tool_xZkqqHx_iCmMiPeJjHlJiPiIjHjN_xHqqkZx_.
// *************************************************************************/
//void FCToolBasePolyCreate::OnViewDestroy ()
//{
//	delete m_objpReference;
//	m_objpReference = NULL;
//	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
//	BASE_CLASS::OnViewDestroy();
//} // FCToolBasePolyCreate::OnViewDestroy.
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 06.12.09 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::OnDraw
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC		:_xZkqqHx_jFfMiOkGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
// *			pmmrtRgn:_xZkqqHx_iDiKiBfLiDfHiDiHiDjDjEhKjHpBiCpAiOhHjCoIiBeCiOgHiCoNiCmIiCkCiPoKiNiHiCmN_xHqqkZx_NULL_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
// *			lRgnSize:pmmrtRgn_xZkqqHx_iCmMjEhKjHpBiDfEiDeDiDfJiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC		: CDC
// *************************************************************************/
//void FCToolBasePolyCreate::OnDraw (CDC* pDC)
////void FCToolBasePolyCreate::OnDraw (CDC* pDC, const DBLRect* pmmrtRgn, long lRgnSize)
//{
//	DrawTempLine(pDC);
//	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
//	BASE_CLASS::OnDraw(pDC);
//} // FCToolBasePolyCreate::OnDraw.
//----- 06.12.09 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::Select
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iClBiCmMiDgDiBfLiDiLiCkKjBeJjBpAiClDiCoKiClNiCmGiCkLiBeBiDfCiBfLiDiLiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	: CDC*
 *************************************************************************/
void FCToolBasePolyCreate::Select (CDC* pDC)
{
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::Select(pDC);
	m_pjvJoint.clear();
} // FCToolBasePolyCreate::Select.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::Unselect
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iClBiCmMiDgDiBfLiDiLiCkKjBeJjBpAiJpAiPjMiClDiCoKiClNiCmGiCkLiBeBiDfCiBfLiDiLiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC		: _xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfI_xHqqkZx_.
 *************************************************************************/
void FCToolBasePolyCreate::Unselect (CDC* pDC)
{
	m_pjvJoint.clear();
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::Unselect(pDC);
} // FCToolBasePolyCreate::Unselect.

//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::GetInsideObject
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jFjEjFgJiCmMjAlGjAkMiCmJiOgHjHhAiClDiCoKiCoJiDgDiBfLiDiLjDoAjFjEjFjEjFgJiCpAjFnEiClH_xHqqkZx_.
// *
// * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iDgDiBfLiDiLjDoAjFjEjFjEjFgJiCmMiDhMiDeDiDjDiDfO_xHqqkZx_.
// *
// * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iClBiCmMjFjEjFgJiCpAiOgHiCmBiCmEiBeBiDhNiDeFiDfIiInKjDkOiOjOiCmMjFgAiJoGiCoCjFjEjFgJiCmMjAlGjAkMiCpAiNhDiCkE_xHqqkZx_.
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	98.09.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//FCObjDynabase* FCToolBasePolyCreate::GetInsideObject () const
//{
//	return m_objpReference;
//} // FCToolBasePolyCreate::GetInsideObject.
//----- 05.07.15 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

//----- 05.04.26 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::SetFrontLinkGap
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiKiDjDiDeOiCpAjElKiCkEiNoMjAkMiOjOiCmJiBeBiOkJjDkOjDeJiCmJjFjEjFgJiCmGiCmMiDeNiDiDiDgCiDhGiCpAiOoGiCoJiPoKiNiHiCmM_xHqqkZx_
// *			_xZkqqHx_iDeNiDiDiDgCiDhGiCmMjClHiClDiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	mmGap	:_xZkqqHx_iDeNiDiDiDgCiDhGiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.04.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//void FCToolBasePolyCreate::SetFrontLinkGap (mmetol mmGap)
//{
//} // FCToolBasePolyCreate::SetFrontLinkGap.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::GetFrontLinkGap
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiKiDjDiDeOiCpAjElKiCkEiNoMjAkMiOjOiCmJiBeBiOkJjDkOjDeJiCmJjFjEjFgJiCmGiCmMiDeNiDiDiDgCiDhGiCpAiOoGiCoJiPoKiNiHiCmM_xHqqkZx_
// *			_xZkqqHx_iDeNiDiDiDgCiDhGiCmMjClHiClDiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	mmGap	:_xZkqqHx_iDeNiDiDiDgCiDhGiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.04.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//mmetol FCToolBasePolyCreate::GetFrontLinkGap () const
//{
//	return 0.0;
//} // FCToolBasePolyCreate::GetFrontLinkGap.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::SetBackLinkGap
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiKiDjDiDeOiCpAjElKiCkEiNoMjAkMiOjOiCmJiBeBiOkJjDkOjDeJiCmJjFjEjFgJiCmGiCmMiDeNiDiDiDgCiDhGiCpAiOoGiCoJiPoKiNiHiCmM_xHqqkZx_
// *			_xZkqqHx_iDeNiDiDiDgCiDhGiCmMjClHiClDiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	mmGap	:_xZkqqHx_iDeNiDiDiDgCiDhGiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.04.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//void FCToolBasePolyCreate::SetBackLinkGap (mmetol mmGap)
//{
//} // FCToolBasePolyCreate::SetBackLinkGap.
//
///*************************************************************************
// * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::GetBackLinkGap
// *
// * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiKiDjDiDeOiCpAjElKiCkEiNoMjAkMiOjOiCmJiBeBiOkJjDkOjDeJiCmJjFjEjFgJiCmGiCmMiDeNiDiDiDgCiDhGiCpAiOoGiCoJiPoKiNiHiCmM_xHqqkZx_
// *			_xZkqqHx_iDeNiDiDiDgCiDhGiCmMjClHiClDiCpAjFnEiClHiBeC_xHqqkZx_
// *
// * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	mmGap	:_xZkqqHx_iDeNiDiDiDgCiDhGiCpAiOhHjCoIiBeC_xHqqkZx_
// *
// * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.04.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
// *************************************************************************/
//mmetol FCToolBasePolyCreate::GetBackLinkGap () const
//{
//	return 0.0;
//} // FCToolBasePolyCreate::GetBackLinkGap.
//----- 05.04.26 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::CreateNewObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jAfGiLeLiCmMjFjEjFgJiCmMiNoMjAkMiBeFiPiJiKpKiJlLiBeFjDgPjIfOiCpAiNhDiCkEiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jAfGiLeLiCmJiNoMjAkMiClDiCoKiClNjFjEjFgJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	ToolBasePolyCreateArrow_xZkqqHx_iCpA_xHqqkZx_ToolBasePolyCreate_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmJ_xHqqkZx_
 *			_xZkqqHx_iClHiCoJiClNiCnPiCmJiBeBiClBiCmMiKnGjAjEiCpAiNoMiCmBiClNiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.05.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
// 06.10.05 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//FCObjDynabase* FCToolBasePolyCreate::CreateNewObject ()
void FCToolBasePolyCreate::CreateNewObject (ObjDynabaseVector& vNewObj)
{
	// _xZkqqHx_iDiKiDhEiDeAiDiMiDjDiDfIjFjEjFgJiCmMiDfCiDhDiBfLiCpAiNoMjAkMiBeC_xHqqkZx_
	const FCObjDynabase* pTmpl = GetReferenceObject();
// 06.10.05 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	if (pTmpl == NULL) return NULL;
	if (pTmpl == NULL) return;
	FCObjPoly* pPoly = (FCObjPoly*)pTmpl->Duplicate();
	// _xZkqqHx_jFjEjFgJiCmMiPiJiKpKiJlLiBeC_xHqqkZx_
	InitNewObject(pPoly);
	// _xZkqqHx_iDfEiDeDiDfJiCmMiNmEiMhGiOfKiBeC_xHqqkZx_
	pPoly->CalcResizeFrame();
	// _xZkqqHx_jFjEjFgJ_xHqqkZx_ID_xZkqqHx_iCpAiOoGjDlOiClFiBeBjFjEjFgJiCmJjAnNjCoIiClHiCoJiBeC_xHqqkZx_
	pPoly->RegisterObjID();
	// _xZkqqHx_jFjEjFgJjAlGjAkMiCmMiLeMjIfOiBeC_xHqqkZx_
	g_pDoc->MulticmdCreate1Obj(pPoly, g_pDoc->GetCurrentSheetId(), LAST_LAYER_ORDER);
	// _xZkqqHx_iNmFiMoDiCmJiNoMjAkMiClDiCoKiClNjFjEjFgJiCmGiClFiCmEjDgPjIfOiBeC_xHqqkZx_
	SetLastCreateObj(pPoly);
// 06.10.05 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	return pPoly;
	vNewObj.push_back(pPoly);
} // FCToolBasePolyCreate::CreateNewObject.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::InitNewObject
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iNoMjAkMiClFiClNjFjEjFgJiCpAiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pObj	:_xZkqqHx_iPiJiKpKiJlLiClHiCoJjFjEjFgJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.05.23 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolBasePolyCreate::InitNewObject (FCObjDynabase* pObj) const
{
//----- 06.12.05 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	// _xZkqqHx_jFjEjFgJiCmMiPiJiKpKiJlLiBeC_xHqqkZx_
//	((FCObjPoly*)pObj)->SetJoint(m_pjvJoint.size(), m_pjvJoint.begin());
//----- 06.12.05 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	// _xZkqqHx_jBlNiKhAjApMjFjEjFgJiCmJiDhMiDiKiDiJiDeDiDjDiCpAjAnNjCoIiBeC_xHqqkZx_
	FCObjPoly* pPoly = (FCObjPoly*)pObj;
	pPoly->SetJoint(m_pjvJoint.size(), &m_pjvJoint.front());
	if (m_pjvJoint.size() == 2 && !pPoly->GetIsOpenPolyJoint())
	//----- _xZkqqHx_jClIjDfPiCkK_xHqqkZx_2_xZkqqHx_iCmC_xHqqkZx_ _xZkqqHx_iKiOiCmC_xHqqkZx_ _xZkqqHx_iDhMiDiKiDiJiDeDiDjDiCkKjFmCiClGiCmEiCkCiCoJiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jClIjDfPiCkKiCfBiCmCiClFiCkJiCmIiCkCiPoKiNiHiBeBjFmCiClGiClNjClMjApMiCmNiNoMiCoIiClNiCkNiCmIiCkCiBeC_xHqqkZx_
		// _xZkqqHx_iDiKiDhEiDeAiDiMiDjDiDfIjFjEjFgJiCkKjFmCiClGiClNjFjEjFgJiCmMiPoKiNiHiBeBiDiGiBfLiDfFiBfLiCkKiInDiOkPiClJiClIiCmJ_xHqqkZx_
		// _xZkqqHx_jFmCiClGiClNjClMjApMiCpAiNoMiCmBiCmEiClFiCnMiCkEiPoKiNiHiCkKiCkAiCoJiBeC_xHqqkZx_
		// _xZkqqHx_jFmCiClGiClNjClMjApMiCmNiBeBiMkJiClNjGnKiCmFiCmNjElLjCgGiCkKjFhEiCkJiClIiCoCiCmBiCkJiCkCiBeC_xHqqkZx_

		// _xZkqqHx_jCiN_xHqqkZx_: WidePoly _xZkqqHx_iCmN_xHqqkZx_ GetIsOpenPolyJoint() == TRUE _xZkqqHx_iCmIiCmMiCmFiClBiClBiCmJiCmNiClBiCmIiCkCiBeC_xHqqkZx_

		// BezierControl_xZkqqHx_jEhKjHpBiCmJjFmPiKlHiBeC_xHqqkZx_
		FCBezierControlsVector vControls;
		FFControlConv(	vControls,
						&m_pjvJoint.front(),
						(long)m_pjvJoint.size(),
						FALSE);
		// _xZkqqHx_iDhMiDiKiDiJiDeDiDjDiCmNjClMjApMiCkJiBeI_xHqqkZx_
		BOOL bIsLine = TRUE;
		// _xZkqqHx_iNfMjAkMiDhIiDfHiDeGiLmIjApMjBfDiCmEiCkKjClMjApMiCmIiCoHiCmOiBeBiClBiCmMiDhMiDiKiDiJiDeDiDjDiCmNjClMjApMiCmFiCkAiCoJiBeC_xHqqkZx_
		FCBezierControlsVector::const_iterator iBc;
		for (iBc = vControls.begin();
			 bIsLine && iBc != vControls.end(); iBc++)
			if (!(*iBc).IsLine()) bIsLine = FALSE;
		// _xZkqqHx_iDhMiDiKiDiJiDeDiDjDiCkKjClMjApMiCmMiPoKiNiHiCmNiKeKiCkCiClNiDhMiDiKiDiJiDeDiDjDiCmJiBeC_xHqqkZx_
		if (bIsLine)
			pPoly->SetIsOpenPolyJoint(TRUE);
	}
//----- 06.12.05 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
} // FCToolBasePolyCreate::InitNewObject.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::DrawTempLine
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iMlLiNnNiNoMjAkMjCiGiCmMjFjEjFgJiCmMiJlMjApMiCpAjFgAiJoGiBgJiPmBiLiOiBgKiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC	:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	00.04.09 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolBasePolyCreate::DrawTempLine (CDC* pDC)
{
	if (!m_pjvJoint.empty())
	{
		//----- _xZkqqHx_jBfDiCmEiCmMiJlMjApMiCpAjFgAiJoG_xHqqkZx_ -----
		// _xZkqqHx_iJoGjGmKiCmMjFgAiJoGjHmMiIoGiCpAiOoGjDlOiBeC_xHqqkZx_
		CRect lgrtView;
		g_pView->GetClientRectLG(lgrtView);
		CPointVector vlgptPoly;

		// _xZkqqHx_iPeDjAlDjApMjFgAiJoGjHhAiDeOiDiJiDfIiCpAiNoMjAkMiBeC_xHqqkZx_
		FCEditDraw eDraw(pDC, mm2lg(GetReferenceObject()->GetStdPenWeight()));
		for (long l = 0; l < m_pjvJoint.size() - 1; l++)
		{
			::CalcBezier2(vlgptPoly, (const FCPolyJoint*)m_pjvJoint.begin(),
						m_pjvJoint.size(), 0,
						l, 1L, g_->lgdPrecision, g_->dZoom, &lgrtView, 1,
						StdMinRatio(lgrtView));
			eDraw.Polyline(vlgptPoly.begin(), vlgptPoly.size());
			vlgptPoly.clear();
		}
	}
} // FCToolBasePolyCreate::DrawTempLine.

//----- 06.12.09 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::OnDrawState
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC		:_xZkqqHx_jFfMiOkGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *			pmmrtRgn:_xZkqqHx_iDiKiBfLiDfHiDiHiDjDjEhKjHpBiCpAiOhHjCoIiBeCiOgHiCoNiCmIiCkCiPoKiNiHiCmN_xHqqkZx_NULL_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
 *			lRgnSize:pmmrtRgn_xZkqqHx_iCmMjEhKjHpBiDfEiDeDiDfJiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDC		: CDC
 *************************************************************************/
void FCToolBasePolyCreate::OnDrawState (CDC* pDC, int iState)
{
	DrawTempLine(pDC);
	// Superclass_xZkqqHx_iKnGjAjEiOmAiNhDiBeC_xHqqkZx_
	BASE_CLASS::OnDrawState(pDC, iState);
} // FCToolBasePolyCreate::OnDrawState.
//----- 06.12.09 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::TransFDA
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iMiIjCoIjAkLjHeMiMmAiDeJiBfLiDgHiDhNiDgHiDjDiCmMjBeKiInKiCpAjFnEiClHiBeC_xHqqkZx_ToolPoly.mdrw_xZkqqHx_iCpAiOfBiPmGiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	iState	:_xZkqqHx_iMlLiNnNiCmMiPpDjBnEiCpAiOhHjCoIiBeC_xHqqkZx_
 *			iEvent	:_xZkqqHx_iDeDiDhIiDjDiDgHiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jBeKiInKiMoDiCmMiPpDjBnEiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
int FCToolBasePolyCreate::TransFDA (int iState, int iEvent)
{
	// _xZkqqHx_iInKiNhDjAoGiPpDjBnEiBeC_xHqqkZx_
	int iNextState = STATE_NONE;	// _xZkqqHx_iPpDjBnEjGlDiClFiBeC_xHqqkZx_

	// FDA_xZkqqHx_iCmMiMlLiNnNiCmMiPpDjBnEiBeC_xHqqkZx_
	switch (iState)
	{
	case STATE_IDLE:	// _xZkqqHx_jBnCiClPiBeC_xHqqkZx_
//----- 02.06.05 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ (_xZkqqHx_iDiMiDeDiDiEiBfLiCmMjFnCiPfHiMkAiCpAjBfDjFjEjGjFiPmB_xHqqkZx_->Undo->_xZkqqHx_jBlNiKhAjApMiDgDiBfLiDiLiCpAjBeJjBpA_xHqqkZx_->Redo->_xZkqqHx_jBlNiKhAjApMiCpAiNoMjAkMiClHiCoJiCmGjHiOiClPiCoJ_xHqqkZx_)-----
		if (FFCanCreateObject())
		//----- _xZkqqHx_jFjEjFgJiNoMjAkMiJmCjEfMiCmMiPoKiNiH_xHqqkZx_ -----
		{
//----- 02.06.05 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ (_xZkqqHx_iDiMiDeDiDiEiBfLiCmMjFnCiPfHiMkAiCpAjBfDjFjEjGjFiPmB_xHqqkZx_->Undo->_xZkqqHx_jBlNiKhAjApMiDgDiBfLiDiLiCpAjBeJjBpA_xHqqkZx_->Redo->_xZkqqHx_jBlNiKhAjApMiCpAiNoMjAkMiClHiCoJiCmGjHiOiClPiCoJ_xHqqkZx_)-----
			switch (iEvent)
			{
			case WM_LBUTTONDOWN:	// _xZkqqHx_iNlGiDhLiDfOiDjDiDfPiDeFiDjDiBeC_xHqqkZx_
// 05.04.25 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//			case WM_RBUTTONDOWN:	// _xZkqqHx_iJeFiDhLiDfOiDjDiDfPiDeFiDjDiBeC_xHqqkZx_
				iNextState = STATE_START_JOINT;		// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiKeKiOgOiBeC_xHqqkZx_
				break;
			}
// 02.06.05 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ (_xZkqqHx_iDiMiDeDiDiEiBfLiCmMjFnCiPfHiMkAiCpAjBfDjFjEjGjFiPmB_xHqqkZx_->Undo->_xZkqqHx_jBlNiKhAjApMiDgDiBfLiDiLiCpAjBeJjBpA_xHqqkZx_->Redo->_xZkqqHx_jBlNiKhAjApMiCpAiNoMjAkMiClHiCoJiCmGjHiOiClPiCoJ_xHqqkZx_)
		}
		break;
	case STATE_START_JOINT:		// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiKeKiOgOiBeC_xHqqkZx_
		switch (iEvent)
		{
		case WM_MOUSEMOVE:	// _xZkqqHx_iDhNiDeFiDfIiInKjDkOiBeC_xHqqkZx_
			iNextState = STATE_ERASE_JOINT;	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLiPmBiLiOiBeC_xHqqkZx_
			break;
		case WM_LBUTTONDBLCLK:	// _xZkqqHx_iNlGiDhLiDfOiDjDiDfPiDhFiDiLiDeOiDiKiDgCiDeOiBeC_xHqqkZx_
			if (!IsShift() && !IsControl())
				iNextState = STATE_ABORT_JOINT_BY_BUTTON;		// _xZkqqHx_iDhNiDeFiDfIiDhLiDfOiDjDiCmJiCoGiCoIjIeBiMiLjDfPjAnNjCoIjCiGiOhOiBeC_xHqqkZx_
			break;
		}
		break;
	case STATE_SET_JOINT:		// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiBeC_xHqqkZx_
		iNextState = STATE_DRAW_JOINT;	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLjFfMiOkGiBeC_xHqqkZx_
		break;
//----- 05.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	case STATE_UNSET_JOINT:		// _xZkqqHx_jIeBiMiLjDfPiJpAiPjMiBeC_xHqqkZx_
		iNextState = STATE_DRAW_JOINT;	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLjFfMiOkGiBeC_xHqqkZx_
		break;
	case STATE_ERASE_JOINT:	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLiPmBiLiOiBeC_xHqqkZx_
		iNextState = STATE_DRAW_JOINT;	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLjFfMiOkGiBeC_xHqqkZx_
		break;
//----- 05.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
	case STATE_DRAW_JOINT:	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLjFfMiOkGiBeC_xHqqkZx_
		switch (iEvent)
		{
		case WM_MOUSEMOVE:	// _xZkqqHx_iDhNiDeFiDfIiInKjDkOiBeC_xHqqkZx_
			if (!almosteq(m_pjvJoint.back().m_mmptPivot, m_mmptCnv))
				iNextState = STATE_ERASE_JOINT;	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLiPmBiLiOiBeC_xHqqkZx_
			break;
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//		case WM_LBUTTONDOWN:	// _xZkqqHx_iNlGiDhLiDfOiDjDiDfPiDeFiDjDiBeC_xHqqkZx_
//		case WM_RBUTTONDOWN:	// _xZkqqHx_iJeFiDhLiDfOiDjDiDfPiDeFiDjDiBeC_xHqqkZx_
//			iNextState = STATE_SET_JOINT;		// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiBeC_xHqqkZx_
//			break;
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
		case WM_LBUTTONDOWN:	// _xZkqqHx_iNlGiDhLiDfOiDjDiDfPiDeFiDjDiBeC_xHqqkZx_
			iNextState = STATE_SET_JOINT;		// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiBeC_xHqqkZx_
			break;
		case WM_RBUTTONDOWN:	// _xZkqqHx_iJeFiDhLiDfOiDjDiDfPiDeFiDjDiBeC_xHqqkZx_
			iNextState = STATE_UNSET_JOINT;		// _xZkqqHx_jIeBiMiLjDfPiJpAiPjMiBeC_xHqqkZx_
			break;
//----- 05.04.25 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
		case WM_LBUTTONDBLCLK:	// _xZkqqHx_iNlGiDhLiDfOiDjDiDfPiDhFiDiLiDeOiDiKiDgCiDeOiBeC_xHqqkZx_
			iNextState = STATE_CREATE_OBJECT;	// _xZkqqHx_jFjEjFgJiNoMjAkMiBeC_xHqqkZx_
			break;
		case WM_COMMAND:		// _xZkqqHx_iDfCiDhNiDjDiDgIiBeC_xHqqkZx_
			if (m_dwCommand == ID_TLCMD_CANCEL)
				iNextState = STATE_CREATE_OBJECT;	// _xZkqqHx_jFjEjFgJiNoMjAkMiBeC_xHqqkZx_
			break;
		}
		break;
	case STATE_CREATE_OBJECT:	// _xZkqqHx_jFjEjFgJiNoMjAkMiBeC_xHqqkZx_
		iNextState = STATE_TERMINATE_JOINT;	// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiPeJjHlJiBeC_xHqqkZx_
		break;
	case STATE_TERMINATE_JOINT:	// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiPeJjHlJiBeC_xHqqkZx_
		iNextState = STATE_IDLE;	// _xZkqqHx_jBnCiClPiBeC_xHqqkZx_
		break;
	case STATE_ABORT_JOINT_BY_BUTTON:		// _xZkqqHx_iDhNiDeFiDfIiDhLiDfOiDjDiCmJiCoGiCoIjIeBiMiLjDfPjAnNjCoIjCiGiOhOiBeC_xHqqkZx_
		iNextState = STATE_EXIT_TOOL_BY_BUTTON;	// _xZkqqHx_iDhNiDeFiDfIiDhLiDfOiDjDiCmJiCoGiCoIiDgDiBfLiDiLiPeJjHlJiBeC_xHqqkZx_
		break;
	}
	// _xZkqqHx_iPpDjBnEjBeKiInKjGlDiClFiCmMiPoKiNiHiCmNiDfIiBfLiDhAiBfLiDeOiDiJiDfIiCmMiPpDjBnEjBeKiInKiCpAiMmEiCnBiPgPiClHiBeC_xHqqkZx_
	if (iNextState == STATE_NONE)
		iNextState = BASE_CLASS::TransFDA(iState, iEvent);
	return iNextState;
} // FCToolBasePolyCreate::TransFDA.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCToolBasePolyCreate::StateFDA
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iPpDjBnEiCmJiJjOiClGiClNiPiIjHjNiCpAiOmAiNhDiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	iState	:_xZkqqHx_iMlLiNnNiCmMiPpDjBnEiCpAiOhHjCoIiBeC_xHqqkZx_
 *			pDC		:_xZkqqHx_jFgAiJoGjHhAiDgGiDgPiDeDiDfIiDfCiDjDiDgFiDeMiDfIiDgHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.12.28 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCToolBasePolyCreate::StateFDA (int iState, CDC* pDC)
{
	// FDA_xZkqqHx_iCmMiOjPiCmMiPpDjBnEiBeC_xHqqkZx_
	switch (iState)
	{
	case STATE_START_JOINT:		// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiKeKiOgOiBeC_xHqqkZx_
		StateStartJoint(pDC);
		break;
	case STATE_SET_JOINT:		// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiBeC_xHqqkZx_
		StateSetJoint(pDC);
		break;
//----- 05.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	case STATE_UNSET_JOINT:		// _xZkqqHx_jIeBiMiLjDfPiJpAiPjMiBeC_xHqqkZx_
		StateUnsetJoint(pDC);
		break;
	case STATE_ERASE_JOINT:	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLiPmBiLiOiBeC_xHqqkZx_
		StateEraseJoint(pDC);
		break;
//----- 05.04.25 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
	case STATE_DRAW_JOINT:	// _xZkqqHx_jIeBiMiLjDfPiDeKiBfLiDfMiDiLjFfMiOkGiBeC_xHqqkZx_
		StateDrawJoint(pDC);
		break;
	case STATE_CREATE_OBJECT:	// _xZkqqHx_jFjEjFgJiNoMjAkMiBeC_xHqqkZx_
		StateCreateObject(pDC);
		break;
	case STATE_TERMINATE_JOINT:	// _xZkqqHx_jIeBiMiLjDfPjAnNjCoIiPeJjHlJiBeC_xHqqkZx_
		StateTerminateJoint(pDC);
		break;
	case STATE_ABORT_JOINT_BY_BUTTON:		// _xZkqqHx_iDhNiDeFiDfIiDhLiDfOiDjDiCmJiCoGiCoIjIeBiMiLjDfPjAnNjCoIjCiGiOhOiBeC_xHqqkZx_
		StateAbortJointByButton(pDC);
		break;
	default:
		BASE_CLASS::StateFDA(iState, pDC);
	}
} // FCToolBasePolyCreate::StateFDA.

