#pragma once
#include "McDbEntity.h"
#include "McDbDatabase.h"

//:Ignore

struct MxMline
{
	typedef Mdesk::Int8 MlineJustification;
	enum {
		kTop        = 0,
		kZero       = 1,
		kBottom     = 2
	};
	enum {
		kOpen         = 0,
		kClosed       = 1,
		kMerged       = 2
	};
};

struct McMLSegment
{
	McGeDoubleArray m_AreaFillParams;
	McGeDoubleArray m_SegParams;
};

typedef McArray<McMLSegment> McMLSegmentArray;


class McDbMlineImp;
//:End Ignore

// -------------------------------------------------------------------------
// Summary:
// 		McDbMline类表示AutoCAD MLINE实体
// -------------------------------------------------------------------------
class ARXDLL McDbMline  : public McDbEntity 
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbMline(void);

	// -------------------------------------------------------------------------
	// Summary:
	// 		析构函数
	// -------------------------------------------------------------------------
	virtual  ~McDbMline(void);

	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbMline);

	//:Ignore

	virtual Mdesk::Boolean    worldDraw       (McGiWorldDraw * wd);

	virtual Mcad::ErrorStatus   getGeomExtents(McDbExtents& extents, bool roughCalculation = true) const;

	Mcad::ErrorStatus setStyle(const McDbObjectId &newStyleId);
	McDbObjectId      style() const;

	Mcad::ErrorStatus setJustification(MxMline::MlineJustification newJust);
	MxMline::MlineJustification justification() const;

	Mcad::ErrorStatus setScale(mxreal newScale);
	mxreal            scale() const;

	Mcad::ErrorStatus appendSeg(const McGePoint3d& newVertex);

	Mcad::ErrorStatus setClosedMline(bool closed);
	bool              closedMline() const;

	void              setSupressStartCaps(bool supressIt);
	bool              supressStartCaps() const;
	void              setSupressEndCaps(bool supressIt);
	bool              supressEndCaps() const;

	int               numVertices() const;
	McGePoint3d       vertexAt(int index) const;


	Mcad::ErrorStatus getParametersAt(int index,
		McMLSegmentArray& params) const;

	Mcad::ErrorStatus setParametersAt(int index,
		const McMLSegmentArray& params);


	virtual Mcad::ErrorStatus dwgInFields (McDbDwgFiler* pFiler);

	virtual Mcad::ErrorStatus dwgOutFields(McDbDwgFiler* pFiler) const;

	inline McDbMlineImp* getMcDbMlineImp() const {
		return (McDbMlineImp*)m_pImp;
	}


protected:

	virtual void*        GetInnerListId() const;

	virtual void         SetInnerListId(void*);
public:
	//:End Ignore
};
