#pragma once
#include "McDbCurve.h"
class ARXDLL McDbLine : public McDbCurve  
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明直线的类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbLine);
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbLine();
	// -------------------------------------------------------------------------
	// Summary:
	// 		由两个点构造函数
	// Parameters:
	// 		start	 -	直线的开点
	// 		end		-	直线的结束
	// -------------------------------------------------------------------------
	McDbLine(const McGePoint3d& start, const McGePoint3d& end);

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

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回直线的开始点
	// -------------------------------------------------------------------------
	McGePoint3d         startPoint() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置直线的开始点
	// Parameters:
	// 		pt - 开始点
	// Returns:
	// 		成功返回Mcad::eOk
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setStartPoint(const McGePoint3d& pt); 

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回直线的结束点
	// -------------------------------------------------------------------------
	McGePoint3d         endPoint() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置直线的结束点
	// Parameters:
	// 		pt - 开始点
	// Returns:
	// 		成功返回Mcad::eOk
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setEndPoint(const McGePoint3d& pt); 


	//:Ignore

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



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

	//dwgInFields,dwgInFields函数在文件保存,undo记录，实体clone中使用到.
	virtual Mcad::ErrorStatus dwgInFields (McDbDwgFiler* pFiler);

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

	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);

	virtual Mcad::ErrorStatus getStartParam(mxreal&) const;
	virtual Mcad::ErrorStatus getEndParam  (mxreal&) const;
	virtual Mcad::ErrorStatus getStartPoint(McGePoint3d&) const;
	virtual Mcad::ErrorStatus getEndPoint  (McGePoint3d&) const;

	virtual Mcad::ErrorStatus getPointAtParam(mxreal, McGePoint3d&) const;
	virtual Mcad::ErrorStatus getParamAtPoint(const McGePoint3d&, mxreal&)const;

	virtual Mcad::ErrorStatus getSplitCurves (const McGeDoubleArray& params,
		McDbVoidPtrArray& curveSegments) const;

	virtual Mcad::ErrorStatus getSplitCurves (const McGePoint3dArray& points,
		McDbVoidPtrArray& curveSegments) const;

	virtual Mcad::ErrorStatus getClosestPointTo(const McGePoint3d& givenPnt,
		McGePoint3d& pointOnCurve,
		Mdesk::Boolean extend
		= Mdesk::kFalse) const;
	
	virtual Mcad::ErrorStatus   getOsnapPoints(
		McDb::OsnapMode     osnapMode,
		int                 gsSelectionMark,
		const McGePoint3d&  pickPoint,
		const McGePoint3d&  lastPoint,
		const McGeMatrix3d& viewXform,
		McGePoint3dArray&   snapPoints,
		McDbIntArray&       geomIds) const;

	virtual Mcad::ErrorStatus getFirstDeriv  (const McGePoint3d&,
		McGeVector3d& firstDeriv) const;

	virtual Mcad::ErrorStatus getFirstDeriv  (mxreal param,
		McGeVector3d& firstDeriv) const;

	virtual Mcad::ErrorStatus getDistAtParam (mxreal param, mxreal& dist) const;

	virtual Mcad::ErrorStatus getParamAtDist (mxreal dist, mxreal& param) const;

	virtual Mcad::ErrorStatus getDistAtPoint (const McGePoint3d&, mxreal&)const;

	virtual Mcad::ErrorStatus getPointAtDist (mxreal, McGePoint3d&) const;

	virtual Mcad::ErrorStatus moveGripPointsAt(const McGeIntArray& indices,
		const McGeVector3d& offset);

	virtual Mcad::ErrorStatus getGripPoints(McGePoint3dArray& gripPoints,
		McGeIntArray& osnapModes,
		McGeIntArray& geomIds) const;


	virtual Mcad::ErrorStatus getOffsetCurvesEx(double offsetDist,
		McDbVoidPtrArray& offsetCurves, McGePoint3d ptOffsetRef) const;


	virtual Mcad::ErrorStatus Mirror(McGePoint3d mirrorPt1, McGePoint3d mirrorPt2);


	virtual Mcad::ErrorStatus getSamplePoints(
		double approxEps, McGePoint3dArray& pointArray,
		McGeDoubleArray& paramArray) const;

	//:End Ignore
private:
	// -------------------------------------------------------------------------
	// Summary:
	// 		直线的开始点
	// -------------------------------------------------------------------------
	McGePoint3d m_sPt;
	// -------------------------------------------------------------------------
	// Summary:
	// 		直线的结束点
	// -------------------------------------------------------------------------
	McGePoint3d m_ePt;
};



