#pragma once

//#include "..\tabxlibs\includes\cncuc\CncObj.h"
// #include <rvb\rvtypes.h"

#include "cad2d.h"


class CAD2D_API CDxfFile
{
public:
	CDxfFile(void);
	virtual ~CDxfFile(void);

	enum{
		DF_READ  = 1,
		DF_WRITE = (1<<1),
	};

	enum{
		DF_UNK    = -1,
		DF_POINT  = 0,
		DF_LINE    ,
		DF_ARC     ,
		DF_CIRCLE  ,
		DF_POLYINE ,
	};

	bool Open(const char* strFilePath, int flags);
	void Close();

	bool IsOpened();
	 
	int  GetEntityCount();
	int  GetEntityType(int index);

	//多段线分别配的数据空间需要上层程序释放。
 	bool GetGeometryAt(int index, void* pEntity, int size);


	//virtual void OnPointRead(double x, double y, double z);
	//virtual void OnLineRead(CAD_POINT p0, CAD_POINT p1);
	//virtual void OnXLineRead(double x, double y, double z);
	//virtual void OnRayRead(double x, double y, double z);
	//virtual void OnArcRead(CAD_POINT center, double radius, double startAngle, double endAngle, double thick, CAD_POINT extrusion, bool bIsCcw);
	//virtual void OnCircleRead(CAD_POINT center, double radius);
	//virtual void OnEllipseRead(double x, double y, double z);
	//virtual void OnLWPolylineRead(double x, double y, double z);
	//virtual void OnPolylineRead(double x, double y, double z);
	//virtual void OnSplineRead(double x, double y, double z);

protected:
	void ReleaseAll();

private:
	void* m_hDxf;

	void*  m_plist;
	// RvSequence  m_seq;

};

