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

69 lines
1.7 KiB
C++

// Jig.cpp: implementation of the TComposingEdJig class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Jig.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
TComposingEdJig::TComposingEdJig(TDbSymbComposing *pElev)
{
m_pDrawEnt=pElev;
}
AcEdJig::DragStatus
TComposingEdJig::GetPoint(XPoint &pt)
{
if( m_nOperCode == kDimPos )
return acquirePoint(pt);
XPoint ptBase=m_nOperCode==kTextLine? m_pDrawEnt->GetTurnPoint() : m_pDrawEnt->GetStartPoint();
return acquirePoint(pt, ptBase);
}
// 开始执行拖动
int TComposingEdJig::DoIt(int *keyIndex)
{
if(m_nOperCode==kTurnPoint) {
m_ptResult=m_pDrawEnt->GetStartPoint();
} else if(m_nOperCode==kTextLine) {
XPoint ptTemp;
ads_polar(m_pDrawEnt->GetTurnPoint(), 0.0, m_pDrawEnt->GetTextBaseLen(FALSE), ptTemp);
m_ptResult=ptTemp;
} else if(m_nOperCode == kDimPos ){
m_ptResult=m_pDrawEnt->GetTurnPoint();
}
int nRet = TSymbEdJig::DoIt(keyIndex);
return nRet;
}
// 更新实体数据
Adesk::Boolean TComposingEdJig::update()
{
Adesk::Boolean bRet=Adesk::kTrue;
if(m_nOperCode==kTurnPoint) {
m_pDrawEnt->SetTurnPoint(m_ptResult);
} else if(m_nOperCode==kTextLine) {
double nVal=m_ptResult.x - m_pDrawEnt->GetTurnPoint().x;
m_pDrawEnt->SetTextBaseLen(nVal, FALSE);
}
return bRet;
}
AcDbEntity* TComposingEdJig::entity() const
{
return (AcDbEntity *)m_pDrawEnt;
}