// -------------------------------------------------------------------------
// Summary:
// 		圆类型
// Remarks:
// 		x
// 		例如:x
// 		<code>
// 			AcDbObjectId
// 			CTestCommands::AddToModelSpace(AcDbEntity* pEntity,AcDbDatabase* pDatabase,bool isAutoClose)
// 			{
// 				AcDbObjectId objId;	 
// 				AcDbBlockTableRecordPointer spBlkRec(ACDB_MODEL_SPACE,pDatabase,AcDb::kForWrite);
// 				if(spBlkRec.openStatus() != Acad::eOk)
// 					return AcDbObjectId::kNull;
// 				spBlkRec->appendAcDbEntity(objId, pEntity);
// 
// 				if(isAutoClose)
// 					pEntity->close();
// 				return objId;
// 			}

// 			// 绘制一个圆心为100,100,0.0，半径为20的圆
// 			McGePoint3d cnePt(100,100,0.0);
// 			mxreal radius	= 20.0; 
// 
// 			McDbCircle* pCircle = new McDbCircle(cnePt,McGeVector3d::kZAxis,radius);
// 
// 			return AddToModelSpace(pCircle,pDatabase,true);
// 		</code>
// -------------------------------------------------------------------------
class ARXDLL McDbCircle : public McDbCurve
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbCircle);

	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbCircle();
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// Parameters:
	// 		cntr	-	圆的中心点
	//		nrm		-   暂没有使用
	//		radius	-   圆的半径
	// -------------------------------------------------------------------------
	McDbCircle(const McGePoint3d& cntr, const McGeVector3d& nrm, mxreal radius);

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

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回圆的中心点
	// -------------------------------------------------------------------------
	McGePoint3d        center() const;
	// -------------------------------------------------------------------------
	// Summary:
	// 		设置圆的中心点
	// Parameters:
	// 		pt	- 圆的中心点
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setCenter(const McGePoint3d& pt); 

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回圆的半径
	// -------------------------------------------------------------------------
	mxreal              radius() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置圆的半径
	// Parameters:
	// 		dR	- 圆的半径
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setRadius(mxreal dR);

	//:Ignore

	virtual Mcad::ErrorStatus dwgOutFields(McDbDwgFiler* pFiler) const;
	virtual Mcad::ErrorStatus dwgInFields(McDbDwgFiler* pFiler);
	virtual Mdesk::Boolean worldDraw(McGiWorldDraw* mode);

	virtual Mcad::ErrorStatus moveGripPointsAt(const McGeIntArray& indices,
		const McGeVector3d& offset);

	virtual Mcad::ErrorStatus getGripPoints(McGePoint3dArray& gripPoints,
		McGeIntArray& osnapModes,
		McGeIntArray& geomIds) const;

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

	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);
	
	virtual Mcad::ErrorStatus getClosestPointTo(const McGePoint3d& givenPnt,
		McGePoint3d& pointOnCurve,
		Mdesk::Boolean extend
		= Mdesk::kFalse) const;

	virtual Mcad::ErrorStatus getSamplePoints(
		mxreal approxEps, McGePoint3dArray& pointArray,
		McGeDoubleArray& paramArray) const;

	virtual Mcad::ErrorStatus getStartParam(double&) const;
	virtual Mcad::ErrorStatus getEndParam(double&) const;

	virtual Mcad::ErrorStatus getStartPoint(McGePoint3d&) const;
	virtual Mcad::ErrorStatus getEndPoint(McGePoint3d&) const;

	virtual Mcad::ErrorStatus getPointAtParam(double, McGePoint3d&) const;
	virtual Mcad::ErrorStatus getParamAtPoint(const McGePoint3d&, double&)const;

	virtual Mcad::ErrorStatus getDistAtParam(double param, double& dist) const;
	virtual Mcad::ErrorStatus getParamAtDist(double dist, double& param) const;
	virtual Mcad::ErrorStatus getDistAtPoint(const McGePoint3d&, double&)const;
	virtual Mcad::ErrorStatus getPointAtDist(double, McGePoint3d&) const;


	virtual Mcad::ErrorStatus   getOsnapPoints(
		McDb::OsnapMode     osnapMode,
		int                 gsSelectionMark,
		const McGePoint3d& pickPoint,
		const McGePoint3d& lastPoint,
		const McGeMatrix3d& viewXform,
		McGePoint3dArray& snapPoints,
		McDbIntArray& geomIds) const;

	virtual Mcad::ErrorStatus getOffsetCurvesEx(double offsetDist,
		McDbVoidPtrArray& offsetCurves, McGePoint3d ptOffsetRef) const;

	virtual Mcad::ErrorStatus Mirror(McGePoint3d mirrorPt1, McGePoint3d mirrorPt2);

	virtual Mcad::ErrorStatus getSplitCurves(const McGeDoubleArray& params,
		McDbVoidPtrArray& curveSegments) const;

	virtual Mcad::ErrorStatus getSplitCurves(const McGePoint3dArray& points,
		McDbVoidPtrArray& curveSegments) const;

	virtual Mcad::ErrorStatus getFirstDeriv(double param,
		McGeVector3d& firstDeriv) const;
	virtual Mcad::ErrorStatus getFirstDeriv(const McGePoint3d&,
		McGeVector3d& firstDeriv) const;


	Mcad::ErrorStatus getArea(double& area) const  override;

