131 lines
5.3 KiB
C++
131 lines
5.3 KiB
C++
#pragma once
|
||
#include "AecDbSymbWithText.h"
|
||
#include "GePoly2D.h"
|
||
#include "objinfounit.h"
|
||
|
||
class AecXDbText;
|
||
class AecXDbSymbArrow : public AecXDbSymbWithText
|
||
{
|
||
public:
|
||
ACRX_DECLARE_MEMBERS(AecXDbSymbArrow);
|
||
private:
|
||
const static Adesk::UInt8 g_nVersion;
|
||
public:
|
||
enum TArTextAlign { kAtSide = 1, kAlignMid = 2, kAlignEnd = 3, };
|
||
|
||
// enum TArrowType {kArrow=0, kHalfArrow=1}; // sg modify 081231,8.0增加了箭号型式
|
||
enum TArrowType { kArrow = 0, kHalfArrow = 1, kDote = 2, kCrossing = 3, kNone = 4, };
|
||
|
||
protected:
|
||
TArTextAlign m_nFlag; // 控制标记
|
||
GePoly2D m_poly;
|
||
|
||
// 文字参数
|
||
TCString m_sText;
|
||
ADSGePoint3d m_ptText; // 文字位置
|
||
double m_nArrowSize;
|
||
|
||
// void GetText(AecXDbText &text) const; // sg modify 090106
|
||
BOOL GetText(AecXDbText &text, Adesk::UInt32 cookies) const;
|
||
|
||
TArrowType m_nType; // TArch7 箭头样式
|
||
double m_dText2BaseRatio; // TArch8,文字距基线系数,sg add 081111
|
||
BOOL m_bShowText2; // 是否显示文字2,sg add 090106
|
||
TCString m_sText2; // 文字2
|
||
ADSGePoint3d m_ptText2; // 文字2位置,对在线端文字不起作用
|
||
|
||
public:
|
||
AecXDbSymbArrow();
|
||
~AecXDbSymbArrow();
|
||
virtual BOOL IsValid() const;
|
||
virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
||
|
||
//virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
|
||
virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler*);
|
||
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
|
||
virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler*);
|
||
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;
|
||
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPoints,
|
||
AcDbIntArray& osnapModes,
|
||
AcDbIntArray& geomIds) const;
|
||
virtual Acad::ErrorStatus subGetGripPoints(AcDbGripDataPtrArray& grips,
|
||
const double curViewUnitSize,
|
||
const int gripSize,
|
||
const AcGeVector3d& curViewDir,
|
||
const int bitflags) const;
|
||
virtual Acad::ErrorStatus subGetStretchPoints(AcGePoint3dArray & stretchPoints) const;
|
||
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
||
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset);
|
||
virtual Acad::ErrorStatus subMoveStretchPointsAt(const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset);
|
||
|
||
//virtual Acad::ErrorStatus DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet,
|
||
// BOOL *bErase); // sg add 090107
|
||
|
||
// drived from TDbEntity
|
||
virtual void GetTips(PtrList<ObjInfoUnit> &) const; // 取动态属性显示数据
|
||
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
||
virtual Acad::ErrorStatus Draw2d(AcGiDraw &dc) const;
|
||
virtual int ConvertText(TConvertTextPtr ptr, void *pData = NULL);
|
||
// 返回发现的位置,同时posStart往前移动(以便继续找下一个使用),
|
||
virtual TextPosition FindSubText(const TCHAR *sSubText, TextPosition &posStart, TextRange *pRange = NULL) const;
|
||
// 返回下一次查找的开始位置
|
||
virtual TextPosition ReplaceSubText(const TextPosition &posRep, const TCHAR *sRepText, TextRange *pRange = NULL);
|
||
virtual long GetSubTextNum()const { return 1; } // ok
|
||
// virtual void SetSubText(long i,CString sText) {assertWriteEnabled(); m_sText=sText;} // ok
|
||
// sg modify 090106,将该函数的实现放到了CPP中
|
||
virtual void SetSubText(long i, CString sText);
|
||
|
||
// sg add 101116,支持统一标高
|
||
virtual bool UnifyElevation(double dElevation = 0.0);
|
||
|
||
// Properties
|
||
const TCHAR *GetText() const;
|
||
// sg modify 120104,既可返回ECS点,又可以返回WCS点
|
||
// ADSGePoint3d GetTextLocation() const;
|
||
ADSGePoint3d GetTextLocation(BOOL bEcsPoint = FALSE) const;
|
||
void GetPoly2D(GePoly2D &poly) const;
|
||
TArTextAlign GetTextAlign() const;
|
||
ADSGePoint3d GetDefaultTextLocation();
|
||
AcGiDraw::TextAlignment GetTextAlignment() const;
|
||
double GetTextBaseDir() const;
|
||
double GetArrowSize(BOOL bAsPaperUnit = TRUE) const;
|
||
|
||
void SetTextLocation(ADSGePoint3d ptLoc);
|
||
void SetText(const TCHAR *pszText);
|
||
void SetPoly2D(const GePoly2D &poly);
|
||
void SetTextAlign(TArTextAlign align);
|
||
void SetArrowSize(double nSize, BOOL bAsPaperUnit = TRUE);
|
||
TArrowType GetArrowType()const { assertReadEnabled(); return m_nType; } // ok
|
||
void SetArrowType(TArrowType type) { assertWriteEnabled(); m_nType = type; } // ok
|
||
|
||
// sg add 081111,bRealDist用来控制,返回“实际距离”(自动乘字高)或“系数”
|
||
double GetText2BaseRatio(BOOL bAsPaperUnit = TRUE, BOOL bRealDist = TRUE) const;
|
||
void SetText2BaseRatio(double dVal, BOOL bAsPaperUnit = TRUE);
|
||
|
||
// sg add 090106,处理文字2使用
|
||
BOOL GetShowText2() const;
|
||
const TCHAR *GetText2() const;
|
||
// sg modify 120104,既可返回ECS点,又可以返回WCS点
|
||
// ADSGePoint3d GetText2Location() const;
|
||
ADSGePoint3d GetText2Location(BOOL bEcsPoint = FALSE) const;
|
||
void SetShowText2(BOOL bShow);
|
||
void SetText2Location(ADSGePoint3d ptLoc);
|
||
void SetText2(const TCHAR *pszText);
|
||
|
||
ADSGePoint3d GetDefaultText2Location(); // sg add 090106
|
||
AcGiDraw::TextAlignment GetText2Alignment() const;
|
||
|
||
// sg add 090623
|
||
double GetDimAngle(double dAngle) const;
|
||
|
||
public:
|
||
// add by lgy 111227,将文字基点由世界坐标系转换为实体坐标系
|
||
// 获取ECS原点,文字位置参考点
|
||
AcGePoint2d GetEcsOriginPt(BOOL bUp) const;
|
||
void GetEcsAxisVector(AcGeVector2d &xAxis, AcGeVector2d &yAxis) const;
|
||
// 通过bUp来控制获得上下文字的wcs坐标 true为上或者在线端
|
||
ADSGePoint3d GetWcsTextPt(BOOL bUp) const;
|
||
};
|