#ifndef __FCToolRotate_h
#define __FCToolRotate_h

//----- 05.06.06 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//#include "ToolSelect.h"		// Super class.
//----- 05.06.06 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
#include "ToolBaseEdit.h"	// Super class.

#ifdef SUPER_CLASS
#undef SUPER_CLASS
#endif
#define SUPER_CLASS FCToolBaseEdit

//----- 05.06.06 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----

class FCObjDynabase;

// _xZkqqHx_jFjEjFgJiCmMiJpBjDfNjHhAjBkOjAkLiCmMiLeMjIfOiDeOiDiJiDfIiBeC_xHqqkZx_
class FCRotElem
{
public:
	FCRotElem ();
	FCRotElem (const FCObjDynabase* pObj);
	void	Init (const FCObjDynabase* pObj);
	BOOL	Update (const FCObjDynabase* pObj);
	void	Rotate (double dRot, const DBLPoint& mmptCenter);
	void	Move (const DBLPoint& mmptMove);
	void	Calc4RotMark (DBLPoint mmpta[], double dRot = 0.0) const;
	int		Calc5RotMark (CPoint lgpta[], double dRot = 0.0) const;

public:
	double		m_dAngle;		// _xZkqqHx_iJpBjDfNiKhAjDhIiBeC_xHqqkZx_
	DBLPoint	m_mmptCenter;	// _xZkqqHx_iJpBjDfNiCmMjCiGjAfDiNmAjFfHiBeC_xHqqkZx_
	mmetol		m_mmHalfWidth;	// _xZkqqHx_iJpBjDfNjBePiLoJiMgAiCmMjFjN_xHqqkZx_/2_xZkqqHx_iBeC_xHqqkZx_
	mmetol		m_mmHalfHeight;	// _xZkqqHx_iJpBjDfNjBePiLoJiMgAiCmMiNiC_xHqqkZx_/2_xZkqqHx_iBeC_xHqqkZx_
}; // class FCRotElem.

typedef map<FCObjDynabase*, FCRotElem>	FTRotElemMap;

// 05.06.06 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//class FCToolRotate : public FCToolSelect
class FCToolRotate : public SUPER_CLASS
{
protected:
typedef SUPER_CLASS BASE_CLASS;

public:
	FCToolRotate ();
	//----- _xZkqqHx_iDfEiDhFiDeOiDiJiDfIiCmFjEeDiInD_xHqqkZx_ -----
	virtual void	OnSelectObjModified ();
// 06.12.09 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual void	OnDraw (CDC* pDC);
// 05.07.25 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual void	OnDraw (CDC* pDC, const DBLRect* pmmrtRgn = NULL, long lRgnSize = 0);
	virtual void	Select (CDC* pDC);
// 05.06.27 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual BOOL	CanSelectTool () const;
	virtual void	DrawSelectMark (CDC* pDC, FCObjDynabase* pObj);
	virtual void	OnAppendSelectObj (CDC* pDC, FCObjDynabase* pObj);
	virtual void	OnRemoveSelectObj (CDC* pDC, FCObjDynabase* pObj);

	virtual BOOL	CanHandle (const FCObjDynabase* pObj) const;

protected:
	//----- _xZkqqHx_iClBiCmMiDeOiDiJiDfIiMmFjHeMiCmMiKnGjAjE_xHqqkZx_ -----
	virtual void	CalcAllCenter ();
// 05.06.06 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	virtual void	Calc4RotMark (DBLPoint mmpta[], double dRot = 0.0) const;
	virtual BOOL	CheckHitEachRotMark ();
	virtual BOOL	CheckHitAllRotMark ();
// 05.06.27 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	virtual BOOL	CheckHitAllRotCenter ();
	virtual void	DrawAllRotMark (CDC* pDC, double dRot = 0.0) const;