private:
	mxreal				 m_dRadius;
	McGePoint3d         m_ptCenter;
};


// -------------------------------------------------------------------------
// Summary:
// 		圆弧类型
// Remarks:
// 		例如:
// 		<code>
// 			AcDbObjectId
// 			CTestCommands::AddToModelSpace(AcDbEntity* pEntity,AcDbDatabase* pDatabase,bool isAutoClose)
// 			{
// 				AcDbObjectId objId;	 
// 				AcDbBlockTableRecordPointer spBlkRec(ACDB_MODEL_SPACE,pDatabase,AcDb::kForWrite);
// 				if(spBlkRec.openStatus() != Acad::eOk)
// 					return AcDbObjectId::kNull;
// 				spBlkRec->appendAcDbEntity(objId, pEntity);
// 
// 				if(isAutoClose)
// 					pEntity->close();
// 				return objId;
// 			}
// 
// 			// 绘制一个圆心为100,100,0.0，半径为20的半圆弧
// 			McGePoint3d cnePt(100,100,0.0);
// 			mxreal radius	= 20.0; 
// 			mxreal dSAng    = 0.0;
// 			mxreal dEAng    = 3.14159265;
// 			McDbArc* pArc = new McDbArc(cnePt,,radius,dSAng,dEAng);
// 			return AddToModelSpace(pArc,pDatabase,true);
// 		</code>McDbArc
// -------------------------------------------------------------------------
class ARXDLL McDbArc : public McDbCurve  
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbArc);

	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbArc();

	// -------------------------------------------------------------------------
	// Summary:
	// 		圆弧的构造函数，圆弧的位置是开始点逆时针转到结束点经过的圆弧
	// Parameters:
	//		center			-	圆弧的中心
	//		radius			-	圆弧的半径
	//		startAngle		-	圆弧的开始角，圆弧开始点顺时针转到X轴经过的弧度
	//		endAngle		-	圆弧的结束角，圆弧结束点顺时针转到X轴经过的弧度
	// -------------------------------------------------------------------------
	McDbArc(const McGePoint3d& center, mxreal radius,
		mxreal startAngle, mxreal endAngle);

	// -------------------------------------------------------------------------
	// Summary:
	// 		圆弧的构造函数，圆弧的位置是开始点逆时针转到结束点经过的圆弧
	// Parameters:
	//		center			-	圆弧的中心
	//		normal			-	暂没使用
	//		radius			-	圆弧的半径
	//		startAngle		-	圆弧的开始角，圆弧开始点顺时针转到X轴经过的弧度
	//		endAngle		-	圆弧的结束角，圆弧结束点顺时针转到X轴经过的弧度
	// -------------------------------------------------------------------------
	McDbArc(const McGePoint3d& center, const McGeVector3d& normal,
		mxreal radius, mxreal startAngle, mxreal endAngle);

	// -------------------------------------------------------------------------
	// Summary:
	// 		析构函数
	// -------------------------------------------------------------------------
	~McDbArc();

	// -------------------------------------------------------------------------
	// Summary:
	// 		由三点计算圆弧
	// Parameters:
	// 		startPt			-	圆弧的开始点
	// 		midPt			-	圆弧上的一点
	//		endPt			-   圆弧的结束点
	// Returns:
	// 		成功返回Mcad::eok
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus  computeArc(McGePoint3d startPt,
		McGePoint3d midPt,McGePoint3d endPt);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回圆弧的中心点
	// -------------------------------------------------------------------------
	McGePoint3d         center() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置圆弧的中心点
	// Parameters:
	// 		pt	- 圆弧的中心点
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setCenter(const McGePoint3d&); 

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回圆弧的半径
	// -------------------------------------------------------------------------
	mxreal              radius() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置圆弧的半径
	// Parameters:
	// 		pt	- 圆弧的半径
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setRadius(mxreal);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回圆弧的开始角,圆弧开始点顺时针转到X轴经过的弧度
	// -------------------------------------------------------------------------
	mxreal              startAngle() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置圆弧的开始角,圆弧开始点顺时针转到X轴经过的弧度
	// Parameters:
	// 		pt	- 圆弧的开始角,圆弧开始点顺时针转到X轴经过的弧度
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setStartAngle(mxreal);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回圆弧的结束角,圆弧开始点顺时针转到X轴经过的弧度
	// -------------------------------------------------------------------------
	mxreal              endAngle() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置圆弧的结束角,圆弧开始点顺时针转到X轴经过的弧度
	// Parameters:
	// 		pt	- 圆弧的结束角,圆弧开始点顺时针转到X轴经过的弧度
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus	setEndAngle(mxreal);

	//:Ignore

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

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


	virtual Mcad::ErrorStatus moveGripPointsAt(const McGeIntArray& indices,
		const McGeVector3d& offset);

	virtual Mcad::ErrorStatus getGripPoints(McGePoint3dArray& gripPoints,
		McGeIntArray& osnapModes,
		McGeIntArray& geomIds) const;

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



	virtual Mcad::ErrorStatus   getOsnapPoints(
		McDb::OsnapMode     osnapMode,
		int                 gsSelectionMark,
		const McGePoint3d&  pickPoint,
		const McGePoint3d&  lastPoint,
		const McGeMatrix3d& viewXform,
		McGePoint3dArray&   snapPoints,
		McDbIntArray&       geomIds) const;

	virtual Mcad::ErrorStatus getSamplePoints(
		double approxEps, McGePoint3dArray& pointArray,
		McGeDoubleArray& paramArray) const;

	virtual Mcad::ErrorStatus getOffsetCurvesEx(double offsetDist,
		McDbVoidPtrArray& offsetCurves, McGePoint3d ptOffsetRef) const;

	virtual Mcad::ErrorStatus Mirror(McGePoint3d mirrorPt1, McGePoint3d mirrorPt2);


	virtual Mcad::ErrorStatus getStartPoint(McGePoint3d&) const;

	virtual Mcad::ErrorStatus getEndPoint(McGePoint3d&) const;



	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);


	virtual Mcad::ErrorStatus getFirstDeriv(double param,
		McGeVector3d& firstDeriv) const;
	virtual Mcad::ErrorStatus getFirstDeriv(const McGePoint3d&,
		McGeVector3d& firstDeriv) const;

	virtual Mcad::ErrorStatus getClosestPointTo(const McGePoint3d& givenPnt,
		McGePoint3d& pointOnCurve,
		Mdesk::Boolean extend
		= Mdesk::kFalse) const;

	//
	virtual Mcad::ErrorStatus getStartParam(double&) const;
	virtual Mcad::ErrorStatus getEndParam(double&) const;

	virtual Mcad::ErrorStatus getPointAtParam(double, McGePoint3d&) const;
	virtual Mcad::ErrorStatus getParamAtPoint(const McGePoint3d&, double&)const;

	virtual Mcad::ErrorStatus getDistAtParam(double param, double& dist) const;
	virtual Mcad::ErrorStatus getParamAtDist(double dist, double& param) const;
	virtual Mcad::ErrorStatus getDistAtPoint(const McGePoint3d&, double&)const;
	virtual Mcad::ErrorStatus getPointAtDist(double, McGePoint3d&) const;


	virtual Mcad::ErrorStatus getSplitCurves(const McGeDoubleArray& params,
		McDbVoidPtrArray& curveSegments) const;

	virtual Mcad::ErrorStatus getSplitCurves(const McGePoint3dArray& points,
		McDbVoidPtrArray& curveSegments) const;



	Mcad::ErrorStatus getArea(double& area) const  override;

