305 lines
11 KiB
C++
305 lines
11 KiB
C++
#ifndef __DBAXISNO_H
|
||
#define __DBAXISNO_H
|
||
|
||
// #include "DbEntity.h"
|
||
class TDbDimension2;
|
||
|
||
#define FILT_RADIATE_LINE 0x01 //仅仅找径线
|
||
#define FILT_CIRARC_ONLY 0x02 //仅仅找圆周线
|
||
#define FILT_LINE_ONLY 0x04 //仅仅找平行直线
|
||
|
||
// 轴网选择集
|
||
class TARCH_EXP XAxisPickSet: public PickSet
|
||
{
|
||
protected:
|
||
XAxisPickSet *m_pOppsite;
|
||
|
||
public:
|
||
XAxisPickSet(int nCreateFlag):PickSet(nCreateFlag), m_pOppsite(NULL) {}
|
||
XAxisPickSet(const Entity &entFirst, int nFilterFlag=0);
|
||
~XAxisPickSet();
|
||
|
||
BOOL GetFromOppsite(const Entity &entFirst, int nFilterFlag=0); //由另一侧的轴线得到
|
||
BOOL GetFromOppsite(const XCurveSegment &entFirst, int nFilterFlag=0); //由另一侧的轴线得到
|
||
BOOL GetFromSameSide(const Entity &entFirst, int nFilterFlag=0); //由同侧轴线得到
|
||
|
||
BOOL GetFrom2Curve(const XCurveSegment &segStart, const XCurveSegment &segEnd);
|
||
|
||
// add by xly on 110314 设置交叉的轴网可以设置标注,segStart:起始轴线;segEnd:终止轴线;bIsCross轴线是否交叉
|
||
BOOL GetFrom2Curve(const XCurveSegment &segStart, const XCurveSegment &segEnd, bool bIsCross);
|
||
|
||
XAxisPickSet *GetOppsite()
|
||
{
|
||
return m_pOppsite;
|
||
}
|
||
BOOL IsArcAxis();
|
||
};
|
||
|
||
|
||
|
||
|
||
|
||
//#define AXISDIM_START_DIMENSION 0x01
|
||
//#define AXISDIM_DONOT_INSERT_LABEL 0x02
|
||
|
||
// 轴线排序
|
||
class TARCH_EXP XAxisDimSet: public DList<XCurveSegment>
|
||
{
|
||
public:
|
||
#ifdef I_AM_TCH_KERNAL
|
||
static XCurveSegment * pSortBase; // 起始点为关键点
|
||
static BOOL g_AntiClockWise;
|
||
static double g_nAngleBegin; //用于圆形轴网的开间标注, 起始轴线的角度
|
||
#else
|
||
TARCH_IMPEXP static XCurveSegment * pSortBase; // 起始点为关键点
|
||
TARCH_IMPEXP static BOOL g_AntiClockWise;
|
||
TARCH_IMPEXP static double g_nAngleBegin; //用于圆形轴网的开间标注, 起始轴线的角度
|
||
#endif
|
||
|
||
public:
|
||
XAxisDimSet() {}
|
||
XAxisDimSet(XCurveSegment *pLine)
|
||
{
|
||
assert(!pSortBase);
|
||
pSortBase=pLine;
|
||
}
|
||
~XAxisDimSet() { pSortBase=NULL; }
|
||
|
||
static int SortFunc(const XCurveSegment *cv1, const XCurveSegment *cv2);
|
||
};
|
||
|
||
|
||
|
||
|
||
|
||
#define AXF_ATTACH 0x01 //附加轴线
|
||
#define AXF_NOSIDE1 0x02 //首侧不标注
|
||
#define AXF_NOSIDE2 0x04 //末侧不标注
|
||
#define AXF_SIDE1_LEFT 0x08 //首端偏左
|
||
#define AXF_SIDE1_RIGHT 0x10 //首端偏右
|
||
#define AXF_SIDE2_LEFT 0x20 //末端偏左
|
||
#define AXF_SIDE2_RIGHT 0x40 //末端偏右
|
||
#define AXF_SIDE1_LEAD 0x80 //首端有独自引线
|
||
#define AXF_SIDE2_LEAD 0x100 //末端有独自引线
|
||
// sg add 100531,标记是否是在首个主轴号之前的附加轴号
|
||
#define AXF_PREFIRSE_ATTACH 0x200
|
||
// sg add 120214,增加首端、末端是否有独立默认位置
|
||
#define AXF_SIDE1_LEADPOS 0x400
|
||
#define AXF_SIDE2_LEADPOS 0x800
|
||
|
||
struct TARCH_EXP TAxisInfo
|
||
{
|
||
Adesk::UInt16 m_nFlag; // 是否为附加轴号
|
||
XString m_sText; // 轴号
|
||
double m_nPara2Next; // 距离或角度到下一根轴线
|
||
|
||
double m_nLeadLen1, m_nLeadLen2; // 引线长度
|
||
|
||
// TArch9 Data
|
||
double m_dLeadPos1; // 保存每个轴线端点位置距离默认点的距离
|
||
double m_dLeadPos2;
|
||
|
||
TAxisInfo() {
|
||
m_nFlag=0;
|
||
m_nPara2Next=0.0;
|
||
m_nLeadLen1=m_nLeadLen2=0.0;
|
||
|
||
// sg add 120214,增加每个轴线端点位置距离默认点的距离
|
||
m_dLeadPos1 = m_dLeadPos2 = 0.0;
|
||
}
|
||
};
|
||
|
||
|
||
|
||
|
||
|
||
#define ANF_CIRARC 0x01 //圆弧轴网
|
||
#define ANF_JOINPREV 0x02 //有前接轴网
|
||
#define ANF_HIDESIDE1 0x04 //标注起始侧
|
||
#define ANF_HIDESIDE2 0x08 //标注终止侧
|
||
#define ANF_CLOCKWISE 0x10 //顺时针方向(圆弧轴网)排序
|
||
#define ANF_CLOSE 0x20 //圆形轴网
|
||
#define ANF_PREVLINK 0x40 //前接轴网
|
||
#define ANF_NOSORT 0x80 //不自动排序
|
||
#define ANF_HIDE_AXISTEXT 0x01 // add by lgy 20120209,隐藏轴标文字
|
||
|
||
class TDbSymbDrawingIndex;
|
||
|
||
// 轴网标注
|
||
class TARCH_EXP TDbAxisLabelSet: public TDbEntity
|
||
{
|
||
DECLARE_TENTBASE();
|
||
ACRX_DECLARE_MEMBERS(TDbAxisLabelSet);
|
||
private:
|
||
const static Adesk::UInt8 g_nVersion;
|
||
protected:
|
||
Adesk::UInt16 m_nFlag; //控制标记
|
||
XCurveSegment m_segFirst; //首根轴线
|
||
DList<TAxisInfo> m_lstAxis; //开间/进深列表
|
||
double m_nDist2Center; //m_segFirst的起点到圆心的距离(靠近圆心)
|
||
double m_nLeaderLen1, m_nLeaderLen2; //引线长度(P),起始和终止
|
||
double m_nCirRadius; //轴号圆圈半径
|
||
|
||
// 文字参数
|
||
AcDbHardPointerId m_idTextStyle; //文字样式
|
||
|
||
// TArch6 data
|
||
AcDbHardPointerId m_idTextLayer;
|
||
|
||
// TArch7 Data
|
||
Adesk::UInt16 m_colorText;//文字颜色
|
||
|
||
// TArch9 Data
|
||
Adesk::UInt16 m_nFlag2; // add by lgy 20120209,新增控制标记
|
||
|
||
public:
|
||
BOOL m_bShowHide;//是否显示隐藏轴号,不存盘
|
||
|
||
// sg add 100518,增加用来区分Grip和Stretch点的变量,不存盘
|
||
bool m_bStretchPt;
|
||
|
||
protected:
|
||
// 另存Tch3用
|
||
AcDbBlockReference *AsAxisO(const TDbSymbDrawingIndex &axo, const TCHAR *pszText) const;
|
||
|
||
public:
|
||
TDbAxisLabelSet();
|
||
virtual BOOL IsValid() const;
|
||
virtual void CopyPropertiesFrom(AcDbEntity *pSrcEntity, unsigned gMatchFlag);
|
||
|
||
virtual Acad::ErrorStatus audit(AcDbAuditInfo* pAuditInfo);
|
||
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 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 void modified(const AcDbObject* pDbObj);
|
||
|
||
public: // drived from TDbEntity
|
||
virtual DrawType GetDrawType() const;
|
||
virtual void GetTips(DList<TObjInfoUnit> &) const; //取动态属性显示数据
|
||
virtual Acad::ErrorStatus GetGripText(int i, CString &cs) const;
|
||
virtual const TCHAR *GetDefaultLayer() const;
|
||
virtual Acad::ErrorStatus ExplodeOrDraw2d(XExplodeDraw &dc) const;
|
||
|
||
virtual long GetSubTextNum()const;//ok
|
||
virtual TSubText* HitTestText(XPoint pt)const;
|
||
virtual TSubText* GetSubText(long iText)const;
|
||
virtual void SetSubText(long i,CString sText);
|
||
|
||
//add by xlc on 090608 添加文字查找替换功能
|
||
// 返回发现的位置,同时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);
|
||
BOOL GetText(int i,TDbText&text)const;
|
||
|
||
virtual Acad::ErrorStatus DownGradeSave(int nDrawMode, AcDbVoidPtrArray &entSet,
|
||
BOOL *bErase); // sg add 120214,根据9.0的新需求,修改轴号对象,支持导出
|
||
|
||
// sg add 101116,支持统一标高
|
||
virtual bool UnifyElevation(double dElevation = 0.0);
|
||
virtual CString GetXml(const AcGeMatrix3d& mat) const;
|
||
|
||
// sg add 120214,支持夹点ctrl功能切换
|
||
virtual int GetCtrlToggleIndex()const { return 8; }
|
||
|
||
public: // Helper Methods
|
||
XCurveSegment GetAxis(int idx) const;
|
||
// 取得正交的曲线, nSide: 0-起始侧, 1-终止侧
|
||
XDirectionCurve GetOrthoCurve(int nSide, int bForceOpen=FALSE) const;
|
||
int OnWhichSide(XPoint pt) const; //0--起始端, 1--末端
|
||
void SortAxisLabel(const TCHAR *szFrom);
|
||
|
||
BOOL ConvertFrom(const XAxisDimSet &dimSet);
|
||
BOOL GetDimension(int nSide, TDbDimension2 &dim1, TDbDimension2 &dim2) const;
|
||
//void MoveGripPointAt(int idx, XPoint vtOffset);
|
||
int HitTestOnLabel0(XPoint ptPick,int *pSide=NULL)const;//add by whl on 041117,不忽略隐藏轴号
|
||
int HitTestOnLabel(XPoint ptPick, int *pSide=NULL)const;//忽略隐藏轴号
|
||
int HitTestOnAxis(XPoint ptPick, int *pSide=NULL) const;
|
||
int HitLabel(const XCurveSegment &seg, XString &sLab) const; // tol=_DIST_SNAP, return index; >=0, hit ok
|
||
|
||
// modify by lgy 20120208,增加是否自动重排序号的参数
|
||
// BOOL AddAxis(XCurveSegment seg, int nAxisFlag, const TCHAR *pszLab);
|
||
// BOOL AddLabel(XPoint ptAdd, int nAxisFlag, const TCHAR *pszLab);
|
||
BOOL AddAxis(XCurveSegment seg, int nAxisFlag, const TCHAR *pszLab, BOOL bSort = TRUE);
|
||
BOOL AddLabel(XPoint ptAdd, int nAxisFlag, const TCHAR *pszLab, BOOL bSort = TRUE);
|
||
|
||
BOOL RemoveLabel(int idx, BOOL bSortLabel=TRUE);
|
||
void SetFirstSegment(XCurveSegment seg);
|
||
void NegateParams();
|
||
Acad::ErrorStatus SetPrevLink(AcDbObjectId id);
|
||
|
||
// add by xly on 110314 支持交叉轴网可以标注
|
||
BOOL ConvertFrom(const XAxisDimSet &dimSet, bool bIsCross);
|
||
|
||
public: // Properties
|
||
AcDbObjectId GetTextStyleId() const;
|
||
AcDbObjectId GetTextLayerId() const;
|
||
double GetLeaderLen(int nSide, BOOL bAsPaperUnit) const;
|
||
//double GetAxisLeaderLen(int idx, int nSide, BOOL bAsPaperUnit) const;
|
||
double GetCirRadius(BOOL bAsPaperUnit=TRUE) const; //PS
|
||
BOOL IsArcAxisNet() const; //圆弧轴网的标注(包括径向和周向)
|
||
BOOL IsArcAxis() const; //是否标注弧轴线
|
||
BOOL IsSortAuto() const;
|
||
XPoint GetArcNetCenter() const;
|
||
XPoint GetLabelCenter(int iAxis, int nSide) const;
|
||
const TCHAR * GetLabel(int iAxis) const;
|
||
int GetAxisNum() const;
|
||
int GetVisSides() const;
|
||
int GetAxisVisSides(int idx) const;
|
||
|
||
void SetVisSides(int nSides);
|
||
void SetAxisVisSides(int idx, int nSides);
|
||
void SetTextStyleId(AcDbObjectId id);
|
||
void SetTextLayerId(AcDbObjectId id);
|
||
void SetLeaderLen(int nSide, double val, BOOL bAsPaperUnit);
|
||
void SetCirRadius(double val, BOOL bAsPaperUnit=TRUE);
|
||
void HideSide(int nSide, BOOL bTrue=TRUE);
|
||
void HideAxisLabel(int idx, int nSide, BOOL bTrue);
|
||
void SetLabel(int nIdx, const TCHAR *pszText, BOOL bSort,BOOL bReverse=FALSE);
|
||
void SetFirstAxis(XCurveSegment seg);
|
||
void SetSortAuto(BOOL bTrue);
|
||
void ReverseOrder();
|
||
|
||
void SetShowHide(bool bHide){assertWriteEnabled();m_bShowHide=bHide;}//ok
|
||
|
||
// sg add 090723,支持使用新、旧圆圈文字样式,动态数据
|
||
void SetCircleTextStyle(int nStyle);
|
||
int GetCircleTextStyle() const;
|
||
|
||
// sg add 100530,根据8.5需求,增加保存字母组合时的排序规则,是“变前项”,还是“变后项”的动态数据
|
||
void SetChangePreNum(BOOL bTrue);
|
||
BOOL IsChangePreNum() const;
|
||
|
||
// add by lgy 20120209,9.0添加轴号标注文字隐藏
|
||
void SetAllAxisTextHide(BOOL bTrue);
|
||
BOOL IsHideAllAxisText() const;
|
||
|
||
// add by xly on 110315 获得轴标被隐藏侧
|
||
int GetHideSide();
|
||
|
||
public:
|
||
// sg add 110607,专门提供给“一轴多号”命令使用,用于修改各个引线长度
|
||
void SetLeaderLenOneByOne(int nSide, double val, BOOL bAsPaperUnit);
|
||
void AddLeaderLenOneByOne(int nSide, double val, BOOL bAsPaperUnit);
|
||
|
||
// sg add 110614,设置某轴号为主轴号前的附加轴号
|
||
void SetPreFirstAttachLabel(int nIdx, BOOL bAttach);
|
||
};
|
||
|
||
|
||
/////////////////////////////////////////////
|
||
// 找离ptAxisEnd最近的轴线
|
||
BOOL TARCH_IMPEXP GetClosestAxis(PickSet &ssJs, const XPoint &ptAxisEnd, Entity &eAxis);
|
||
|
||
#endif |