#pragma once
#include "Resource.h"
#include "afxwin.h"
#include "angle.h"
#include <regex>
#include <string>
#include "DrawLineStruct.h"

// CModifyLinePointDlg 对话框

class CModifyLinePointDlg : public CBCGPDialog
{
	DECLARE_DYNAMIC(CModifyLinePointDlg)

public:
	CModifyLinePointDlg(CWnd* pParent = NULL);   // 标准构造函数
	virtual ~CModifyLinePointDlg();

	DrawLineDataStruct m_editLineDataGroup;		// 存储航线数据

	void SetLonLat(double lon,double lat);
	void GetLonLat(double &lon,double &lat, int &pointID);
	bool IsCirclingPoint();

	void SetCirclingPointRBTNVisible(bool isVisible=false);//设置盘旋点按钮是否可见
	void CheckedCirclingPoint();  //勾选盘旋点

	void SetSelectedPointID(int pointID);  //设置选中的航点

	// 对话框数据
	enum { IDD = IDD_DLG_MODIFY_POINT };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()

public:
	virtual BOOL OnInitDialog();
	afx_msg void OnCbnSelchangeComboPt();

private:
	CBCGPComboBox m_PositionType;
	CBCGPEdit m_strLon;
	CBCGPEdit m_strLat;
	int m_bCirclingPoint;
	bool m_bCheck;
	int m_selectedPointID;	//航点号

	Angle angle;
	double m_gLat;
	double m_gLon;
	int posTypeID;
	int lastTypeID;

	bool m_bCirclingPointVisible;

	std::string splitSymbol;
	std::string dSymbol;
	std::string mSymbol;
	std::string sSymbol;
public:
	afx_msg void OnCbnSelchangeComboType();

private:
	void InitEidtText();

	void getDMSString(double lon,double lat,string &str_lon,string &str_lat);

	double getEditValue(const int ID);

	bool checkLon(string strLon,int type=0);
	bool checkLat(string strLat,int type=0);
public:
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedCancel();
	afx_msg void OnBnClickedSetcirclingpoint();
	afx_msg void OnEnKillfocusEditLon();
	afx_msg void OnEnKillfocusEditLat();
	CBCGPComboBox m_PointID;
	afx_msg void OnCbnSelchangeComboPointid();
};