private:
	mxreal			m_dRadius;
	McGePoint3d	m_cenPt;
	mxreal			m_dStartAngle;
	mxreal			m_dEndAngle;
};



class McDbTextImp;
// -------------------------------------------------------------------------
// Summary:
// 		单行文字类型
// Remarks:
// 		例如:中中对齐绘制文字例程
// 		<code>
// 			AcDbObjectId
// 			CDrawTable::AddToModelSpace(AcDbEntity* pEntity,AcDbDatabase* pDatabase)
// 			{
// 				AcDbObjectId objId;	 
// 				AcDbBlockTableRecordPointer spBlkRec(ACDB_MODEL_SPACE,pDatabase,AcDb::kForWrite);
// 				if(spBlkRec.openStatus() != Acad::eOk)
// 					return AcDbObjectId::kNull;
// 				spBlkRec->appendAcDbEntity(objId, pEntity);
// 				pEntity->close();
// 				return objId;
// 			}
// 			AcDbObjectId CDrawTable::DrawMCText(AcGePoint3d pt,const MxString& sTxt,mxreal dTextHeight,AcDbDatabase* pDatabase)
// 			{
// 				AcDbText *pText = NULL;
// 				pText = new AcDbText;
// 
// 				pText->setHorizontalMode(AcDb::kTextCenter);
// 				pText->setVerticalMode(AcDb::kTextVertMid);
// 				pText->setPosition(pt);
// 				pText->setAlignmentPoint(pt);
// 				pText->setTextString(sTxt);
// 				pText->setHeight(dTextHeight );
// 				pText->setColorIndex(MrxDbgUtils::kGreen);
// 				return AddToModelSpace(pText,pDatabase);
// 			}
// 		</code>
// -------------------------------------------------------------------------
class ARXDLL McDbText: public McDbEntity
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbText();

	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// Parameters:
	//		position     -		文字位置
	//		text         -		文字内容
	//		style        -		文字风格，如果为空取当前文字样式
	//		height       -		文字高度
	//		rotation     -		文字的旋转角度
	// -------------------------------------------------------------------------
	McDbText(
		const McGePoint3d&  position,
		LPCMSTR         text,
		McDbObjectId        style = McDbObjectId::kNull,
		mxreal              height = 3.0,
		mxreal              rotation = 0);

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

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

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字位置
	// -------------------------------------------------------------------------
	McGePoint3d         position() const;


	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字位置
	// Parameters:
	// 		pos	-	文字位置 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setPosition(const McGePoint3d& pos);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字的对齐点
	// -------------------------------------------------------------------------
	McGePoint3d         alignmentPoint() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字的对齐点
	// Parameters:
	// 		pt	-	文字的对齐点 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setAlignmentPoint(const McGePoint3d& pt);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字的倾斜角度，单位为弧度
	// -------------------------------------------------------------------------
	mxreal              oblique() const;
	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字的倾斜角度，单位为弧度
	// Parameters:
	// 		dAng	-	文字的倾斜角度，单位为弧度 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setOblique(mxreal dAng);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字的旋转角度，单位为弧度
	// -------------------------------------------------------------------------
	mxreal              rotation() const; 

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字的旋转角度，单位为弧度
	// Parameters:
	// 		dAng	-	文字的旋转角度，单位为弧度 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setRotation(mxreal dAng);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字的高度
	// -------------------------------------------------------------------------
	mxreal              height() const; 

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字的高度
	// Parameters:
	// 		dH	-	文字的高度 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setHeight(mxreal dH);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字的宽度比例
	// -------------------------------------------------------------------------
	mxreal              widthFactor() const; 

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字的宽度比例
	// Parameters:
	// 		dWidthFactor	-	文字的宽度比例
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setWidthFactor(mxreal dWidthFactor);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字内容字符串，返回的字符串不使用需要调用Mx:: mcutDelString函数释放内存
	// -------------------------------------------------------------------------
	LPMSTR              textString() const;
	
	// -------------------------------------------------------------------------
	// Summary:
	// 		返回文字内容字符串
	// -------------------------------------------------------------------------
	LPCMSTR             textStringConst() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字内容字符串
	// Parameters:
	// 		pszText	-	文字内容字符串 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setTextString(LPCMSTR pszText);

	// -------------------------------------------------------------------------
	// Summary:
	// 		得到返回文字的水平对齐方式
	//		McDb::kTextLeft				水平居左
	//		McDb:: kTextCenter			水平居中
	//		McDb:: kTextRight		    水平居右
	// -------------------------------------------------------------------------
	McDb::TextHorzMode  horizontalMode() const; 

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字的水平对齐方式
	//		McDb::kTextLeft				水平居左
	//		McDb:: kTextCenter			水平居中
	//		McDb:: kTextRight		    水平居右
	// Parameters:
	// 		horzMode	-	文字的水平对齐方式 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setHorizontalMode(McDb::TextHorzMode horzMode);

	// -------------------------------------------------------------------------
	// Summary:
	// 		得到返回文字的竖直对齐方式
	//		McDb::kTextBottom		竖向最下点对齐
	//		McDb:: kTextVertMid		竖向居中对齐
	//		McDb:: kTextTop	        竖向最上点对齐
	// -------------------------------------------------------------------------
	McDb::TextVertMode  verticalMode() const;


	// -------------------------------------------------------------------------
	// Summary:
	// 		设置文字的竖直对齐方式
	//		McDb::kTextBottom		竖向最下点对齐
	//		McDb::kTextVertMid		竖向居中对齐
	//		McDb::kTextTop	        竖向最上点对齐
	// Parameters:
	// 		verMode		-	文字的竖直对齐方式 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setVerticalMode(McDb::TextVertMode verMode);

	//:Ignore

	Mdesk::Boolean      isMirroredInX() const;
	Mcad::ErrorStatus   mirrorInX(Mdesk::Boolean);

	Mdesk::Boolean      isMirroredInY() const;
	Mcad::ErrorStatus   mirrorInY(Mdesk::Boolean);

	Mcad::ErrorStatus subDwgOutFields(McDbDwgFiler* pFiler) const;

	Mcad::ErrorStatus subDwgInFields(McDbDwgFiler* pFiler);

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

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

	virtual Mcad::ErrorStatus moveGripPointsAt(const McGeIntArray& indices,
		const McGeVector3d& offset);

	virtual Mcad::ErrorStatus getGripPoints(McGePoint3dArray& gripPoints,
		McGeIntArray& osnapModes,
		McGeIntArray& geomIds) const;


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

	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);

	virtual Mcad::ErrorStatus   getOsnapPoints(
		McDb::OsnapMode     osnapMode,
		int                 gsSelectionMark,
		const McGePoint3d&  pickPoint,
		const McGePoint3d&  lastPoint,
		const McGeMatrix3d& viewXform,
		McGePoint3dArray&   snapPoints,
		McDbIntArray&       geomIds) const;

	virtual void objectClose    (const McDbObject* dbObj);

	virtual Mcad::ErrorStatus   adjustAlignment(const McDbDatabase* pDb = NULL);

	virtual Mcad::ErrorStatus Mirror(McGePoint3d mirrorPt1, McGePoint3d mirrorPt2);

	void recordGraphicsModified(bool graphicsModified = true);

	//:End Ignore

	inline McDbTextImp* getMcDbTextImp() const {
		return (McDbTextImp*)m_pImp;
	}
};


