#ifndef LINE_MANAGE_H
#define LINE_MANAGE_H

//#include "FlyLineDataStruct.h"

#include "../Include/8BMapDLL_type.h"
#include "DrawLineStruct.h"
using namespace B8MapDLL;

class CLineManage
{
public:
	CLineManage(void);

	virtual ~CLineManage(void);

	PTLIST         line;

	void        MakeListNull();
	
	//读取文件中的航线数据
	//输入:航线文件名称strFileName
	//输出:航线数据集合pLineData

	//返回值:true——文件读取成功
	//        false——文件读取失败
	bool ReadLineDataFromFile(DrawLineDataStruct &pLineData, const CString strFileName);

	bool WrongLineDataProcess(FILE *fp);
	//功能;航点数据转换成能标绘的航线数据体
	void LinePoint2DrawLinePoints(DrawLineDataStruct &lineDataArr, const PtStruct *pLinePoints, const int linePointNum);

	bool OpenFlyLineFile(const CString &str, const int &lineID, const bool &bFromLocalDir);

	void AddPt(PTLIST *other);
	void AddPt(PtStruct aOE);
	void AddPt(const double &L, const double &B,const float& H, const int &ptId);

	void ListData2ArrayData(PtStruct *pts, int &ptNum, const int &coordType);
	bool CheckOrgPtIsExisted(const PtStruct *pts, const int &ptNum);
	bool CheckFlyLineIDCorrect(const PtStruct *pts, const int &ptNum, const int &lineID);
private:

	//读取航线某航点
	int ReadAirLinePoint(FILE *fp, PtStruct &pt);

	//功能:读取航路文件的一行数据,并对该行数据进行检查
	//输入:航路文件指针fp
	//输出:航点数据体pt
	//返回值:true——成功
	//		  false——失败
	bool ReadLinePtAndCheckData(PtStruct &pt, FILE *fp);



	//功能:对航路文件进行严格的数据检查
	//输入:航路文件数据体pts,航点个数ptNum
	//输出:更改航路特征后的航路文件数据体pts

	//返回值:true——该航路文件数据正确
	//        false——该航路文件数据不正确
	//检查项:
	//      1、所有航点的航线编号是否一样;
	//      2、所有航点的航点编号是否不一样;
	bool CheckFlyLine(PtStruct *pts, const int ptNum);	


	//功能:对单个航点的数据的有效范围进行检查
	//输入:航点数据体pt
	//返回值:true——航点数据位于有效范围内
	//        false——航点数据超限
	bool CheckOnePointValue(const PtStruct pt);

};





#endif