101 lines
3.7 KiB
C++
101 lines
3.7 KiB
C++
#ifndef __DbMTEXTNEW_H
|
|||
|
|
#define __DbMTEXTNEW_H
|
||
|
|
#include "dbtext.h"
|
||
|
|
|
||
|
|
class PS_EXP TDbMTextNew : public TDbMText
|
||
|
|
{
|
||
|
|
DECLARE_TENTBASE();
|
||
|
|
ACRX_DECLARE_MEMBERS(TDbMTextNew);
|
||
|
|
public:
|
||
|
|
TDbMTextNew();
|
||
|
|
~TDbMTextNew();
|
||
|
|
|
||
|
|
// drived from TDbEntity
|
||
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
|
||
|
|
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPoints,
|
||
|
|
AcDbIntArray& osnapModes,
|
||
|
|
AcDbIntArray& geomIds) const;
|
||
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
|
||
|
|
const AcGeVector3d& offset);
|
||
|
|
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
||
|
|
BOOL GetExtents(double *pWidth, double *pHeight, double *pHeight1) const;
|
||
|
|
Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
||
|
|
BOOL GetTextParts(DList<TTextPart> &lstTextParts, BOOL bSplitEAndC, double &dHeight) const;
|
||
|
|
void OutputTextLine(XExplodeDraw &dc, XPoint ptBase, const DList<TTextPart> &lineText, int &nIndex) const;
|
||
|
|
BOOL GetStyleParam1(double *nWidthFactor) const;
|
||
|
|
BOOL GetStyleParam2(double *nWidthFactor) const;
|
||
|
|
void SetOutputColor(XExplodeDraw &dc, const COLORREF &cfPre) const;// 设置当前输出颜色
|
||
|
|
|
||
|
|
void Transform2OldMText(std::vector<std::pair<CString, AcGePoint3d> > &vec);
|
||
|
|
Acad::ErrorStatus DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet, BOOL *bErase);
|
||
|
|
|
||
|
|
virtual Acad::ErrorStatus dwgInFields (AcDbDwgFiler*);
|
||
|
|
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler*) const;
|
||
|
|
virtual Acad::ErrorStatus dxfInFields (AcDbDxfFiler*);
|
||
|
|
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler*) const;
|
||
|
|
virtual int GetFirstVersion()const{return 9;}
|
||
|
|
|
||
|
|
private:
|
||
|
|
static const Adesk::UInt8 g_nVersion;
|
||
|
|
|
||
|
|
public:
|
||
|
|
// Properties
|
||
|
|
// 获取页高
|
||
|
|
double GetPageHeight(BOOL bAsPaperUnit=TRUE) const;
|
||
|
|
// 获取页间距
|
||
|
|
double GetPageDist(BOOL bAsPaperUnit=TRUE) const;
|
||
|
|
// 获取排版格式 横排竖排 0:横排, 1:竖排
|
||
|
|
int GetPageStyle() const;
|
||
|
|
// 设定页高
|
||
|
|
void SetPageHeight(double nHeight, BOOL bAsPaperUnit=TRUE);
|
||
|
|
// 设定页间距
|
||
|
|
void SetPageDist(double nDist, BOOL bAsPaperUnit=TRUE);
|
||
|
|
// 设定排版格式 横排竖排 0:横排, 1:竖排
|
||
|
|
void SetPageStyle(int nStyle);
|
||
|
|
|
||
|
|
// 获取当前点文字在整篇文字中的位置,返回值为是否找到,posFind为具体位置
|
||
|
|
bool GetCurWordPos(TTextPosition &posFind, const AcGePoint3d &ptCur);
|
||
|
|
|
||
|
|
private:
|
||
|
|
// Funktions
|
||
|
|
// 初始化字符串中文字的位置
|
||
|
|
int InitTextPos(const AcGePoint3d &ptCur);
|
||
|
|
// 初始化字符串中每行文字的位置
|
||
|
|
bool InitTextRowPos(const DList<TTextPart> &textLine,const AcGePoint3d &ptBase, int &nPosStart, const AcGePoint3d &ptCur);
|
||
|
|
// 获取点在文字中的所在行位置和行的外包框
|
||
|
|
int GetCurPtPos(XPoly2D &poly, const AcGePoint3d &ptCur);
|
||
|
|
|
||
|
|
// 根据文字样式获取文字宽度
|
||
|
|
double GetTextWidth(const CString &csWord);
|
||
|
|
|
||
|
|
// 根据字符串中的标签属性,设定每个文字的属性
|
||
|
|
void SetTextProp(CString &sText) const;
|
||
|
|
// 设定文字属性标签
|
||
|
|
void SetDefaultTextProp();
|
||
|
|
// 返回当前文字角度和水平方向的夹角
|
||
|
|
double GetAngleRangeTo2PI();
|
||
|
|
// 根据上一个文字外包框以及文字宽度和角度 构造下一个文字外包框
|
||
|
|
void ModifyPolyLine(const double &dAng, const double &dWidth, XPoly2D &poly);
|
||
|
|
|
||
|
|
|
||
|
|
private:
|
||
|
|
double m_dPageHeight; // 页高
|
||
|
|
double m_dPageDist; // 页间距
|
||
|
|
int m_nPageStyle; // 横排竖排 0:横排, 1:竖排
|
||
|
|
|
||
|
|
std::map<int, XPoly2D> m_mapPos; // 每行文字的外包框
|
||
|
|
mutable std::vector<COLORREF> m_vecCol; // zxl 2013.02.22 add 文字颜色
|
||
|
|
mutable std::vector<double> m_vecHeight; // zxl 2013.02.22 add 字高
|
||
|
|
mutable std::vector<bool> m_vecUnderLine; // zxl 2013.02.22 add 下划线
|
||
|
|
mutable CString m_csTextReal; // zxl 2013.02.22 add 显示的文字
|
||
|
|
};
|
||
|
|
|
||
|
|
class TTextParserNew : public TTextParser
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
TTextParserNew(const TCHAR *pszSrc):TTextParser(pszSrc) {}
|
||
|
|
|
||
|
|
TParserStatus GetNext(XString &sNext, BOOL bSplitEAndC, const std::vector<double> &vec, int &nPos, double &dHeight);
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|