// -------------------------------------------------------------------------
// Summary:
// 		AcDbSolid类是AutoCAD中SOLID实体的表示
// -------------------------------------------------------------------------
class ARXDLL McDbSolid : public McDbEntity
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbSolid();
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// Parameters:
	// 		pt0	- 输入实体的第一点
	// 		pt1	- 输入实体的第二点
	// 		pt2	- 输入实体的第三点
	// 		pt3	- 输入实体的第四点
	// -------------------------------------------------------------------------
	McDbSolid(const McGePoint3d&    pt0,
		const McGePoint3d&    pt1,
		const McGePoint3d&    pt2,
		const McGePoint3d&    pt3);

	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// Parameters:
	// 		pt0	- 输入实体的第一点
	// 		pt1	- 输入实体的第二点
	// 		pt2	- 输入实体的第三点
	// -------------------------------------------------------------------------
	McDbSolid(const McGePoint3d&    pt0,
		const McGePoint3d&    pt1,
		const McGePoint3d&    pt2);

	// -------------------------------------------------------------------------
	// Summary:
	// 		析构函数
	// -------------------------------------------------------------------------
	virtual ~McDbSolid();
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbSolid);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回指定索引位置的点坐标
	// Parameters:
	// 		idx		-	索引位置
	//		pntRes	-	返回的点坐标
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus getPointAt(Mdesk::UInt16 idx, McGePoint3d& pntRes) const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置指定索引位置的点坐标
	// Parameters:
	// 		idx		-	索引位置
	//		pt		-	点坐标
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus setPointAt(Mdesk::UInt16 idx, const McGePoint3d& pt);

	//:Ignore

	virtual Mdesk::Boolean    worldDraw(McGiWorldDraw* mode);
	virtual Mcad::ErrorStatus dwgOutFields(McDbDwgFiler* pFiler) const;
	virtual Mcad::ErrorStatus dwgInFields(McDbDwgFiler* pFiler);

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



	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);
	//:End Ignore
