Files
envi-code/SourceCode/Code2026/ThunderProof/TSymbEdJigEx.cpp
T
2026-09-28 15:28:50 +08:00

75 lines
1.6 KiB
C++

#include "StdAfx.h"
#include "TSymbEdJigEx.h"
// 转换成ADS代码
int TSymbEdJigEx::GetRetCode(int retCode, int *kwordId) const
{
int ret = retCode;
if (ret == AcEdJig::kCancel)
ret = RTCAN;
else if(ret == AcEdJig::kNull)
ret = RTNONE;
else if (ret <= 0)
ret = RTNORM;
else {
if(kwordId) *kwordId = ret-1;
ret = RTKWORD;
}
return ret;
}
// 开始执行拖动
int TSymbEdJigEx::DoIt(int *keyIndex)
{
int nRetCode=0;
acedGetAcadDwgView()->SetFocus(); //屏幕菜单点取时, 命令焦点没有在图形窗口
setDispPrompt(m_sPrompt);
if(!!m_sKeyword && keyIndex) {
INITGET_BEG(-1, m_sKeyword);
try {
nRetCode = drag();
} catch(...) {
nRetCode=AcEdJig::kCancel;
}
INITGET_END();
} else {
try {
nRetCode = drag();
} catch(...) {
nRetCode=AcEdJig::kCancel;
}
}
nRetCode=GetRetCode(nRetCode, keyIndex);
return nRetCode;
}
AcEdJig::DragStatus TSymbEdJigEx::GetPoint(XPoint &pt)
{
return acquirePoint(pt);
}
// 反馈
AcEdJig::DragStatus TSymbEdJigEx::sampler()
{
DragStatus stat;
setUserInputControls((UserInputControls)
(AcEdJig::kAccept3dCoordinates|AcEdJig::kNullResponseAccepted));
if (!!m_sKeyword) setKeywordList(m_sKeyword);
else setKeywordList(NULL);
XPoint ptTemp;
stat=GetPoint(ptTemp);
if(stat == AcEdJig::kNormal) {
if (IsPosChanged(ptTemp)) {
m_ptResult=ptTemp;
} else
return AcEdJig::kNoChange;
}
return stat;
}
BOOL TSymbEdJigEx::IsPosChanged(XPoint ptNew) const
{
return (ptNew.Distance(m_ptResult)>_DIST_SNAP);
}