// 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; }