private:
	McGePoint3d m_pt0;
	McGePoint3d m_pt1;
	McGePoint3d m_pt2;
	McGePoint3d m_pt3;
};

// -------------------------------------------------------------------------
// Summary:
// 		McDbTrace类表示AutoCAD中宽线实体
// -------------------------------------------------------------------------
class ARXDLL McDbTrace : public McDbEntity
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbTrace();

	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// Parameters:
	// 		pt0	- 输入实体的第一点
	// 		pt1	- 输入实体的第二点
	// 		pt2	- 输入实体的第三点
	// 		pt3	- 输入实体的第四点
	// -------------------------------------------------------------------------
	McDbTrace(const McGePoint3d&    pt0,
		const McGePoint3d&    pt1,
		const McGePoint3d&    pt2,
		const McGePoint3d&    pt3);
	// -------------------------------------------------------------------------
	// Summary:
	// 		析构函数
	// -------------------------------------------------------------------------
	virtual ~McDbTrace();
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbTrace);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回指定索引位置的点坐标
	// Parameters:
	// 		idx		-	索引位置
	//		pntRes	-	返回的点坐标
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus getPointAt(Mdesk::UInt16 idx, McGePoint3d& PntRes) const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置指定索引位置的点坐标
	// Parameters:
	// 		idx		-	索引位置
	//		pt		-	点坐标
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus setPointAt(Mdesk::UInt16 idx, const McGePoint3d&);

	//:Ignore

	virtual Mdesk::Boolean    worldDraw(McGiWorldDraw* mode);
	virtual Mcad::ErrorStatus dwgOutFields(McDbDwgFiler* pFiler) const;
	virtual Mcad::ErrorStatus dwgInFields(McDbDwgFiler* pFiler);

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

	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);
	//:End Ignore
