156 lines
6.6 KiB
C++
156 lines
6.6 KiB
C++
/////////////////////////////////////////////
|
|||
|
|
// TDbDrawingName custom object.
|
||
|
|
|
||
|
|
#if !defined(ARX__TDBDRAWINGNAME_H__20041122_170214)
|
||
|
|
#define ARX__TDBDRAWINGNAME_H__20041122_170214
|
||
|
|
|
||
|
|
#if _MSC_VER > 1000
|
||
|
|
#pragma once
|
||
|
|
#endif // _MSC_VER > 1000
|
||
|
|
|
||
|
|
#include "dbmain.h"
|
||
|
|
//#include "DbEntity.h"
|
||
|
|
class TDbText;
|
||
|
|
|
||
|
|
|
||
|
|
class TARCH_EXP TDbDrawingName : public TDbEntity
|
||
|
|
{
|
||
|
|
protected:
|
||
|
|
static Adesk::Int16 g_nVersion;
|
||
|
|
|
||
|
|
XPoint m_ptLocation; // 位置点
|
||
|
|
XString m_szNameText; // 图名文字
|
||
|
|
XString m_szScaleText; // 比例文字
|
||
|
|
double m_dRotation; // 旋转角度
|
||
|
|
double m_dNameHeight; // 图名高度
|
||
|
|
double m_dScaleHeight; // 比例高度
|
||
|
|
double m_dLineWidth; // 粗线宽度
|
||
|
|
double m_dMultiple; // 比例距图名距离, 图名字高的倍数
|
||
|
|
AcDbHardPointerId m_idNameStyle; // 图名样式
|
||
|
|
AcDbHardPointerId m_idScaleStyle; // 比例样式
|
||
|
|
BOOL m_bShowScale; // 是否显示比例
|
||
|
|
Adesk::UInt16 m_iDrawStyle; // 标注方式
|
||
|
|
Adesk::UInt16 m_colorText; // 文字颜色
|
||
|
|
BOOL m_bShowRegion; // 显示区域线 add by hh 2013-10-15
|
||
|
|
|
||
|
|
XPoint m_ptMidLoc; // sg add 090112,中下对齐时的位置点
|
||
|
|
|
||
|
|
public:
|
||
|
|
DECLARE_TENTBASE();
|
||
|
|
ACRX_DECLARE_MEMBERS(TDbDrawingName);
|
||
|
|
|
||
|
|
// Constructor / Destructor
|
||
|
|
TDbDrawingName();
|
||
|
|
virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
|
||
|
|
virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* filer);
|
||
|
|
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* filer) const;
|
||
|
|
virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* filer);
|
||
|
|
virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* filer) const;
|
||
|
|
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
||
|
|
virtual Acad::ErrorStatus subGetGripPoints(AcGePoint3dArray& gripPoints,
|
||
|
|
AcDbIntArray& osnapModes,
|
||
|
|
AcDbIntArray& geomIds) const;
|
||
|
|
virtual Acad::ErrorStatus subGetOsnapPoints(AcDb::OsnapMode osnapMode,
|
||
|
|
INT_PTR gsSelectionMark,
|
||
|
|
const AcGePoint3d& pickPoint,
|
||
|
|
const AcGePoint3d& lastPoint,
|
||
|
|
const AcGeMatrix3d& viewXform,
|
||
|
|
AcGePoint3dArray& snapPoints,
|
||
|
|
AcDbIntArray& geomIds) const;
|
||
|
|
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbIntArray& indices,
|
||
|
|
const AcGeVector3d& offset);
|
||
|
|
|
||
|
|
virtual Acad::ErrorStatus DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet, BOOL *bErase);
|
||
|
|
virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
|
||
|
|
virtual int GetFirstVersion()const{return 7;}//ok
|
||
|
|
virtual BOOL IsValid() const;
|
||
|
|
virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
||
|
|
virtual void GetTips(DList<TObjInfoUnit> &) const;
|
||
|
|
Acad::ErrorStatus GetGripText(int idx, CString &cs) const;
|
||
|
|
const TCHAR *GetDefaultLayer() const;
|
||
|
|
virtual int ConvertText(TConvertTextPtr ptr, void *pData=NULL);
|
||
|
|
// 返回发现的位置,同时posStart往前移动(以便继续找下一个使用),
|
||
|
|
virtual TTextPosition FindSubText(const TCHAR *sSubText, TTextPosition &posStart, TTextRange *pRange=NULL) const;
|
||
|
|
// 返回下一次查找的开始位置
|
||
|
|
virtual TTextPosition ReplaceSubText(const TTextPosition &posRep, const TCHAR *sRepText, TTextRange *pRange=NULL);
|
||
|
|
|
||
|
|
virtual long GetSubTextNum()const{return m_bShowScale?2:1;}//ok
|
||
|
|
virtual void SetSubText(long i,CString sText);
|
||
|
|
|
||
|
|
// sg add 110301,支持统一标高
|
||
|
|
virtual bool UnifyElevation(double dElevation = 0.0);
|
||
|
|
|
||
|
|
// 读入读出
|
||
|
|
void SetLocation(const XPoint &ptLocation) {assertWriteEnabled(); m_ptLocation = ptLocation;}
|
||
|
|
void SetNameText(const XString &szNameText) {assertWriteEnabled(); m_szNameText = szNameText;}
|
||
|
|
void SetScaleText(const XString &szScaleText) {assertWriteEnabled(); m_szScaleText = szScaleText;}
|
||
|
|
void SetRotation(double dRotation) {assertWriteEnabled(); m_dRotation = dRotation;}
|
||
|
|
void SetNameHeight(double dNameHeight) {assertWriteEnabled(); m_dNameHeight = dNameHeight;}
|
||
|
|
void SetScaleHeight(double dScaleHeight) {assertWriteEnabled(); m_dScaleHeight = dScaleHeight;}
|
||
|
|
void SetLineWidth(double dLineWidth) {assertWriteEnabled(); m_dLineWidth = dLineWidth;}
|
||
|
|
void SetMultiple(double dMultiple) {assertWriteEnabled(); m_dMultiple = dMultiple;}
|
||
|
|
void SetNameStyleId(const AcDbObjectId &idNameStyle) {assertWriteEnabled(); m_idNameStyle = idNameStyle;}
|
||
|
|
void SetScaleStyleId(const AcDbObjectId &idScaleStyle) {assertWriteEnabled(); m_idScaleStyle = idScaleStyle;}
|
||
|
|
void SetShowScale(BOOL bShowScale) {assertWriteEnabled(); m_bShowScale = bShowScale;}
|
||
|
|
void SetDrawStyle(int iDrawStyle) {assertWriteEnabled(); m_iDrawStyle = iDrawStyle;}
|
||
|
|
XPoint GetLocation() const {assertReadEnabled(); return m_ptLocation;}
|
||
|
|
XString GetNameText() const {assertReadEnabled(); return m_szNameText;}
|
||
|
|
XString GetScaleText() const {assertReadEnabled(); return m_szScaleText;}
|
||
|
|
double GetRotation() const {assertReadEnabled(); return m_dRotation;}
|
||
|
|
double GetNameHeight() const {assertReadEnabled(); return m_dNameHeight;}
|
||
|
|
double GetScaleHeight() const {assertReadEnabled(); return m_dScaleHeight;}
|
||
|
|
double GetLineWidth() const {assertReadEnabled(); return m_dLineWidth;}
|
||
|
|
double GetMultiple() const {assertReadEnabled(); return m_dMultiple;}
|
||
|
|
AcDbObjectId GetNameStyleId() const {assertReadEnabled(); return m_idNameStyle;}
|
||
|
|
AcDbObjectId GetScaleStyleId() const {assertReadEnabled(); return m_idScaleStyle;}
|
||
|
|
BOOL GetShowScale() const {assertReadEnabled(); return m_bShowScale;}
|
||
|
|
int GetDrawStyle() const {assertReadEnabled(); return m_iDrawStyle;}
|
||
|
|
|
||
|
|
// sg add 090112
|
||
|
|
void SetMidLocation(const XPoint &ptLoc) {assertWriteEnabled(); m_ptMidLoc = ptLoc;}
|
||
|
|
XPoint GetMidLocation() const {assertReadEnabled(); return m_ptMidLoc;}
|
||
|
|
|
||
|
|
// sg add 090610,增加颜色设置接口
|
||
|
|
void SetTextColor(Adesk::UInt16 color)
|
||
|
|
{
|
||
|
|
assertWriteEnabled();
|
||
|
|
m_colorText = color;
|
||
|
|
}
|
||
|
|
Adesk::UInt16 GetTextColor() const
|
||
|
|
{
|
||
|
|
return m_colorText;
|
||
|
|
}
|
||
|
|
|
||
|
|
XPoint GetScaleLocation() const; // 比例绘制点
|
||
|
|
XPoint GetNameDrawPt() const; // sg add 090325,图名绘制点
|
||
|
|
|
||
|
|
// add by hh 2013-10-15 区域PL线接口
|
||
|
|
// 设置区域轮廓
|
||
|
|
void SetRegionPoly(const AcGePoint3dArray& arPts);
|
||
|
|
// 取得区域Poly
|
||
|
|
BOOL GetRegionPoly(TGGePoly2D* pPoly) const;
|
||
|
|
BOOL IsShowRegion() const{return m_bShowRegion;}
|
||
|
|
void SetShowRegion(BOOL bShow)
|
||
|
|
{
|
||
|
|
assertWriteEnabled();
|
||
|
|
m_bShowRegion = bShow;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected:
|
||
|
|
BOOL GetText(int i, TDbText&text)const;
|
||
|
|
AcGeVector3d GetVector() const;
|
||
|
|
double GetOffset() const;
|
||
|
|
|
||
|
|
|
||
|
|
// sg add 090112
|
||
|
|
void GetBottomCenterPt(); // 根据m_ptLocation得到m_ptMidLoc点
|
||
|
|
XPoint GetBottomLeftPt() const; // 根据m_ptMidLoc得到左下对齐点
|
||
|
|
|
||
|
|
// sg add 090325,根据Beta1中的图名居中对齐点,得到Beta2中的包括比例部分的居中对齐点
|
||
|
|
void GetCenterPtIncludeScale();
|
||
|
|
|
||
|
|
// sg add 090327,获取整个符号长度/线长(沿布局转角方向)
|
||
|
|
double GetTotalLen() const;
|
||
|
|
double GetLineLen() const;
|
||
|
|
};
|
||
|
|
#endif // !defined(ARX__TDBDRAWINGNAME_H__20041122_170214)
|