#ifndef CPROCESS_UTILS_H
#define CPROCESS_UTILS_H

#include "cmprocess.h"
#include "logic_compdef.h"

/*!
 * \brief The CProcess_Locate class
 * 定位
 */
class CProcess_Utils : public CMProcess
{
public:
	enum msg_id
	{
		PROCESS_UTILS_MSG_ID=MAX_PROCESS_MSG_ID,
		BEFORE_CALI_DISTANCEDATA,
		CALIDISTANCESTEP,
		AFTER_CALI_DISTANCEDATA,
		AFTER_ALL_CALI,
		MAX_PROCESS_UTILS_MSG_ID,
	};
	CProcess_Utils(const QString& name,int32_t id);
	~CProcess_Utils();
    
    virtual void Serialize(QDataStream &stream, bool bwrite, int iVersion) override;

	void do_msg(int iID, QVariantList& vlInput, V_MsgOutput* pvlOutput) override;

	/**
	 * @brief 测量距离值.
	 * 
	 */
	double CaliDistanceData();
	/**
	 * 移动到中心测量位置.
	 * 
	 * \param iSide
	 */
	void BeforeCaliDistanceData(int iSide);

	void AfterCaliDistanceData(int iSide);

	/**
	 * @brief 测量步骤.
	 * 
	 * \param iStep
	 */
	void CaliDistanceStep(int iStep);

	void ReadRecipe(ConfigStreamReader& streamReader, int iVersion) override;


	void WriteRecipe(ConfigStreamWriter& streamWriter, int iVersion) override;

private:
	QList<CMPointInt> m_ptList;
	QList<double> m_lstDistances;
	void MovePt(const CMPointd& wt);
	void MoveZOffset(const CMPointd& wt);
};

#endif // CPROCESS_LOCATE_H
