Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

587 lines
14 KiB
C++

#pragma once
#include "GeArc.h"
#include "PickEntSet.h"
#include "DListStack.h"
#include "acedinputpointmonitorex.h"
#include "AcGiViewDraw.h"
#include "SymbDialog.h"
#include "AecDbDimension.h"
#include "AecDbSymbNorthThumb.h"
#include "aecDbSymbSymmetry.h"
#include "aecDbSymbSection.h"
#include "AecDbSymbModi.h"
#include "AecDbSymbCoord.h"
#include "AecDbSymbElevation.h"
#include "AecDbDrawingName.h"
#include "AecDbSymbDrawingIndex.h"
#include "AecDbSymbIndexPointer.h"
#include "AecDbSymbComposing.h"
class DimensionEdJig : public AcEdJig
{
public:
DimensionEdJig(AecDbDimension *pDim, const TCHAR *pszPrompt, const TCHAR *pszKeyword = NULL);
~DimensionEdJig();
int doIt();
virtual DragStatus sampler();
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
void Swap();
int GetRetCode(int *kwordId = NULL) const;
int m_nRetCode; //返回码
const TCHAR *m_pszPrompt; //提示信息
const TCHAR *m_pszKeyword; //关键字
AecDbDimension *m_pDrawEnt; //临时实体,
AecDbDimension *m_pTemp; //临时实体, 用于m_nFlag==3
GeArc m_ObjarDim;// 被标注对象
BOOL m_bKeyword;//是否按下关键字,玄长标注用
ADSGePoint3d m_ptDim;
int m_nFlag; //0--尺寸方向, 1--尺寸线位置, 2--第二个标注点, 3--其它标注点
//add by whl on 03/08/08
DListStack<ADSGePoint3d> ptStack;//标注点栈
void Step();//当前点入栈
void Undo();//撤消
ADSGePoint3d GetLastPoint();
bool CanUndo();//是否可撤消
//add by lgy 20120315 设置弧长标注标记
void SetIsArcDim();
BOOL m_bInView; //add by lgy 20120503 保存标注是否是在视口中绘制
int m_nPortNum; //视口编号
PickEntSet m_entSet;//add by lgy 20120507 保存所有视口对象
AcDbObjectId m_idDimNew;//新标注样式ID
AcDbObjectId m_idDimOld;//老标注样式ID
BOOL m_bSaveStyle; //保存是不是设置新样式
protected:
void FindAndRemoveSeg(ADSGePoint3d pt);//由一标注点找出对应段并且正确去除之
private:
//add by lxb on 2011/11/22
AcEdInputPointMonitorEx m_cMonitor;//监视器
bool m_bIsArcDim; //add by lgy 20120315 弧长标注标记
};
typedef struct CptData
{
AcGePoint2d ptCenter;
AcGePoint2d ptTem;
}PTDATA, *pPTDATA;
class DimAngleJig :public AcEdJig
{
public:
DimAngleJig(AecDbDimension *pDim,
AcGeLine2d &line1, AcGeLine2d &line2, ADSGePoint3d &pt,
TCHAR *pszPrompt, TCHAR *pszKeyword = NULL);
~DimAngleJig();
AcEdJig::DragStatus doIt();
protected:
virtual AcEdJig::DragStatus sampler();
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
static int QsortFun(const void *p1, const void *p2);//交点排序函数
private:
AecDbDimension *m_pDim;//标注
TCHAR *m_pszPrompt; //提示语
TCHAR *m_pszKeyword; //关键字
AcGePoint3d m_ptLast; //记录鼠标上次位置
AcGePoint3d m_ptCur; //记录鼠标当前位置
AcGeLine2d m_line1; //成角直线1
AcGeLine2d m_line2; //成角直线2
ADSGePoint3d m_ptCen; //成角顶点
};
class TMulDimEntity : public AcDbEntity
{
public:
TMulDimEntity() {}
virtual ~TMulDimEntity() {}
AecDbDimension *m_pDrawEnt; //临时实体,
AecDbDimension *m_pDrawEntAll; //临时实体,
int m_iFlag;
virtual Adesk::Boolean subWorldDraw(AcGiWorldDraw* mode)
{
assertReadEnabled();
AcGiViewDraw dc(mode, NULL);
m_pDrawEnt->Draw2d(dc);
if (m_iFlag == 2 && m_pDrawEntAll != NULL)
{
m_pDrawEntAll->Draw2d(dc);
}
return Adesk::kTrue;
}
};
class QuickDimensionJig : public AcEdJig
{
public:
QuickDimensionJig();
virtual ~QuickDimensionJig();
int doIt();
virtual DragStatus sampler();
virtual Adesk::Boolean update();
virtual AcDbEntity *entity() const;
const TCHAR *m_pszKeyword; //关键字
// AecDbDimension *m_pDrawEnt; //临时实体,
// AecDbDimension *m_pDrawEntALL;
AecDbDimension *m_pDrawEntX; //临时实体,
AecDbDimension *m_pDrawEntY; //临时实体,
double m_dFactor;
int m_iFlag;
ADSGePoint3d m_ptDim;
ADSGePoint3d m_lowPt, m_upPt;
void SetKeyword(const TCHAR *pszKeyword);
void SetExtents(ADSGePoint3d lowPt, ADSGePoint3d upPt);
void SetMidPoints(AcGePoint3dArray &dimPoints);
void SetDimType(int iFlag);
void AddToDataBase();
TMulDimEntity m_dimbEntity;
};
class SymbEdJig : public AcEdJig {
protected:
int GetRetCode(int nRetCode, int *kewyIdx = NULL) const;
protected:
//输入
XString m_sPrompt; //提示信息
XString m_sKeyword;
XPoint m_ptResult;
public:
SymbEdJig() {}
virtual int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(XPoint &pt);
virtual BOOL IsPosChanged(XPoint ptNew) const;
virtual DragStatus sampler();
public:
void SetPrompt(const TCHAR *s) {
m_sPrompt = s;
}
void SetKeyword(const TCHAR *k) {
m_sKeyword = k;
}
XPoint GetPickPoint() const {
return m_ptResult;
}
};
class NorthThumbEdJig : public SymbEdJig {
public:
enum TNorthOper { kNone = 0, kCenter = 1, kDirection = 2, };
protected:
TNorthOper m_nOperCode;
// I/O
AecXDbSymbNorthThumb *m_pDrawEnt;
public:
NorthThumbEdJig(AecXDbSymbNorthThumb *);
virtual int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(XPoint &pt);
virtual BOOL IsPosChanged(XPoint ptNew) const;
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
public:
void SetOperCode(NorthThumbEdJig::TNorthOper opCode) {
m_nOperCode = opCode;
}
};
class SymmetryEdJig : public SymbEdJig {
protected:
// I/O
AecXDbSymbSymmetry *m_pDrawEnt;
public:
SymmetryEdJig(AecXDbSymbSymmetry *);
virtual DragStatus GetPoint(XPoint &pt);
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
};
class SectionEdJig : public SymbEdJig {
public:
enum TSectionOper { kNone = 0, kSectPoint = 1, kSectPointOther = 2, kViewDirection = 3 };
protected:
int GetRetCode(int nRetCode, int *kewyIdx = NULL) const;
protected:
TSectionOper m_nOperCode;
int m_iFlag2;
//add by lgy 20120320 添加改变量控制那种方式jig剖面符号
int m_nMode;
CSectionDlg *m_pDlg;
// I/O
AecXDbSymbSection *m_pDrawEnt;
AecXDbSymbSection m_drawEnt;
public:
SectionEdJig(AecXDbSymbSection *);
int DoIt(int *pKeyIndex = NULL);
//add by lgy 20120320 设置剖面符号绘制的方式
void SetJigMode(int nMode);
void SetJigDlg(CSectionDlg *pDlg); //设置与jig交互的对话框
protected:
virtual AcEdJig::DragStatus GetPoint(XPoint &pt);
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
public:
void SetOperCode(SectionEdJig::TSectionOper opCode) {
m_nOperCode = opCode;
}
int GetiFlag2();
};
class CloudLineJig : public SymbEdJig
{
public:
CloudLineJig(AecXDbSymbModi *pModi, XPoint ptFirst, double dMax, double dMin);
~CloudLineJig();
public:
virtual int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(XPoint &pt);
protected:
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
private:
XPoint m_ptFirst;
double m_dMax;
double m_dMin;
XPoly2D m_pline;
AecXDbSymbModi *m_pModi;
};
class SymbCutJig : public AcEdJig
{
public:
SymbCutJig(const XPoint&);
int DoIt();
virtual DragStatus sampler();
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
public:
//TDbSymbCut* m_pSymbCut;
protected:
int GetRetCode(int nRetCode, int *kwordId = NULL) const;
public:
XPoint pt0;
XPoint pt1;
XPoint pt2;
XPoint pt3;
XPoint pt4;
int m_nRupNum;
//XDcClip::ClipType m_ClipType;
int mPromptCounter;
// add by lgy 20120511,是否是双折断线
BOOL m_bIsTwo;
};
class ArrowEdJig : public SymbEdJig
{
public:
enum TArrowOper { kNone = 0, kLinePoint = 1, kArcPoint = 2, kArcMidPoint = 3, kArcRadius = 4 };
protected:
TArrowOper m_nOperCode;
AecXDbSymbArrow *m_pDrawEnt;
BOOL m_bFirst;
public:
ArrowEdJig(AecXDbSymbArrow *);
virtual int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(XPoint &pt);
protected:
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
public:
void SetOperCode(ArrowEdJig::TArrowOper opCode) { m_nOperCode = opCode; }
TArrowOper GetOperCode() { return m_nOperCode; }
};
static CString dAngle; // 保存角度
static XPoint savePoint; // 保存第一点的坐标
class CoordEdJig : public SymbEdJig
{
protected:
// I/O
AecXDbSymbCoord *m_pDrawEnt;
public:
CoordEdJig(AecXDbSymbCoord *);
virtual int DoIt();
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
public:
// [10/19/2007 nsh]
double m_dFixAngle; // 得到固定的角度值
BOOL m_bFixAngle; // 判断时候选定了固定角度的选项
// --end--
XPoint m_saveFirstPt; // sg add 120618,记忆第1点坐标,主要为了接收外面传过来的值,给savePoint赋值
};
class ElevEdJig : public SymbEdJig
{
public:
enum TElevOper { kNone = 0, kDirection = 1, kBaseLine = 2, kLeader = 3, kMove = 4 };
double m_dPointX;
AcGePoint3d m_ptBase;
double m_fBaseElev; // M
protected:
// 输入
ElevEdJig::TElevOper m_nOperCode;
// I/O
AecXDbSymbElevation *m_pDrawEnt;
public:
ElevEdJig(AecXDbSymbElevation *);
virtual int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(XPoint &pt);
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
XPoint GetDragPoint() const;
XPoint GetBasePoint() const;
public:
void SetOperCode(ElevEdJig::TElevOper nCode) {
m_nOperCode = nCode;
}
};
static double sAngle;
extern CString g_sLeadFixAngle;
extern BOOL g_bLeadFixAngle;
class LeaderEdJig : public SymbEdJig
{
public:
enum TLeaderOper { kNone = 0, kLeader = 1, kTextLine = 2, kVertex = 3, };
// add by cwk
double m_dFixAngle;
BOOL m_bFixAngle;
protected:
// 输入
LeaderEdJig::TLeaderOper m_nOperCode;
// I/O
AecXDbSymbMultiLeader *m_pDrawEnt;
public:
LeaderEdJig(AecXDbSymbMultiLeader *);
int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(XPoint &pt);
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
XPoint GetDragPoint() const;
XPoint GetBasePoint() const;
//add by lgy 20120206 引出标注角度固定角度不起作用
void SetDlg(CLeaderDlg *pLeadDlg);
CLeaderDlg *m_pDlg;
public:
void SetOperCode(LeaderEdJig::TLeaderOper nCode)
{
m_nOperCode = nCode;
}
};
// sg add 090330,引出标注,添加其他点时使用
class LeaderAddOtherPtJig : public SymbEdJig
{
public:
AcGePoint3d m_ptLeader;
AcGePoint3d m_ptFirstVertexes;
AcDbLine m_line;
BOOL m_bUpdateDlg; // 兼顾对象编辑和绘制对话框,标志是否时时获取对话框上的“多点共线”
CLeaderDlg *m_pDlg;
BOOL m_bAllOnLine;
double m_nLayoutRotation;//引线平行 add by lxb on 111229
BOOL m_bLeaderParall; //对象编辑时,对象是否带有引线平行属性
public:
LeaderAddOtherPtJig(CLeaderDlg *pDlg, XPoint ptStart, XPoint ptBase, double dLayoutRotation); // 绘制函数调用
LeaderAddOtherPtJig(BOOL bAllPtsOnLine, XPoint ptStart, XPoint ptBase, double dLayoutRotation, BOOL b); // 对象编辑调用
int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(XPoint &pt);
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
};
class DrawingNameJig : public AcEdJig
{
public:
DrawingNameJig(AecXDbDrawingName *pEnt);
int start(int *pKeyIndex = NULL);
AcDbEntity* entity() const;
DragStatus sampler();
Adesk::Boolean update();
void SetPrompt(const TCHAR *pszPrompt);
void SetKeyword(const TCHAR *pszKeyword);
private:
const TCHAR *m_pszPrompt; //提示信息
const TCHAR *m_pszKeyword; //关键字
AecXDbDrawingName *m_pDrawEnt; //临时实体
AcGePoint3d m_ptIns;
};
class DrawingIndexEdJig :public AcEdJig
{
public:
DrawingIndexEdJig(AecXDbSymbDrawingIndex *pEnt, TCHAR *pszPormat, TCHAR *pszKeyWord);
~DrawingIndexEdJig();
virtual AcEdJig::DragStatus sampler();
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
AcEdJig::DragStatus doIt();
private:
AecXDbSymbDrawingIndex *m_pEnt;
AcGePoint3d m_ptCur; //鼠标当前坐标
AcGePoint3d m_ptLast;
TCHAR *m_pszPormat; //提示语
TCHAR *m_pszKeyWord;
};
class IndexPointerEdJig : public SymbEdJig
{
public:
enum TIndexOper {
kNone = 0,
kSourceExtent = 1,
kTurnPoint = 2,
kTextBasePoint = 3,
kViewDirection = 4,
kAddedTurn = 5, // 剖切线中多出来的那个点
kMoreCuts = 6, // 其他剖切点
};
double m_dFixAngle; // add by cwk on 060706,固定角度值
bool m_bFixAngle;
protected:
TIndexOper m_nOperCode;
AecXDbSymbIndexPointer *m_pDrawEnt; // I/O
AcDbCircle m_drawEnt;
CArray<XLine, XLine&> m_arCutAdded;
XLine m_cutCurrDrag;
CIndexDimDlg *m_pDlg; //
public:
IndexPointerEdJig(AecXDbSymbIndexPointer *);
int DoIt(int *pKeyIndex = NULL);
void AttachDlg(CIndexDimDlg* pDlg) { m_pDlg = pDlg; }
// 根据索引初始化索引线
void InitCutLine();
protected:
virtual AcEdJig::DragStatus GetPoint(XPoint &pt);
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
public:
void SetOperCode(IndexPointerEdJig::TIndexOper opCode) {
m_nOperCode = opCode;
}
};
class ComposingEdJig : public SymbEdJig {
public:
enum TComposingOper { kNone = 0, kTextLine = 1, kTurnPoint = 2, };
protected:
TComposingOper m_nOperCode;
// I/O
AecXDbSymbComposing *m_pDrawEnt;
public:
ComposingEdJig(AecXDbSymbComposing *);
virtual int DoIt(int *pKeyIndex = NULL);
DragStatus GetPoint(XPoint &pt);
protected:
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
public:
void SetOperCode(ComposingEdJig::TComposingOper opCode) {
m_nOperCode = opCode;
}
};
class ComposingAddOtherPtJig : public SymbEdJig
{
public:
ComposingAddOtherPtJig(XPoint ptStart, XPoint ptBase);
public:
AcGePoint3d m_ptLeader; // 引线的拐点
AcGePoint3d m_ptFirstVertexes; // 引线的端点
AcDbLine m_line; // 引线
public:
int DoIt(int *pKeyIndex = NULL);
virtual DragStatus GetPoint(AcGePoint3d &pt);
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
};