private:
	McGePoint3d m_pt0;
	McGePoint3d m_pt1;
	McGePoint3d m_pt2;
	McGePoint3d m_pt3;
};




class McDbPointImp;
// -------------------------------------------------------------------------
// Summary:
// 		点实体类型
// Remarks:
// 		例如:绘制一个点对象
// 		<code>
// 			void DrawPoint(McGePoint3d pt)
// 			{
// 				McDbPoint* pPoint = new McDbPoint(pt);
// 				MrxDbgUtils::addToCurrentSpaceAndClose(pPoint);
// 			}
// 		</code>
// -------------------------------------------------------------------------
class ARXDLL McDbPoint : public McDbEntity
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbPoint();
	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// Parameters:
	// 		position - 点位置
	// -------------------------------------------------------------------------
	McDbPoint(const McGePoint3d&   position);
	// -------------------------------------------------------------------------
	// Summary:
	// 		析构函数
	// -------------------------------------------------------------------------
	virtual ~McDbPoint();
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbPoint);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回点位置
	// -------------------------------------------------------------------------
	McGePoint3d         position() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置点位置
	// Parameters:
	// 		pt	-	点位置 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	Mcad::ErrorStatus   setPosition(const McGePoint3d& pt);

	//:Ignore

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

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

	virtual Mcad::ErrorStatus   getOsnapPoints(
		McDb::OsnapMode     osnapMode,
		int                 gsSelectionMark,
		const McGePoint3d&  pickPoint,
		const McGePoint3d&  lastPoint,
		const McGeMatrix3d& viewXform,
		McGePoint3dArray&   snapPoints,
		McDbIntArray&       geomIds) const;

	double              ecsRotation() const;
	Mcad::ErrorStatus   setEcsRotation(double);

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

	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);

	virtual Mcad::ErrorStatus Mirror(McGePoint3d mirrorPt1, McGePoint3d mirrorPt2);

	virtual Mcad::ErrorStatus   getGripPoints(
		McGePoint3dArray&  gripPoints,
		McGeIntArray&  osnapModes,
		McGeIntArray&  geomIds) const;

	virtual Mcad::ErrorStatus moveGripPointsAt(const McGeIntArray& indices,
		const McGeVector3d& offset);

	inline McDbPointImp* getMcDbPointImp() const {
		return (McDbPointImp*)m_pImp;
	}

};


// -------------------------------------------------------------------------
// Summary:
// 		McDbRay类表示AutoCAD中的Ray实体类型
// -------------------------------------------------------------------------
class ARXDLL McDbRay : public McDbCurve
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbRay);

	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbRay(void);

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

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回XLINE的基点
	// -------------------------------------------------------------------------
	McGePoint3d  basePoint() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置XLINE的基点
	// Parameters:
	// 		pt	-	XLINE的基点 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	void         setBasePoint(const McGePoint3d& pt);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回XLINE的单位方向矢量
	// -------------------------------------------------------------------------
	McGeVector3d unitDir() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置XLINE的单位方向矢量
	// Parameters:
	// 		vec		-	XLINE的单位方向矢量 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	void         setUnitDir(const McGeVector3d& vec);

	//:Ignore

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

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

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


	Mcad::ErrorStatus moveGripPointsAt(const McGeIntArray& indices,
		const McGeVector3d& offset) override;

	Mcad::ErrorStatus getGripPoints(McGePoint3dArray& gripPoints,
		McGeIntArray& osnapModes,
		McGeIntArray& geomIds) const override;


