#pragma once
class McEdJigCommandImp;
class MXDRAWDLL McEdJigCommand
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		拖放函数,采样函数返回值
	// -------------------------------------------------------------------------
	enum DragStatus 
	{
		kNoChange       = -6,			//	状态没有发生变化
		kCancel     = -4,			//	用户取消
		kOther      = -3,			//	其它未知错误.如输入的类型对，但数值不满足UserInputControls要求。
		kNull       = -1,			//  用户空输入
		kNormal     = 0,			//  正常输入
		kKW1        = 1,			//	输入了关键值1
		kKW2,						//	输入了关键值2
		kKW3,						//	输入了关键值3
		kKW4,						//	输入了关键值4
		kKW5,						//	输入了关键值5
		kKW6,						//	输入了关键值6
		kKW7,						//	输入了关键值7
		kKW8,						//	输入了关键值8
		kKW9						//	输入了关键值9
	};

	enum  DoneStatius
	{
		kContinueCommand,
		kExitCommand
	};


	enum acquirePointValue
	{
		kGetBegan = 0x01,
		kGetEnd = 0x02,
		kGetMouseDown = 0x04,
		kGeAll = 0x07,
		kGetMouseUp = 0x08,
		kGetAuto = 0x10,
	};

	// -------------------------------------------------------------------------
	// Summary:
	// 	用户输入函数控制操作符
	// -------------------------------------------------------------------------
	typedef enum  {
		kInvalidMode     = 0,
		kEnableOsnapMode = 0x0001,
		kEnableInputOffset = 0x0002
	} UserInputControls;

	McEdJigCommand(void);

	virtual ~McEdJigCommand(void);

	// -------------------------------------------------------------------------
	// Summary:
	// 		与用户交互操作，在图上取一个点
	// -------------------------------------------------------------------------
	DragStatus acquirePoint(IN McGePoint3d&,int param = kGetBegan,bool* pIsSuccessComplete = nullptr);

	void run();

	virtual void onDraw();
	// 
	virtual DragStatus sampler()		= 0;

	virtual McDbEntity* entity() const	= 0;


	// 完成一个获取事件.
	virtual DoneStatius done(DragStatus status){ return kContinueCommand;};

	virtual bool startDrag() {return true;};

	virtual bool endDrag(bool isAppExit){return true;};

	virtual bool startCommand(){return true;};

	virtual bool exitCommand(bool isAppExit){return true;};

	virtual Mdesk::Boolean update();

	void  sendEventTouchesBegan(MxTouchSet *pTouches, MxEvent *pEvent);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回用户的输入控制符
	// -------------------------------------------------------------------------
	int userInputControls();

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置用户的输入控制
	// -------------------------------------------------------------------------
	void                       setUserInputControls(int);
private:
	McEdJigCommandImp* m_pImp;
};

