203 lines
6.3 KiB
C++
203 lines
6.3 KiB
C++
#pragma once
|
||
#include "AecDbSymbWithText.h"
|
||
#include "GePoly2D.h"
|
||
#include "ObjInfoUnit.h"
|
||
|
||
#define SYMB_SECTION_DIM_DIR 0x01 // 标注方向
|
||
#define SYMB_SECTION_START_INDEX 0x02 // 标记始端是否有文字
|
||
#define SYMB_SECTION_END_INDEX 0x04 // 标记终端是否有文字
|
||
#define SYMB_SECTION_VIEW_DIR2 0x08 // 非正交的情况,有2个剖视方向
|
||
|
||
// 剖切符号
|
||
class AecXDbText;
|
||
class AecXDbSymbSection : public AecXDbSymbWithText
|
||
{
|
||
public:
|
||
struct GripData
|
||
{
|
||
GripData(): m_idx(-1)
|
||
, m_bDrawFrame(false)
|
||
, m_pt0(AcGePoint3d::kOrigin)
|
||
, m_pt1(AcGePoint3d::kOrigin)
|
||
, m_pt2(AcGePoint3d::kOrigin)
|
||
, m_pt3(AcGePoint3d::kOrigin) {}
|
||
int m_idx; // 索引
|
||
AcGePoint3d m_pt0, m_pt1, m_pt2, m_pt3;
|
||
bool m_bDrawFrame; // 是否绘制剖切框
|
||
};
|
||
|
||
public:
|
||
ACRX_DECLARE_MEMBERS(AecXDbSymbSection);
|
||
|
||
// data members
|
||
public:
|
||
static double g_nLineWidth;
|
||
static double g_nSegLength;
|
||
|
||
protected:
|
||
const static Adesk::UInt8 g_nVersion;
|
||
|
||
Adesk::UInt8 m_bViewLine;
|
||
GePoly2D m_poly;
|
||
double m_nViewDir;
|
||
|
||
TCString m_sText;
|
||
ADSGePoint3d m_ptText1, m_ptText2;
|
||
|
||
// add by lgy 20120319,9.0需求要求添加以下变量
|
||
ADSGePoint3d m_ptSIndex; // 剖面图号文字位置点,ECS坐标系下
|
||
ADSGePoint3d m_ptEIndex;
|
||
|
||
TCString m_sDrawingIndex; // 剖面图号的文字内容
|
||
AcDbHardPointerId m_idIndexStyle; // 文字样式
|
||
double m_dIndexHeight; // 文字字高
|
||
double m_dText2BaseRatio; // 图号距文字基线系数
|
||
|
||
Adesk::UInt16 m_nFlag; // 标记位
|
||
|
||
double m_nViewDir2; // 终点处的剖视方向
|
||
|
||
public:
|
||
AecXDbSymbSection();
|
||
virtual ~AecXDbSymbSection();
|
||
|
||
virtual BOOL IsValid() const;
|
||
virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
||
|
||
//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;
|
||
|
||
// AcDbEntity overrides
|
||
virtual Acad::ErrorStatus subGetGripPoints(
|
||
AcGePoint3dArray& gripPoints,
|
||
AcDbIntArray& osnapMasks,
|
||
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 subMoveGripPointsAt(
|
||
const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset);
|
||
|
||
virtual Acad::ErrorStatus subMoveGripPointsAt(const AcDbVoidPtrArray& appData
|
||
, const AcGeVector3d& offset
|
||
, const int bitflags);
|
||
|
||
virtual Acad::ErrorStatus subGetStretchPoints(
|
||
AcGePoint3dArray& stretchPoints) const;
|
||
virtual Acad::ErrorStatus subMoveStretchPointsAt(
|
||
const AcDbIntArray& indices,
|
||
const AcGeVector3d& offset);
|
||
virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
|
||
|
||
public: // from TDbEntity
|
||
virtual Acad::ErrorStatus Draw2d(AcGiDraw &dc) const;
|
||
//virtual Acad::ErrorStatus DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet,
|
||
// BOOL *bErase);
|
||
|
||
virtual void GetTips(PtrList<ObjInfoUnit> &) const;
|
||
Acad::ErrorStatus GetGripText(int idx, CString &cs) const;
|
||
virtual int ConvertText(TConvertTextPtr ptr, void *pData = NULL);
|
||
|
||
virtual long GetSubTextNum()const { return 2; }//ok
|
||
virtual SubText*HitTestText(ADSGePoint3d pt)const;
|
||
virtual void SetSubText(long i, CString sText);
|
||
|
||
// sg add 090626,解决需求平台问题1416,支持查找替换操作
|
||
BOOL GetText(Adesk::UInt32 cookies, AecXDbText &text) const;
|
||
virtual TextPosition FindSubText(const TCHAR *sSubText, TextPosition &posStart,
|
||
TextRange *pRange = NULL) const;
|
||
virtual TextPosition ReplaceSubText(const TextPosition &posRep,
|
||
const TCHAR *sRepText, TextRange *pRange = NULL);
|
||
|
||
// sg add 110301,支持统一标高
|
||
virtual bool UnifyElevation(double dElevation = 0.0);
|
||
|
||
public: // Properties
|
||
void GetPoly2D(GePoly2D &poly) const;
|
||
void SetPoly2D(const GePoly2D &poly);
|
||
|
||
double GetViewDirection() const;
|
||
void SetViewDirection(double vec);
|
||
|
||
double GetViewDirection2() const;
|
||
void SetViewDirection2(double vec);
|
||
|
||
const TCHAR *GetText() const;
|
||
void SetText(const TCHAR * pStr);
|
||
|
||
BOOL HasViewLine() const;
|
||
void SetViewLine(BOOL bTrue);
|
||
|
||
// nPos为0表示起点端,1为终点端
|
||
ADSGePoint3d GetDefaultTextLocation(int nPos) const;
|
||
ADSGePoint3d GetTextLocation(int nPos, BOOL bEcsPoint = FALSE) const;
|
||
void SetTextLocation(int nPos, ADSGePoint3d pt);
|
||
|
||
// add by lgy 20120417,为剖面图号属性增加相应接口
|
||
// 剖面图号的文字内容
|
||
TCString GetDrawingIndex() const;
|
||
void SetDrawingIndex(CString strDrawingIndex);
|
||
|
||
// 文字样式
|
||
AcDbObjectId GetIndexStyleId() const;
|
||
void SetIndexStyleId(AcDbObjectId id);
|
||
|
||
// 文字字高
|
||
double GetIndexHeight() const;
|
||
void SetIndexHeight(double dHeight);
|
||
|
||
// 获得图号标注方向,0为剖切方向,1为剖视方向
|
||
int GetDimDirection() const;
|
||
void SetDimDirection(int nDir);
|
||
|
||
// 始端是否有文字
|
||
BOOL GetIsHasIndexS() const;
|
||
void SetIsHasIndexS(BOOL bHas);
|
||
|
||
// 终端是否有文字
|
||
BOOL GetIsHasIndexE() const;
|
||
void SetIsHasIndexE(BOOL bHas);
|
||
|
||
// 返回图号文字距基线系数
|
||
double GetText2BaseRatios() const;
|
||
void SetText2BaseRatios(double dText2BaseRatio);
|
||
|
||
// nPos为0表示起点端,1为终点端
|
||
ADSGePoint3d GetDefaultIndexLocation(int nPos) const;
|
||
ADSGePoint3d GetIndexLocation(int nPos, BOOL bEcsPoint = FALSE) const;
|
||
void SetIndexLocation(int nPos, ADSGePoint3d pt);
|
||
|
||
// 是否为非正交(非垂直)的剖切符号
|
||
BOOL GetNonPerpendicularitySection() const;
|
||
void SetNonPerpendicularitySection(BOOL bYes);
|
||
|
||
bool hasLastPoint() const;
|
||
void setLastPoint(const AcGePoint3d &pt);
|
||
AcGePoint3d getLastPoint() const;
|
||
|
||
private:
|
||
// add by lgy 20120322,将文字基点由世界坐标系转换为实体坐标系
|
||
// 获取ECS原点,文字位置参考点
|
||
AcGePoint2d GetEcsOriginPt(int nPos) const;
|
||
// 获得X轴Y轴
|
||
void GetEcsAxisVector(AcGeVector2d &xAxis, AcGeVector2d &yAxis, int nPos) const;
|
||
// 由ecs转换成为wcs
|
||
ADSGePoint3d GetWcsTextPt(int nPos) const;
|
||
|
||
double GetEndViewLineDir() const;
|
||
|
||
AcGiDraw::TextAlignment GetIndexTextAlignment(int nPos) const;
|
||
double GetIndexTextRotation(int nPos) const;
|
||
|
||
void getGripPoints(AcGePoint3dArray& gripPoints) const;
|
||
|
||
private:
|
||
mutable std::vector<GripData> m_GripDatas;
|
||
};
|