private:
	McGePoint3d			m_basePoint;
	McGeVector3d		m_unitDir;
	//:End Ignore
};


class ARXDLL McDbXline : public McDbCurve
{
public:
	// -------------------------------------------------------------------------
	// Summary:
	// 		申明类型信息
	// -------------------------------------------------------------------------
	MCDB_DECLARE_MEMBERS(McDbXline);

	// -------------------------------------------------------------------------
	// Summary:
	// 		构造函数
	// -------------------------------------------------------------------------
	McDbXline(void);

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

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回XLINE的基点
	// -------------------------------------------------------------------------
	McGePoint3d  basePoint() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置XLINE的基点
	// Parameters:
	// 		pt	-	XLINE的基点 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	void         setBasePoint(const McGePoint3d& pt);

	// -------------------------------------------------------------------------
	// Summary:
	// 		返回XLINE的单位方向矢量
	// -------------------------------------------------------------------------
	McGeVector3d unitDir() const;

	// -------------------------------------------------------------------------
	// Summary:
	// 		设置XLINE的单位方向矢量
	// Parameters:
	// 		vec		-	XLINE的单位方向矢量 
	// Returns:
	// 		如果成功返回Mcad::eOk，如果传递的数据非法则返回Mcad::eInvalidInput
	// -------------------------------------------------------------------------
	void         setUnitDir(const McGeVector3d& vec);

	//:Ignore

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

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

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

	virtual Mcad::ErrorStatus   transformBy(const McGeMatrix3d& xform);

	virtual Mcad::ErrorStatus getOffsetCurvesEx(double offsetDist,
		McDbVoidPtrArray& offsetCurves, McGePoint3d ptOffsetRef) const;

	virtual Mcad::ErrorStatus getClosestPointTo(const McGePoint3d& givenPnt,
		McGePoint3d& pointOnCurve,
		Mdesk::Boolean extend
		= Mdesk::kFalse) const;

	virtual  Mcad::ErrorStatus intersectWith(const McDbEntity* pEnt,
		McDb::Intersect intType,
		McGePoint3dArray& points,
		int thisGsMarker = 0,
		int otherGsMarker = 0,
		int iExtendDirection = McDb::kExAll
	) const;

	virtual Mcad::ErrorStatus getStartParam(double&) const;
	virtual Mcad::ErrorStatus getEndParam(double&) const;
	virtual Mcad::ErrorStatus getStartPoint(McGePoint3d&) const;
	virtual Mcad::ErrorStatus getEndPoint(McGePoint3d&) const;

	virtual Mcad::ErrorStatus getPointAtParam(double, McGePoint3d&) const;
	virtual Mcad::ErrorStatus getParamAtPoint(const McGePoint3d&, double&)const;

	virtual Mcad::ErrorStatus getSplitCurves(const McGeDoubleArray& params,
		McDbVoidPtrArray& curveSegments) const;

	virtual Mcad::ErrorStatus getSplitCurves(const McGePoint3dArray& points,
		McDbVoidPtrArray& curveSegments) const;


	virtual Mcad::ErrorStatus getFirstDeriv(double param,
		McGeVector3d& firstDeriv) const;

	virtual Mcad::ErrorStatus getFirstDeriv(const McGePoint3d&,
		McGeVector3d& firstDeriv) const;

	virtual Mcad::ErrorStatus getDistAtParam(double param, double& dist) const;
	virtual Mcad::ErrorStatus getParamAtDist(double dist, double& param) const;
	virtual Mcad::ErrorStatus getDistAtPoint(const McGePoint3d& pt, double& d)const;
	virtual Mcad::ErrorStatus getPointAtDist(double d, McGePoint3d& pt) const;
	


	Mcad::ErrorStatus moveGripPointsAt(const McGeIntArray& indices,
		const McGeVector3d& offset) override;

	Mcad::ErrorStatus getGripPoints(McGePoint3dArray& gripPoints,
		McGeIntArray& osnapModes,
		McGeIntArray& geomIds) const override;

protected:
	McDbLine* getTmpLine() const;
private:
	McGePoint3d			m_basePoint;
	McGeVector3d		m_unitDir;
	//:End Ignore
};