	//----- FCToolBaseFDA_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjHhGiCmJiJjOiClGiCmE_xHqqkZx_ -----
// 01.07.20 Fukushiro M. 1_xZkqqHx_iNhDjCmHiJmB_xHqqkZx_ ()
	virtual HCURSOR	GetDefaultIdleCursor () const;
//----- 06.12.09 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	virtual void	OnDrawState (CDC* pDC, int iState);
//----- 06.12.09 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
	virtual int		TransFDA (int iState, int iEvent);
	virtual void	StateFDA (int iState, CDC* pDC);
	//----- _xZkqqHx_jBeKiInKiPpDjBnEiPiIjHjNiBgJiDeJiBfLiDgPiBfLiDiJiDeDiDgIiBgK_xHqqkZx_ -----
	virtual void	StateIdle (CDC* pDC);				// _xZkqqHx_jBnCiClPiBeC_xHqqkZx_
	//----- _xZkqqHx_jBeKiInKiPpDjBnEiPiIjHjN_xHqqkZx_ -----
	virtual void	StateEnterEachRot (CDC* pDC);	// _xZkqqHx_iMmCjFmKiJpBjDfNjDpMiMpLiBeC_xHqqkZx_
	virtual void	StateStartEachRot (CDC* pDC);	// _xZkqqHx_iMmCjFmKiJpBjDfNiKeKiOgOiBeC_xHqqkZx_
	virtual void	StateEachRoting (CDC* pDC);		// _xZkqqHx_iMmCjFmKiJpBjDfNjCiGiBeC_xHqqkZx_
	virtual void	StateStopEachRot (CDC* pDC);	// _xZkqqHx_iMmCjFmKiJpBjDfNiPeJjHlJiBeC_xHqqkZx_
	virtual void	StateExitEachRot (CDC* pDC);	// _xZkqqHx_iMmCjFmKiJpBjDfNiPgPiMpLiBeC_xHqqkZx_
	virtual void	StateEnterAllRot (CDC* pDC);	// _xZkqqHx_jBfDjBmMiJpBjDfNjDpMiMpLiBeC_xHqqkZx_
	virtual void	StateStartAllRot (CDC* pDC);	// _xZkqqHx_jBfDjBmMiJpBjDfNiKeKiOgOiBeC_xHqqkZx_
	virtual void	StateAllRoting (CDC* pDC);		// _xZkqqHx_jBfDjBmMiJpBjDfNjCiGiBeC_xHqqkZx_
	virtual void	StateStopAllRot (CDC* pDC);		// _xZkqqHx_jBfDjBmMiJpBjDfNiPeJjHlJiBeC_xHqqkZx_
	virtual void	StateExitAllRot (CDC* pDC);		// _xZkqqHx_jBfDjBmMiJpBjDfNiPgPiMpLiBeC_xHqqkZx_

//----- 05.06.27 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	virtual void	StateStartMoveAllRot (CDC* pDC);// _xZkqqHx_jBfDjBmMiJpBjDfNiInKjDkOiKeKiOgOiBeC_xHqqkZx_
	virtual void	StateMovingAllRot (CDC* pDC);	// _xZkqqHx_jBfDjBmMiJpBjDfNiInKjDkOjCiGiBeC_xHqqkZx_
	virtual void	StateStopMoveAllRot (CDC* pDC);	// _xZkqqHx_jBfDjBmMiJpBjDfNiInKjDkOiPeJjHlJiBeC_xHqqkZx_
//----- 05.06.27 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

	//----- FCToolBaseEdit_xZkqqHx_iCmMiDfEiDhFiDeOiDiJiDfIiCmFjFeLjAhL_xHqqkZx_ -----
	virtual void	ResetEditHandleList ();

protected:
// _xZkqqHx_iClBiCmMiDeOiDiJiDfIiMmFjHeMiCmMjCoIiLgAiBeC_xHqqkZx_
enum
{
	STATE_BEGIN = BASE_CLASS::STATE_END,	// _xZkqqHx_iPpDjBnEiKeKiOgOiBeC_xHqqkZx_
// 05.06.06 Fukushiro M. 1_xZkqqHx_iNhDjFmPiNfI_xHqqkZx_ ()
//	STATE_ENTER_EACH_ROT = FCToolSelect::STATE_END,	// _xZkqqHx_iMmCjFmKiJpBjDfNjDpMiMpLiBeC_xHqqkZx_
	STATE_ENTER_EACH_ROT,		// _xZkqqHx_iMmCjFmKiJpBjDfNjDpMiMpLiBeC_xHqqkZx_
	STATE_START_EACH_ROT,		// _xZkqqHx_iMmCjFmKiJpBjDfNiKeKiOgOiBeC_xHqqkZx_
	STATE_EACH_ROTING,			// _xZkqqHx_iMmCjFmKiJpBjDfNjCiGiBeC_xHqqkZx_
	STATE_STOP_EACH_ROT,		// _xZkqqHx_iMmCjFmKiJpBjDfNiPeJjHlJiBeC_xHqqkZx_
	STATE_EXIT_EACH_ROT,		// _xZkqqHx_iMmCjFmKiJpBjDfNiPgPiMpLiBeC_xHqqkZx_
	STATE_ENTER_ALL_ROT,		// _xZkqqHx_jBfDjBmMiJpBjDfNjDpMiMpLiBeC_xHqqkZx_
	STATE_START_ALL_ROT,		// _xZkqqHx_jBfDjBmMiJpBjDfNiKeKiOgOiBeC_xHqqkZx_
	STATE_ALL_ROTING,			// _xZkqqHx_jBfDjBmMiJpBjDfNjCiGiBeC_xHqqkZx_
	STATE_STOP_ALL_ROT,			// _xZkqqHx_jBfDjBmMiJpBjDfNiPeJjHlJiBeC_xHqqkZx_
	STATE_EXIT_ALL_ROT,			// _xZkqqHx_jBfDjBmMiJpBjDfNiPgPiMpLiBeC_xHqqkZx_

//----- 05.06.27 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	STATE_START_MOVE_ALL_ROT,	// _xZkqqHx_jBfDjBmMiJpBjDfNiInKjDkOiKeKiOgOiBeC_xHqqkZx_
	STATE_MOVING_ALL_ROT,		// _xZkqqHx_jBfDjBmMiJpBjDfNiInKjDkOjCiGiBeC_xHqqkZx_
	STATE_STOP_MOVE_ALL_ROT,	// _xZkqqHx_jBfDjBmMiJpBjDfNiInKjDkOiPeJjHlJiBeC_xHqqkZx_
//----- 05.06.27 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----

	STATE_END,					// _xZkqqHx_iPpDjBnEiPeJjHlJiBeC_xHqqkZx_
};

protected:
	FTRotElemMap	m_mpRotElem;		// _xZkqqHx_jFjEjFgJiCmMjBkOjAkLiCpAiLeMjIfOiBeC_xHqqkZx_
	double			m_dAllAngle;		// _xZkqqHx_jBfDjBmMiJpBjDfNiCmMiKhAjDhIiBeC_xHqqkZx_
	DBLPoint		m_mmptAllCenter;	// _xZkqqHx_jBfDjBmMiJpBjDfNiCmMjCiGjAfDiNmAjFfHiBeC_xHqqkZx_

	//----- _xZkqqHx_iMmCjFmKiMjPiNpFiCmMiDhBiDgCiDgHiPpDjBnEjFmPjAjE_xHqqkZx_ -----
	FCObjDynabase*		m_pHitEachObj;
	FCRotElem		m_HitEachElem;
	double			m_dHitEachAngle;
	//----- _xZkqqHx_jBfDjBmMiMjPiNpFiCmMiDhBiDgCiDgHiPpDjBnEjFmPjAjE_xHqqkZx_ -----
	double			m_dHitAllAngle;		// _xZkqqHx_jBfDjBmMiJpBjDfNiCnGiCmMiDhBiDgCiDgHiBeC_xHqqkZx_

	//----- _xZkqqHx_iJpBjDfNiPiIjHjNiCmMiDiPiBfLiDeOjFmPjAjE_xHqqkZx_ -----
	double			m_dMoveR;			// _xZkqqHx_iJpBjDfNiPiIjHjNjCiGiCmMiBeBiMlLiNnNiCmMiJpBjDfNjHmKiBeC_xHqqkZx_

//----- 05.06.27 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//	//----- _xZkqqHx_jCiGjAfDiInKjDkOiPiIjHjNiCmMiDiPiBfLiDeOjFmPjAjE_xHqqkZx_ -----
//	DBLPoint		m_mmptCenterOrig;	// _xZkqqHx_jBfDjBmMiJpBjDfNiCmMjCiGjAfDiNmAjFfHiBeC_xHqqkZx_
//----- 05.06.27 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----
}; // class FCToolRotate.

// 02.12.05 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//extern FCToolRotate	g_toolRotate;

#endif//__FCToolRotate_h
